WIP: Migrate Namespace#root_id column
What does this MR do?
Prework of https://gitlab.com/gitlab-org/gitlab-ce/issues/62214
Does this MR meet the acceptance criteria?
Conformity
- Changelog entry
- Documentation created/updated or follow-up review issue created
- Code review guidelines
- Merge request performance guidelines
- Style guides
- Database guides
- Separation of EE specific content
Performance and testing
- Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
- [-] Tested in all supported browsers
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.
- This new column should be
-
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.
- This migration would iterate over root namespaces only (
-
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