Add member namespace_id DB constraints

When migration of members is finished and when project namespace is backfilled for each project, we can:

When namespace_id column of the members table has been backfilled:

  • add NOT NULL constraint for member_namespace_id column
  • change add_concurrent_foreign_key :members, :namespaces, column: :namespace_id, on_delete: :nullify to add_concurrent_foreign_key :members, :namespaces, column: :namespace_id, on_delete: :cascade

Availability and Testing

  • Please run package-and-qa job for MR to ensure no regressions occur. Some areas to keep an eye on for errors would be during resource fabrication (when adding members to a project or group, etc.), as well as in any after hooks for errors on resource deletion (deleting a user, group or project).
Edited by Alexandru Croitor