Add migration to delete orphaned groups

What does this MR do and why?

This MR is related to #419492 (closed), and we're deleting orphaned groups on gitlab.com !

We are also deleting orphaned ProjectNamespaces that don't belong to any Project.

References

Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

DB query - Total: 29 matches

Query Execution Matches
SELECT n1.id FROM namespaces n1 LEFT JOIN namespaces n2 ON n1.parent_id = n2.id WHERE n1.type = 'Group' AND n1.parent_id IS NOT NULL AND n2.id IS NULL; https://postgres.ai/console/gitlab/gitlab-production-main/sessions/33917/commands/104250 ~4 seconds 28
TBA TBA 1

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

N/A

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Alex Pooley

Merge request reports

Loading