Updating your database development
That means that you can execute them during a migration step and don’t need to split them into multiple operations.
Adding new tables or views doesn’t affect the old instances of your application. Just keep in mind that while you’re performing the rolling update, some users might trigger write operations on old application instances.
But you need to check if there are any old use case implementations that would break if any database record doesn’t fulfill the constraint.
During the rolling update, instances of the new version of the application might write some records that do not comply with the no-longer-existing constraint.
You can easily fix that by providing a default value; please check your database documentation on how to do that.
If you don’t want to define a default value, you need to execute 3 statements to add the column with the constraint: The good news is that you can execute all 3 statements within the same migration step.
You no longer need to just adapt the database in the way it’s required by your application; you also need to do it in a way that the old and the new version of your application can work with the database.
You might need to clean up your data and add the missing records to the new table after all application instances have been migrated. You don’t need to worry if you add a database column without a not null constraint.In this article, I want to focus on database schema migration for high-available systems.The redundancy of the application plays a critical role during the migration. The implementation of a rolling update depends on your technology stack.If that breaks any old code, you’re in trouble, and I don’t know any good way to solve it.You can’t remove the constraint because some reading use cases of the old version will break.