Sequence Diagram template

Database Migration,
as a sequence diagram.

A sequence diagram template showing zero-downtime database schema migration steps, ideal for backend engineers, DBAs, and DevOps teams planning live system upgrades.

Title Block
Type
Sequence Diagram
Topic
Database Migration
Status
Ready
Fig. 01Reference draft
Overview

About this
specimen.

A database migration sequence diagram maps out the precise order of interactions between your application, migration tooling, and database engine during a schema change—without taking the system offline. It visualizes each step: deploying backward-compatible schema changes, running dual-write phases, backfilling data, switching read paths, and finally cleaning up legacy columns or tables. By laying out these interactions in a time-ordered flow, the diagram makes implicit coordination explicit, helping every stakeholder understand what happens, in what order, and which component is responsible at each stage.

## When to Use This Template

This template is most valuable when your team is planning a non-trivial schema change on a production database that must remain available—such as adding a non-nullable column, renaming a table, splitting a column, or changing a data type. It is equally useful during incident post-mortems to reconstruct what went wrong during a previous migration, or as onboarding material to teach junior engineers the expand-contract (parallel-change) pattern. DevOps engineers can use it to align deployment pipelines with database change windows, while DBAs can annotate it with locking behavior and transaction boundaries to surface hidden risks before a single line of SQL is executed.

## Common Mistakes to Avoid

One of the most frequent errors teams make is skipping the backward-compatibility validation step—deploying a new schema before the old application version can still read from it. In a sequence diagram this gap is immediately visible as a missing interaction arrow. Another pitfall is collapsing the backfill and cutover phases into a single step, which hides the risk of long-running transactions causing table locks. Teams also often omit the rollback path entirely; a well-drawn sequence diagram should show the failure branch alongside the happy path so on-call engineers know exactly which compensating actions to take. Finally, avoid treating the migration as a purely database-side concern—your sequence diagram should always include the application deployment actor, because zero-downtime migrations are a choreography between code releases and schema changes, not a solo database operation.

Cross-reference

Database Migration, as another form.

Related specimens

More sequence diagram
templates.

FAQ

Common
questions.

01What is a zero-downtime database migration sequence diagram?
It is a sequence diagram that illustrates the step-by-step interactions between application servers, migration scripts, and the database during a schema change designed to keep the system fully available throughout the process.
02Which actors should I include in this sequence diagram?
Typical actors include the application (old and new versions), the migration runner or CI/CD pipeline, the primary database, any read replicas, and optionally a feature-flag service that controls the cutover between old and new code paths.
03How does the expand-contract pattern appear in a sequence diagram?
The expand phase shows the migration runner adding new columns or tables while the old app continues writing to legacy fields. The contract phase shows a later deployment removing legacy fields after all reads and writes have switched to the new schema.
04Can I use this template for NoSQL or cloud database migrations?
Yes. While the specific steps differ, the sequence diagram structure applies equally to NoSQL schema evolution, cloud-managed databases like Aurora or Cloud Spanner, and even data warehouse migrations where backward compatibility and phased rollouts are required.