diff options
| author | Phil Hughes <me@iamphill.com> | 2017-05-03 17:04:47 +0100 |
|---|---|---|
| committer | Phil Hughes <me@iamphill.com> | 2017-05-03 17:04:47 +0100 |
| commit | f29e5d4d93123ea73e5f58be46020781af2ef7cb (patch) | |
| tree | d08a8f8e5a9cf30dd4f238c187673ffe30ac39b3 /doc/development | |
| parent | 4134d700623404948f163349882caf4a6d940cf3 (diff) | |
| parent | 8f29bf96b9306fd95b9b98019e80173b47b3a6b8 (diff) | |
| download | gitlab-ce-f29e5d4d93123ea73e5f58be46020781af2ef7cb.tar.gz | |
Merge branch 'master' into deploy-keys-load-async
Diffstat (limited to 'doc/development')
| -rw-r--r-- | doc/development/migration_style_guide.md | 25 | ||||
| -rw-r--r-- | doc/development/testing.md | 5 |
2 files changed, 28 insertions, 2 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` diff --git a/doc/development/testing.md b/doc/development/testing.md index 9b0b9808827..6d8b846d27f 100644 --- a/doc/development/testing.md +++ b/doc/development/testing.md @@ -188,7 +188,8 @@ Please consult the [dedicated "Frontend testing" guide](./fe_guide/testing.md). ### General Guidelines - Use a single, top-level `describe ClassName` block. -- Use `described_class` instead of repeating the class name being described. +- Use `described_class` instead of repeating the class name being described + (_this is enforced by RuboCop_). - Use `.method` to describe class methods and `#method` to describe instance methods. - Use `context` to test branching logic. @@ -197,7 +198,7 @@ Please consult the [dedicated "Frontend testing" guide](./fe_guide/testing.md). - Don't `describe` symbols (see [Gotchas](gotchas.md#dont-describe-symbols)). - Don't assert against the absolute value of a sequence-generated attribute (see [Gotchas](gotchas.md#dont-assert-against-the-absolute-value-of-a-sequence-generated-attribute)). - Don't supply the `:each` argument to hooks since it's the default. -- Prefer `not_to` to `to_not` (_this is enforced by Rubocop_). +- Prefer `not_to` to `to_not` (_this is enforced by RuboCop_). - Try to match the ordering of tests to the ordering within the class. - Try to follow the [Four-Phase Test][four-phase-test] pattern, using newlines to separate phases. |
