diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-24 18:29:23 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-07-20 12:41:56 +0200 |
commit | a8bfe20d0dbc79616ad69b0e9c1c985ba1887407 (patch) | |
tree | 289641ee727f146a13393aa77043c1d3bc01e47b /generator_templates | |
parent | d6bd412be4e3063c5f8844ef2c15f736f173b2f1 (diff) | |
download | gitlab-ce-a8bfe20d0dbc79616ad69b0e9c1c985ba1887407.tar.gz |
Added checks for migration downtimemigration-downtime-tags
These new checks can be used to check if migrations require downtime or
not (as tagged by their authors). In CI this compares the current branch
with master so migrations added by merge requests are automatically
verified.
To check the migrations added since a Git reference simply run:
bundle exec rake gitlab:db:downtime_check[GIT_REF]
Diffstat (limited to 'generator_templates')
-rw-r--r-- | generator_templates/active_record/migration/create_table_migration.rb | 8 | ||||
-rw-r--r-- | generator_templates/active_record/migration/migration.rb | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/generator_templates/active_record/migration/create_table_migration.rb b/generator_templates/active_record/migration/create_table_migration.rb index 27acc75dcc4..aad8626a720 100644 --- a/generator_templates/active_record/migration/create_table_migration.rb +++ b/generator_templates/active_record/migration/create_table_migration.rb @@ -4,6 +4,14 @@ class <%= migration_class_name %> < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + # When a migration requires downtime you **must** uncomment the following + # constant and define a short and easy to understand explanation as to why the + # migration requires downtime. + # DOWNTIME_REASON = '' + # When using the methods "add_concurrent_index" or "add_column_with_default" # you must disable the use of transactions as these methods can not run in an # existing transaction. When using "add_concurrent_index" make sure that this diff --git a/generator_templates/active_record/migration/migration.rb b/generator_templates/active_record/migration/migration.rb index 06bdea11367..825bc8bdf61 100644 --- a/generator_templates/active_record/migration/migration.rb +++ b/generator_templates/active_record/migration/migration.rb @@ -4,6 +4,14 @@ class <%= migration_class_name %> < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + # When a migration requires downtime you **must** uncomment the following + # constant and define a short and easy to understand explanation as to why the + # migration requires downtime. + # DOWNTIME_REASON = '' + # When using the methods "add_concurrent_index" or "add_column_with_default" # you must disable the use of transactions as these methods can not run in an # existing transaction. When using "add_concurrent_index" make sure that this |