Sha256: 9aed029852eae08a24b3a278b11a28204f00d11db86cb181d42e166f0d6a6bf5

Contents?: true

Size: 747 Bytes

Versions: 11

Compression:

Stored size: 747 Bytes

Contents

require 'active_record/connection_adapters/abstract/schema_statements'

module Ridgepole
  module SchemaStatementsExt
    def index_name_exists?(*)
      if Ridgepole::ExecuteExpander.noop
        caller_methods = caller.map { |i| i =~ /:\d+:in `(.+)'/ ? Regexp.last_match(1) : '' }
        if caller_methods.any? { |i| i.start_with?('remove_index') }
          true
        elsif caller_methods.any? { |i| i.start_with?('add_index') }
          false
        else
          super
        end
      else
        super
      end
    end

    def rename_table_indexes(*)
      # Nothing to do
    end
  end
end

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ridgepole-0.8.0.rc1 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.7 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.6 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.5 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.5.beta3 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.5.beta2 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.5.beta lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.4 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.3 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.3.beta3 lib/ridgepole/schema_statements_ext.rb
ridgepole-0.7.3.beta2 lib/ridgepole/schema_statements_ext.rb