Normally when I do
$ rake db:rollback
it rolls back one migration. But now, repeatedly times, it has rollbacked 3 steps.
How come this behaviour?
I'm on Rails 3.2.13.
To check for status, run rails db:migrate:status . Then you'll have a good view of the migrations you want to remove. Then, run rails db:rollback to revert the changes one by one. After doing so, you can check the status again to be fully confident.
You must rollback the migration (for example with bin/rails db:rollback ), edit your migration, and then run bin/rails db:migrate to run the corrected version.
rollback all means it will reset all migration. so if you change anything on migration file then it will recreate and affect it.
You can specify the number of steps like this:
rake db:rollback STEP=3
The STEP
parameter is actually an environment variable here. If, in your terminal, you run the command echo $STEP
, does it return 3? If it does, you can execute export STEP=1
to get back to expected behaviour. If it happens again, try to find out where this environment variable is being set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With