Using Rails 4.2.0 the index: true part in the following statement is completely ignored:
add_column :my_table, :my_column, :boolean, index: true
This happens for any type of column (e.g. boolean, string).
To reproduce this issue just create a table:
class CreateExamples < ActiveRecord::Migration
def change
create_table :examples
end
end
Then add:
class AddSomethingToExamples < ActiveRecord::Migration
def change
add_column :examples, :something, :string, index: true
end
end
Run the migrations. Then check schema.rbor directly the database and you won't find any index.
The documentation says:
See ActiveRecord::ConnectionAdapters::TableDefinition#column for details of the options you can use.
:index - Create an index for the column. Can be either true or an options hash.
Using Rails 4.2.0 the
index: truepart in the following statement is completely ignored:This happens for any type of column (e.g.
boolean,string).To reproduce this issue just create a table:
Then add:
Run the migrations. Then check
schema.rbor directly the database and you won't find any index.The documentation says: