class Gitlab::Styles::Rubocop::Cop::Migration::UpdateLargeTable
This cop checks for methods that may lead to batch type issues on a table that's been explicitly denied because of its size.
Even though though these methods perform functions to avoid downtime, using it with tables with millions of rows still causes a significant delay in the deploy process and is best avoided.
See gitlab.com/gitlab-com/infrastructure/issues/1602 for more information.
Constants
- MSG
Public Instance Methods
on_send(node)
click to toggle source
# File lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb, line 31 def on_send(node) return if denied_tables.empty? || denied_methods.empty? return unless in_migration?(node) matches = batch_update?(node) return unless matches update_method = matches.first table = matches.last.to_a.first return unless denied_tables.include?(table) add_offense(node, message: format(MSG, update_method, table)) end
Private Instance Methods
denied_method?(method_name)
click to toggle source
# File lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb, line 52 def denied_method?(method_name) denied_methods.include?(method_name) end
denied_methods()
click to toggle source
# File lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb, line 56 def denied_methods cop_config['DeniedMethods'] || [] end
denied_tables()
click to toggle source
# File lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb, line 48 def denied_tables cop_config['DeniedTables'] || [] end