mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
5b5da30bc0
The `index_exists?` method wasn't very specific so when we added the `if_not_exists` to `add_index` and `if_exists` to `remove_index` there were a few cases where behavior was unexpected. For `add_index` if you added a named index and then added a second index with the same columns, but a different name, that index would not get added because `index_exists` was looking only at column named and not at the exact index name. We fixed `add_index` by moving the `index_exists` check below `add_index_options` and pass `name` directly to `index_exists` if there is a `if_not_exists` option. For `remove_index` if you added a named index and then tried to remove it with a nil column and a explicit name the index would not get removed because `index_exists` saw a nil column. We fixed this by only doing the column check in `index_exists` if `column` is present. Co-authored-by: John Crepezzi <john.crepezzi@gmail.com> |
||
---|---|---|
.. | ||
change_schema_test.rb | ||
change_table_test.rb | ||
column_attributes_test.rb | ||
column_positioning_test.rb | ||
columns_test.rb | ||
command_recorder_test.rb | ||
compatibility_test.rb | ||
create_join_table_test.rb | ||
foreign_key_test.rb | ||
helper.rb | ||
index_test.rb | ||
logger_test.rb | ||
pending_migrations_test.rb | ||
references_foreign_key_test.rb | ||
references_index_test.rb | ||
references_statements_test.rb | ||
rename_table_test.rb |