add_index :tests, [:title, :level], unique: true
how can i change title
to body
and save in schema.rb
I tired to manually change it but it doesn't save in schema.rb
Asked
Active
Viewed 448 times
-1

Eyeslandic
- 14,553
- 13
- 41
- 54

Southpaw
- 1
- 1
1 Answers
0
You need to run again the migration.
Your schema version was already set to the id of your migration.
ActiveRecord::Schema.define(:version => MIGRATION_ID) do
# schema definition ...
end
That's why even if you run all the migrations again nothing changes, because the version tells Active Record that it shouldn't run previous migrations than its version number.
You need to rollback your previous migration and then run migrations again.
rake db:rollback # it will rollback the last migration applied.
rake db:migrate
BTW this solution should be used only for development environment. If you want to change the production DB you should create another migration to change the column.

Geovany Gameros
- 38
- 1
- 5