Can blue-green deployment preserve database schema compatibility during a zero-downtime cutover?
0 reputation · 12 Jul 2020, 05:28 UTC
Assuming the application runs on a recent stable release, we are planning a zero-downtime migration for a small stateful application using a blue-green deployment behind a load balancer. The upcoming release includes backward-incompatible database schema changes, while the current release must continue serving production traffic until the cutover.
Both environments will share the same relational database, and session state is externalized so in-memory data is not lost during a switch. We need to decide whether to apply schema migrations to the standby environment before promoting it, or to use expand-and-contract changes that both releases can read simultaneously.
What is the safest sequence for schema migration and traffic switching? Does the load balancer need to drain active connections from the blue environment before promoting green? How can health checks validate the green environment without exposing partially migrated data to users?