summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-05-02 17:42:23 +0000
committerDouwe Maan <douwe@gitlab.com>2017-05-02 17:42:23 +0000
commitfa0c944ede0427ccf39a30b378dc15cc6a8da885 (patch)
tree0468fcfcb12d895ce8cb5ea7e4adec337d7028a9 /doc
parent9fd1a35fa944cc27a88bc504fed3a8b65eb193dd (diff)
parent49a8e5f510723eb39a948efe87e1af3b0abb49f6 (diff)
downloadgitlab-ce-fa0c944ede0427ccf39a30b378dc15cc6a8da885.tar.gz
Merge branch '30272-bvl-reject-more-namespaces' into 'master'
Reject more reserved paths Closes #30272 See merge request !10413
Diffstat (limited to 'doc')
-rw-r--r--doc/development/migration_style_guide.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md
index 3e8b709c18f..77ba2a5fd87 100644
--- a/doc/development/migration_style_guide.md
+++ b/doc/development/migration_style_guide.md
@@ -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`