Skip to content

Add not valid foreign key to namespaces.parent_id

Bojan Marjanovic requested to merge marjanovic/153101-not-valid-fk into master

What does this MR do and why?

This is to add a foreign key to namespaces.parent_id.

Following the https://docs.gitlab.com/ee/development/database/add_foreign_key_to_existing_column.html, we're:

  1. adding an invalid FK (current MR),
  2. add a data migration, to fix or clean up existing records (Draft: Set `parent_id` to nil on namespaces who... (!153101)),
  3. validate the whole table by making the foreign key VALID (follow-up MR).

Add not valid foreign key to namespaces.parent_id

Adds a not valid foreign key to namespaces.parent_id.

See https://docs.gitlab.com/ee/development/database/add_foreign_key_to_existing_column.html

Changelog: added

MR acceptance checklist

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

N/A

Edited by Bojan Marjanovic

Merge request reports