rails/activerecord/test/cases/migration
eileencodes 5b5da30bc0
Fix index options for if_not_exists/if_exists
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>
2020-05-19 16:19:22 -04:00
..
change_schema_test.rb Fix CI failures due to MySQL 8.0.19 no longer output integer display width unless ZEROFILL is also used 2020-01-15 21:40:10 +09:00
change_table_test.rb Add change_null for change_table 2020-05-05 11:32:38 +09:00
column_attributes_test.rb Raise ArgumentError for invalid :limit and :precision like as other options 2019-04-07 16:14:42 +09:00
column_positioning_test.rb add_reference should respect column position for both reference id and type columns 2017-09-01 21:49:28 +09:00
columns_test.rb Deprecate allowed_index_name_length in DatabaseLimits 2020-04-30 01:21:54 +09:00
command_recorder_test.rb Fix CI failure on Ruby master 2020-01-29 09:22:25 +09:00
compatibility_test.rb Move SchemaMigration to migration_context 2019-06-14 11:15:08 -04:00
create_join_table_test.rb Enable Layout/EmptyLinesAroundAccessModifier cop 2019-06-13 12:00:45 +09:00
foreign_key_test.rb Update supports_rename_index? version for MariaDB 2020-05-14 20:28:19 +09:00
helper.rb Enable Layout/EmptyLinesAroundAccessModifier cop 2019-06-13 12:00:45 +09:00
index_test.rb Fix index options for if_not_exists/if_exists 2020-05-19 16:19:22 -04:00
logger_test.rb Move SchemaMigration to migration_context 2019-06-14 11:15:08 -04:00
pending_migrations_test.rb Use FileUpdateChecker for Migration::CheckPending 2019-10-08 16:29:12 -07:00
references_foreign_key_test.rb remove_foreign_key doesn't care :validate option if database has no feature 2020-05-08 20:55:04 +09:00
references_index_test.rb Use frozen-string-literal in ActiveRecord 2017-07-19 22:27:07 +03:00
references_statements_test.rb Enable Layout/EmptyLinesAroundAccessModifier cop 2019-06-13 12:00:45 +09:00
rename_table_test.rb Remove dead test code for unsupported adapters 2020-04-12 03:30:25 +09:00