Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1
    • Merge requests 1
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !29772

WIP: Migrate Namespace#root_id column

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Mayra Cabrera requested to merge 62214-namespace-database-migration into master Jun 17, 2019
  • Overview 9
  • Commits 1
  • Pipelines 5
  • Changes 6

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.
  • 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 Jun 17, 2019 by Mayra Cabrera
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: 62214-namespace-database-migration