Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
ffc486a5
Commit
ffc486a5
authored
May 02, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some documentation for the new migration helpers
parent
29f20011
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
doc/development/migration_style_guide.md
doc/development/migration_style_guide.md
+25
-0
No files found.
doc/development/migration_style_guide.md
View file @
ffc486a5
...
...
@@ -270,3 +270,28 @@ end
When doing so be sure to explicitly set the model's table name so it's not
derived from the class name or namespace.
### Renaming reserved paths
When a new route for projects is introduced that could conflict with any
existing records. The path for this records should be renamed, and the
related data should be moved on disk.
Since we had to do this a few times already, there are now some helpers to help
with this.
To use this you can include
`Gitlab::Database::RenameReservedPathsMigration::V1`
in your migration. This will provide 3 methods which you can pass one or more
paths that need to be rejected.
**`rename_root_paths`**
: This will rename the path of all _namespaces_ with the
given name that don't have a
`parent_id`
.
**`rename_child_paths`**
: This will rename the path of all _namespaces_ with the
given name that have a
`parent_id`
.
**`rename_wildcard_paths`**
: This will rename the path of all _projects_, and all
_namespaces_
that have a
`project_id`
.
The
`path`
column for these rows will be renamed to their previous value followed
by an integer. For example:
`users`
would turn into
`users0`
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment