Add migration to delete orphaned routes
What does this MR do and why?
Add migration to delete orphaned routes
The routes.namespace_id column was converted from a loose foreign key
to a regular foreign key in 8c8faaae. In 1f439a4d, we deleted
routes whose namespaces had been removed by reading the
loose_foreign_keys_deleted_records table.
After this migration completed, one orphaned route record still remains that should be deleted. This migration removes such matching records.
We won't have any more orphaned records in the future because
routes.namespace_id is now a foreign key with cascade delete.
References
- There's one orphaned record on gitlab.com. There might be more on self-managed.
- https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37945/commands/116094
Query plan
https://console.postgres.ai/gitlab/gitlab-production-main/sessions/38027/commands/116373
How to set up and validate locally
Run the specs, or you can follow the same steps as in the spec on your local dev machine.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #514662 (closed)