Back to Blog
Database / BackendFebruary 2, 2026
Zero-Downtime SQL Migrations
A battle-tested strategy for evolving your database schema without ever taking the service offline.
Expand, Migrate, Contract
The safest pattern we use in production follows three phases: add the new column, backfill it gradually, then drop the old one.
Phase One: Expand
Introduce nullable additions first so reads and writes keep working against the existing shape.
expand.sql
ALTER TABLE assets
ADD COLUMN thumb_path TEXT NULL,
ADD COLUMN mime_type TEXT NULL;Phase Three: Contract
Once the backfill reaches one hundred percent and old readers are gone, the legacy columns can be removed with confidence.