Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ def add_index_options(table_name, column_name, comment: nil, **options) # :nodoc
# Remove the given index from the table.
# Gives warning if index does not exist
def remove_index(table_name, column_name = nil, **options) # :nodoc:
return if options[:if_exists] && !index_exists?(table_name, column_name, **options)

index_name = index_name_for_remove(table_name, column_name, options)
# TODO: It should execute only when index_type == "UNIQUE"
execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{quote_column_name(index_name)}" rescue nil
Expand Down