I am trying to make it so certain columns cannot be null. I use change_column
no problem but some of these columns have an index attached to them signifying that it is unique.
However when I run this migration:
change_column :users, :username, :string, null: false
change_column :users, :email, :string, null: false
change_column :users, :password, :string, null: false
change_column :users, :terms_agreed, :boolean, null: false
It removes the add_index
in the schema
schema.rb
- add_index "users", ["username"], :name => "index_users_on_username_code", :unique => true
- add_index "users", ["email"], :name => "index_users_on_email_code", :unique => true
add_index "users", ["confirmation_code"], :name => "index_users_on_confirmation_code", :unique => true
How do I do this without removing the indexes?
P.S. its not actually removing the indexes in the database. Just in the schema.rb
file.