method

index_name_for_remove

rails latest stable - Class: ActiveRecord::Migration::Compatibility::V4_2
index_name_for_remove(table_name, column_name, options)
private

No documentation available.

# File activerecord/lib/active_record/migration/compatibility.rb, line 458
          def index_name_for_remove(table_name, column_name, options)
            index_name = connection.index_name(table_name, column_name || options)

            unless connection.index_name_exists?(table_name, index_name)
              if options.key?(:name)
                options_without_column = options.except(:column)
                index_name_without_column = connection.index_name(table_name, options_without_column)

                if connection.index_name_exists?(table_name, index_name_without_column)
                  return index_name_without_column
                end
              end

              raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' does not exist"
            end

            index_name
          end