freeskillv2.0.0✓ verified
database-migrations
How to write safe, reversible, zero-downtime database schema migrations — additive-first changes, the expand/migrate/contract pattern, batched backfills, concurrent index builds, safe NOT NULL, rollbacks, and the locking pitfalls that cause outages. A deep reference with runnable checks.
$npx vanara install database-migrations
Free & open source (Apache-2.0) — view the source on GitHub.
Overview
A migration runs against live data while old code may still be serving traffic. The dangerous moment is never the steady state before or after — it's the in-between, when the schema has changed but not every app instance has. Design every change to be correct *during* that window. Heavy detail lives in references/; copy-paste material in examples/; a runnable safety check in scripts/.
What it covers
- Additive-first
- Never hold a long lock
- Expand / migrate / contract
- Reversibility & safety
- Operational discipline
- Rollback & Safety
- Zero-Downtime Change Recipes