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>2018-06-19 19:18:15 +0300
committerSean McGivern <sean@gitlab.com>2018-06-19 19:18:15 +0300
commiteb086a4bfd2495168483a2652571f247e6b768a5 (patch)
tree43a6153480a44adbc732ae8d3c3ebff7fd8c123f /rubocop/cop/migration
parentc0f0ccf222a2b8896aeb94b7a50b3923c7684125 (diff)
Disallow methods that copy data on large tables
{change_column_type,rename_column}_concurrently both copy data from one column to another during a migration, which should not be done on GitLab.com. Instead, we should use background migrations.
Diffstat (limited to 'rubocop/cop/migration')
-rw-r--r--rubocop/cop/migration/update_large_table.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/rubocop/cop/migration/update_large_table.rb b/rubocop/cop/migration/update_large_table.rb
index bb14d0f4f56..e3e3de0a4d7 100644
--- a/rubocop/cop/migration/update_large_table.rb
+++ b/rubocop/cop/migration/update_large_table.rb
@@ -34,8 +34,15 @@ module RuboCop
users
].freeze
+ BATCH_UPDATE_METHODS = %w[
+ :add_column_with_default
+ :change_column_type_concurrently
+ :rename_column_concurrently
+ :update_column_in_batches
+ ].join(' ').freeze
+
def_node_matcher :batch_update?, <<~PATTERN
- (send nil? ${:add_column_with_default :update_column_in_batches} $(sym ...) ...)
+ (send nil? ${#{BATCH_UPDATE_METHODS}} $(sym ...) ...)
PATTERN
def on_send(node)