Module: SchemaPlus::Indexes::RemoveIfExists
- Included in:
- ActiveRecord::ConnectionAdapters::AbstractAdapter, ActiveRecord::ConnectionAdapters::PostgresqlAdapter, ActiveRecord::ConnectionAdapters::Sqlite3Adapter
- Defined in:
- lib/schema_plus/indexes/remove_if_exists.rb
Instance Method Summary collapse
-
#remove_index(table_name, *args) ⇒ Object
Extends rails’ remove_index to include this options: :if_exists.
Instance Method Details
#remove_index(table_name, *args) ⇒ Object
Extends rails’ remove_index to include this options:
:if_exists
5 6 7 8 9 10 11 |
# File 'lib/schema_plus/indexes/remove_if_exists.rb', line 5 def remove_index(table_name, *args) = args. if_exists = .delete(:if_exists) args << if .any? return if if_exists && !index_name_exists?(table_name, [:name] || index_name(table_name, *args), false) super table_name, *args end |