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:
authorYorick Peterse <yorickpeterse@gmail.com>2016-06-16 11:02:36 +0300
committerRobert Speicher <rspeicher@gmail.com>2016-06-16 20:28:06 +0300
commitf4599c6f7a09c96d63adfec6fba173d41da8a4c4 (patch)
tree026b0bce353901facf658f3ad92255181f045bed /doc
parenta143076f0219a92716cff1d191207f9b74525fd2 (diff)
Merge branch 'fix_migration_style_guide' into 'master'
Update migration_style_guide.md with new details See merge request !4693
Diffstat (limited to 'doc')
-rw-r--r--doc/development/migration_style_guide.md16
1 files changed, 14 insertions, 2 deletions
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md
index 02e024ca15a..8a7547e5322 100644
--- a/doc/development/migration_style_guide.md
+++ b/doc/development/migration_style_guide.md
@@ -34,6 +34,15 @@ First, you need to provide information on whether the migration can be applied:
3. online with errors on new instances while migrating
4. offline (needs to happen without app servers to prevent db corruption)
+For example:
+
+```
+# rubocop:disable all
+# Migration type: online without errors (works on previous version and new one)
+class MyMigration < ActiveRecord::Migration
+...
+```
+
It is always preferable to have a migration run online. If you expect the migration
to take particularly long (for instance, if it loops through all notes),
this is valuable information to add.
@@ -48,7 +57,6 @@ be possible to downgrade in case of a vulnerability or bugs.
In your migration, add a comment describing how the reversibility of the
migration was tested.
-
## Removing indices
If you need to remove index, please add a condition like in following example:
@@ -70,6 +78,7 @@ so:
```
class MyMigration < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
def change
@@ -90,8 +99,11 @@ value of `10` you'd write the following:
```
class MyMigration < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
def up
- add_column_with_default(:projects, :foo, :integer, 10)
+ add_column_with_default(:projects, :foo, :integer, default: 10)
end
def down