Module: Ridgepole::SchemaStatementsExt

Included in:
ActiveRecord::ConnectionAdapters::AbstractAdapter
Defined in:
lib/ridgepole/schema_statements_ext.rb

Instance Method Summary collapse

Instance Method Details

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

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ridgepole/schema_statements_ext.rb', line 5

def index_name_exists?(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
      super
    end
  else
    super
  end
end

#rename_table_indexes(table_name, new_name) ⇒ Object



20
21
22
# File 'lib/ridgepole/schema_statements_ext.rb', line 20

def rename_table_indexes(table_name, new_name)
  # Nothing to do
end