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
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-12-11 19:34:51 +0300
committerSean McGivern <sean@gitlab.com>2017-12-11 19:34:51 +0300
commit1ab33b15d1f1cc6ce69514e545da1348fd750771 (patch)
treeaf4dab71355a5199facc7937aeb03f964e2f6d0c /rubocop/migration_helpers.rb
parent8ff63039f1ee5f6e31a8b910e323977e7de3c634 (diff)
Add cop for use of remove_column
remove_column should only be used in the up (or change) step of a migration if it's a post-deployment migration. Otherwise there will be downtime due to the ActiveRecord column cache, which we can avoid by using the IgnorableColumn concern in combination with a post-deployment migration.
Diffstat (limited to 'rubocop/migration_helpers.rb')
-rw-r--r--rubocop/migration_helpers.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/rubocop/migration_helpers.rb b/rubocop/migration_helpers.rb
index c3473771178..c066d424437 100644
--- a/rubocop/migration_helpers.rb
+++ b/rubocop/migration_helpers.rb
@@ -7,5 +7,11 @@ module RuboCop
dirname.end_with?('db/migrate', 'db/post_migrate')
end
+
+ def in_post_deployment_migration?(node)
+ dirname = File.dirname(node.location.expression.source_buffer.name)
+
+ dirname.end_with?('db/post_migrate')
+ end
end
end