* We have migrations written in SQL files named like 45_add_column_x_to_view_y.sql
* We track the migrations in git and we do merge requests and reviews
* We include a comment in each migration containing the original DDL of the object (1. it makes it easier for the reviewer to see what's changing, 2. it gives us a way to rollback, though it never happened so far)
* We track the applied migrations in a table migrations looking like "2019-10-30T10:49:00" ! "45_add_column_x_to_view_y.sql"
* We have a CLI in the same repo that allow us to apply the migrations. It's 50 LOC of python that basically 1. gets the DB host/user/pwd from an .env, 2. checks the last applied migration in the table migrations, 3. finds the new migrations to apply, 4. applies them following the order of the ids e.g. 45 before 46, 5. updates the table migrations
* We have 3 DBs (dev / staging / prod) in AWS RDS and I have an .env for each one of them
* We have a CI pipeline on the repo to automatically apply the merged migrations in staging and check if nothing goes wrong
* When the staging or dev is trashed, I delete it and recreate it from a snapshot of the prod (it takes 5 min) https://stackoverflow.com/a/49878477/652669