I'm new to this. I have a production server and need to deploy the latest version of the application from github, so I'm using Capistrano.
The newest release makes some changes to the database and hence has a bunch of migrations, so I'll be deploying it with deploy:migrate.
So my question was, if I add some data to the new columns created (it doesn't change any of the existing columns in the tables, just creates new tables and columns) and then want to rollback, then will cap deploy:rollback reverse all the migrations as well? Is the data in those new columns erased and the database back to the previous state (assuming I didn't make any data change except to the new additions in the db)?
Thanks!
Rollback All Migrations: rollback all means it will reset all migration. so if you change anything on migration file then it will recreate and affect it.
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.
No, it will not. You would need to manually run the down part of those migrations via rake and then roll back.
However, if your current app won't be affected by the new rows it won't hurt anything.
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