Image I created a migration on rails development then I pushed to Heroku;
rails g migration add_smth_to_payments smth:string
rake db:migrate
git add -A
git commit -am "migration smth to payments"
git push heroku master
Then I wanted to destroy this migration again starting from development then push to Heroku;
rake db:rollback
rails d migration add_smth_to_payments
git add -A
git commit -am "destroy migration smth to payments"
git push heroku master
Now, my question is, after destroying the migration (could be model as well), does heroku remove this migration from payments table? I am asking because destroying takes place development
Thank you
Once a migration has been run, the migration file itself is irrelevant. You can delete it, edit it, rename it (as long as the timestamp prefix is left alone) and nothing will happen to the database. In fact, many people periodically delete old migrations to avoid cluttering
db/migrate
with irrelevant noise.If you need to undo a migration (i.e. "remove this migration from payments table") then you either write a new migration to undo it or rollback your migrations. Rolling back isn't always an option though: some migrations cannot be reversed and rolling back can reverse migrations you don't want reversed.
All this applies to production/Heroku, development, and anywhere else that you
db:migrate
.