Skip to content
Veltoryx Technologies
ProLesson 9.3Intermediate4 min readUpdated 31 October 2026

Schema Evolution & Zero-Downtime Migrations

Execute zero-downtime database migrations in continuous delivery environments using Flyway and the 3-phase Expand and Contract pattern.

In modern cloud environments, microservices practice Continuous Delivery: releasing new code to production multiple times a day using rolling deployments or blue-green updates.

During a rolling deployment of an updated service:

  • 50% of your pods are running Old Version (v1.0).
  • 50% of your pods are running New Version (v2.0).

Both versions are actively processing user traffic against the exact same database schema simultaneously.

If an engineer renames a database column (ALTER TABLE users RENAME COLUMN name TO full_name;), the new v2.0 pods will work, but all existing v1.0 pods will instantly throw SQLException: column "name" does not exist and crash user requests.

01The Solution: The Expand and Contract Pattern

The Expand and Contract Pattern (also called the Parallel Run or Transition Phase pattern) breaks breaking database schema changes into three separate, non-breaking phases.

Zero-Downtime Schema Evolution: Expand and Contract
Fig. 1 · Zero-Downtime Schema Evolution: Expand and Contract

Loading the rest of the lesson…