Module: ActiveRecord::ConnectionAdapters::SchemaStatements

Defined in:
lib/ridgepole/execute_expander.rb

Instance Method Summary collapse

Instance Method Details

#index_name_exists_with_noop?(table_name, column_name, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ridgepole/execute_expander.rb', line 55

def index_name_exists_with_noop?(table_name, column_name, options = {})
  if Ridgepole::ExecuteExpander.noop
    caller_methods = caller.map {|i| i =~ /:\d+:in `(.+)'/ ? $1 : '' }

    if caller_methods.any? {|i| i =~ /\Aremove_index/ }
      true
    elsif caller_methods.any? {|i| i =~ /\Aadd_index/ }
      false
    else
      index_name_exists_without_noop?(table_name, column_name, options)
    end
  else
    index_name_exists_without_noop?(table_name, column_name, options)
  end
end