In few applications, we have migrations to remove index where we don’t want to raise an error
if an index was already removed.
a feature, where we can now pass if_exists option to remove_index operation.
This is similar to
option when we are adding an index on table.
Let’s say we have a comments table with description, post_id and user_id as columns.
We add a data migration to remove the index on the description column.
If this index was already removed the data migration will throw an error as below.
After the changes in Rails 6.1, the above migration will not raise any error
if we pass if_exists as true.
Rails does not execute any SQL query for DROP INDEX in the above case.