Class: RuboCop::Cop::Migration::AddIndexNonConcurrently

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/migration/add_index_non_concurrently.rb

Constant Summary collapse

MSG =
'Use `algorithm: :concurrently` to avoid locking table.'.freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/rubocop/cop/migration/add_index_non_concurrently.rb', line 19

def on_send(node)
  if node.method_name == :add_index
    check_add_index(node)
  elsif [:add_reference, :add_belongs_to].include?(node.method_name)
    check_add_reference(node)
  end
end