Skip to content

Add migration to remove pending delete projects with non-existing namespace

What does this MR do?

There might be some projects where the namespace was removed, but the project wasn't. For these the projects still have a namespace_id set. So this adds a post-deploy migration remove all projects that are pending delete, and have a namespace_id that is non-existing.

This is a follow-up of !11044 (merged).

Database Checklist

When adding migrations:

When adding or modifying queries to improve performance:

  • Included the raw SQL queries of the relevant queries:
    => Query generated by CleanupNonexistingNamespacePendingDeleteProjects#find_batch

    SELECT "projects"."id"
    FROM "projects"
    WHERE "projects"."pending_delete" = 't'
      AND (NOT (EXISTS
                  (SELECT 1
                   FROM "namespaces"
                   WHERE "namespaces"."id" = "projects"."namespace_id")))

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes gitlab-org/gitlab-ce#36541.

Edited by Toon Claes

Merge request reports