Open levibostian opened 3 years ago
Here is an idea on how to check if 2 tables are identical. You should be able to write a script that does this check.
I have done more thinking and reading. (1) some database operations do not require a complex migration. However, some operations (like adding an index with CONCURRENCY
enabled) are safe but still require I/O and CPU load on the postgres server which might result in downtime anyways. I consider the more complex database migration better in the long run then an operation like that.
Also, I learned some big tips when it comes to performing shadow tables and backfilling:
Overall, I like this multi-step shadow and backfill approach. The big advantages that it offers to me is: it's safe, I can clock out at any step and come back to it tomorrow, rollback on errors, I am in full control and can stop at anytime.
Great resource for strategies for each type of migration.
My applications currently do not have downtime but that's because I am lucky. I have a small userbase. If database tables are large, these migrations are difficult to do.
I am also working to perform automated deployments as much as possible. Deploy as soon as you deploy to master branch.
Requirements:
master
should be able to always be performed. The application deployment process should not be dependent on a database migration. A database migration should be dependent on the application. The application should simply expect the database to always be in the correct form.ideas
To do the above, I have considered a few ideas.