Post

Always backup the database when there is a change in the schema

Adding a column, changing a data type, or dropping a table can irreversibly affect your data. A wrong migration can destroy production data and make a rollback impossible without losing integrity.

Run a database backup before any migration. Always. This ensures you can restore your data if something breaks or behaves unexpectedly.

The command we use for our Ruby on Rails heroku project is:

1
heroku pg:backups:capture --app appname
This post is licensed under CC BY-NC 4.0 by the author.