GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
all gems handled through bundler
I have written a migration that simply adds an index to a table:
class AddIndexBA < ActiveRecord::Migration
add_index :b, :a_id, :name => :b_a
remove_index :b, :b_a
$ rake db:migrate
$ rake db:rollback
db/schema.rb (and the database) unchanged
db/schema.rb claims the index is there, and indeed it is there in the database
Migration and rollback are considered successful, the migration is listed as down by db:migrate:status after the rollback.
The issue does not occur when not providing an explicit name for the index.
The problem is that remove_index :table_name, :b_a will try to find the index named index_b_on_b_a, instead of b_a as you expect.
remove_index :table_name, :b_a
I requested to update the remove_index related documentation in docrails to reflect the current code behavior.
As a side note, removing the index will just log a warning on 3.0.1, though on master the rollback migration fails as expected.