Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-04 12:09:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-04 12:09:36 +0300
commit5ba0ad3da6594180ec12d9166f925d9b1a27dce6 (patch)
tree7a2028f82f76f6031283180f608d54653296a286 /doc
parent2fa68d3a97fd31bf469050e130f0fc95e8944316 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc')
-rw-r--r--doc/development/code_review.md2
-rw-r--r--doc/development/migration_style_guide.md30
2 files changed, 29 insertions, 3 deletions
diff --git a/doc/development/code_review.md b/doc/development/code_review.md
index d544fdef3f8..8ea7e35dfb1 100644
--- a/doc/development/code_review.md
+++ b/doc/development/code_review.md
@@ -319,7 +319,7 @@ Before taking the decision to merge:
- Set the milestone.
- Consider warnings and errors from danger bot, code quality, and other reports.
Unless a strong case can be made for the violation, these should be resolved
- before merge. A comment must to be posted if the MR is merged with any failed job.
+ before merging. A comment must to be posted if the MR is merged with any failed job.
When ready to merge:
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md
index 07652707382..e8a32ad3be0 100644
--- a/doc/development/migration_style_guide.md
+++ b/doc/development/migration_style_guide.md
@@ -327,6 +327,34 @@ def down
end
```
+**Usage with `disable_ddl_transaction!`**
+
+Generally the `with_lock_retries` helper should work with `disabled_ddl_transaction!`. A custom RuboCop rule ensures that only allowed methods can be placed within the lock retries block.
+
+```ruby
+disable_ddl_transaction!
+
+def up
+ with_lock_retries do
+ add_column :users, :name, :text
+ end
+
+ add_text_limit :users, :name, 255 # Includes constraint validation (full table scan)
+end
+```
+
+The RuboCop rule generally allows standard Rails migration methods, listed below. This example will cause a rubocop offense:
+
+```ruby
+disabled_ddl_transaction!
+
+def up
+ with_lock_retries do
+ add_concurrent_index :users, :name
+ end
+end
+```
+
### When to use the helper method
The `with_lock_retries` helper method can be used when you normally use
@@ -350,8 +378,6 @@ Example changes:
- `change_column_default`
- `create_table` / `drop_table`
-**Note:** `with_lock_retries` method **cannot** be used with `disable_ddl_transaction!`.
-
**Note:** `with_lock_retries` method **cannot** be used within the `change` method, you must manually define the `up` and `down` methods to make the migration reversible.
### How the helper method works