-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Closed
Labels
Description
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.rb
or 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.