Skip to content

WIP: Migrate Namespace#root_id column

Mayra Cabrera requested to merge 62214-namespace-database-migration into master

What does this MR do?

Prework of https://gitlab.com/gitlab-org/gitlab-ce/issues/62214

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Backend to do

  • 1. Add a new column on Namespaces: root_id
    • This new column should be NOT NULL, but we can't enforce that limit until we have migrated the data.
    • This new column will store the root namespace equal to the namespace ID, so the child namespaces will use the ID of the root namespace.
  • 2. Create a background migration to fill in Namespaces root_id
    • This migration would iterate over root namespaces only (parent_id = NULL), then run the usual CTE code to find all child nodes, then update all those.
  • 3. Include logic to fill root_id when a namespace is created/updated

Next iteration

  • Once the background migration has been completed, add another migration to include an index on root_id and to make it not null
Edited by Mayra Cabrera

Merge request reports

Loading