summaryrefslogtreecommitdiff
path: root/rubocop
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-06-22 13:22:15 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-06-22 13:22:15 +0000
commitd30596226d11fdb1d306f1563417a52425f95951 (patch)
tree1f2093ae1bd0e4128d1bb7778008faae0ec93f25 /rubocop
parentf855cbf6477f4e6febf57472d20206db92fe86d8 (diff)
parent03ccd39a0ccafe79df50702464ff02d3ca0312c4 (diff)
downloadgitlab-ce-d30596226d11fdb1d306f1563417a52425f95951.tar.gz
Merge branch 'update-large-tables-cop' into 'master'
Disallow methods that copy data on large tables See merge request gitlab-org/gitlab-ce!20021
Diffstat (limited to 'rubocop')
-rw-r--r--rubocop/cop/migration/update_large_table.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/rubocop/cop/migration/update_large_table.rb b/rubocop/cop/migration/update_large_table.rb
index bb14d0f4f56..c15eec22d04 100644
--- a/rubocop/cop/migration/update_large_table.rb
+++ b/rubocop/cop/migration/update_large_table.rb
@@ -20,10 +20,14 @@ module RuboCop
'necessary'.freeze
LARGE_TABLES = %i[
- ci_pipelines
+ ci_build_trace_sections
ci_builds
+ ci_job_artifacts
+ ci_pipelines
+ ci_stages
events
issues
+ merge_request_diff_commits
merge_request_diff_files
merge_request_diffs
merge_requests
@@ -34,8 +38,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)