Reputation: 8504
I just deployed some code and database changes to Heroku and I would like to roll it back. I do have the releases add-on and was able to roll back the code but not the database. I didn't backup the database so I can't do a restore. I tried "heroku rake db:rollback" but it didn't do anything. Anyone knows?
Upvotes: 9
Views: 10558
Reputation: 65455
You have to run heroku rake db:rollback
while the updated code that has the .down
migration is deployed to Heroku. After that, you can rollback the code.
Upvotes: 18
Reputation: 37507
db:rollback will rollback the last migration file that was executed - are you sure this hasn't been performed? If you're able to identify the number of migrations that you want to rollback for your deployment you can do
rake db:rollback STEP=3
which runs the down method in your last 3 migrations - this is of course if you've coded the down migration to revert exactly what was done in the up migration :)
Upvotes: 1