Skip to content

Commit

Permalink
Accept columns passed with options in remove_index
Browse files Browse the repository at this point in the history
Resolves rsim#1929.
Follow rails/rails#37168.
  • Loading branch information
koic committed Sep 11, 2019
1 parent 772cbe8 commit d28e5b6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,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, options = {}) #:nodoc:
index_name = index_name_for_remove(table_name, options)
def remove_index(table_name, column_name = nil, options = {}) #:nodoc:
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
execute "DROP INDEX #{quote_column_name(index_name)}"
Expand Down

0 comments on commit d28e5b6

Please sign in to comment.