When working in a high-risk environment, or with a fragile database, there is also another approach to database schema changes that can be taken. This approach is based on applying feature toggles and the blue–green deployment pattern, and goes as follows:
- Change the application code in such a way that it writes any update to not just one, but to two databases.
- In the production environment, create a complete, full copy of the existing database and configure the application code to write all changes to both databases. These databases will be called old and new, from now on.
- Introduce the required changes to the new database schema and the application code only in the path that writes to the new database.
- Introduce ...