Database migration testing
Description
In case of any complex database migrations, we don't have ways to test if it works on the production database. The only way to test if the migration works is trying it out locally, but this leaves a lot of room for error.
Ideally, when the production migration happens we want this to go without any problems but this can be difficult to test properly in a local environment. We need some way to ensure the database migration goes well, or at least ways to minimize any problems that could happen.
Ideas:
- A (optional?) seperate CI job that copies the production database and runs the migration against it.
- Well documented best practices to minimize any problems during migration (Don't delete old data if there are any errors for example)
- Roll-back the database to the pre-migration state if any errors appear
Edited by Koen Schellingerhout