Sha256: 84990f350590d8edd3cbccdf940fb9fe35fea27a9b72e64a0c96363f39834dec

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

require 'active_record/connection_adapters/abstract/schema_statements'

module Ridgepole
  module SchemaStatementsExt
    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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ridgepole-0.6.4.beta6 lib/ridgepole/schema_statements_ext.rb