Sha256: 6a36726a3290126594e9c4e37762f4c58249deda253d1bdae90e1cf0a8777fec

Contents?: true

Size: 766 Bytes

Versions: 33

Compression:

Stored size: 766 Bytes

Contents

require 'active_record/connection_adapters/abstract/schema_statements'

module Ridgepole
  module SchemaStatementsExt
    def index_name_exists?(table_name, column_name, default = nil)
      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

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

module ActiveRecord
  module ConnectionAdapters
    class AbstractAdapter
      prepend Ridgepole::SchemaStatementsExt
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
ridgepole-0.7.1 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.1.beta5 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.1.beta4 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.1.beta3 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.1.beta2 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.1.beta lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.rc1 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta22 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta21 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta20 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta19 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta18 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta17 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta16 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta15 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta14 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta13 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta12 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.0.beta11 lib/ridgepole/schema_statements_ext.rb