Method: ActiveRecord::ConnectionAdapters::SchemaStatements#index_name_exists?

Defined in:
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb

#index_name_exists?(table_name, index_name) ⇒ Boolean

Verifies the existence of an index with a given name.

Returns:

  • (Boolean)


1011
1012
1013
1014
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb', line 1011

def index_name_exists?(table_name, index_name)
  index_name = index_name.to_s
  indexes(table_name).detect { |i| i.name == index_name }
end