We have a production setup of our solution with 2 webservers, these two webservers are loadbalanced, and connects to the same database.
We utilize Octopus deploy, and perform a rolling deploy where we disable the webserver under update in the loadbalancer.
We use entity framework code first migrations, and upon deploy we run
dotnet ef migrations script
, to generate a SQL script that we can execute against the database. This is where our struggles begin.
It happens that the migrations that have been made has breaking changes, that causes the webserver that is still online, to fail due to database mismatch.
So we somehow need to have a pre and post migration
- pre migration run before deployment, that puts the database in to a state where the old version of the application works, together with the new version.
- post migration run after deployment, that cleans up the database.
I have been unable to find a tool that can create these pre-migrations for me, based on the sql script that i have, and i am starting to think that this is a dream, is it possible? and if not, what do people do in their deployment pipeline?
I have looked at Liquibase, DbUp, Roundhouse, but none of them supply the functionality that i wish for.