{
  "id": 10904008,
  "title": "Zero-Downtime Database Migrations: A Practical Guide",
  "url": "https://urgent.news/2026/09/30/zero-downtime-database-migrations-a-practical-guide",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-30T09:03:30.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/robert_kawoski_20bd638fd2/zero-downtime-database-migrations-a-practical-guide-6ob"
  },
  "original_language": "en",
  "account": "This guide outlines a practical approach to performing zero-downtime database migrations, crucial for growing products with ever-expanding schemas. The key principle is never to introduce changes that both old and new application versions cannot handle simultaneously. By breaking the migration into three phases - expand, backfill, and cutover - each step can be safely deployed and rolled back independently.\n\nIn the first phase, the schema is expanded without altering existing structures. New columns are added as nullable first, followed by backfilling data into them. Indexes should also be added concurrently to avoid blocking hot tables. Renaming structures should be postponed until the final contract phase.\n\nThe backfill phase involves incrementally updating large tables, row by row, to incorporate new columns or tables. This process generates minimal locks and replication lag, ensuring uninterrupted production traffic. It's essential to validate the backfill results before proceeding to avoid data integrity issues.\n\nThe cutover phase is where the application starts using the newly expanded schema. This is done through dual writes behind a feature flag, allowing simultaneous writes to both old and new structures while reads continue from the old one. Once the dual-write path is stable, reads are gradually switched to the new structure in a controlled manner, similar to canary deployments. The old structures are then removed after a full deprecation window, providing a safety net in case any issues arise during the transition.",
  "summary": "Every growing product eventually hits the same wall: the schema that got you to your first thousand customers can’t support the next hundred thousand. A column needs to change type, a table needs to split, an index needs to be added to a table that’s grown too large to lock. And the business keeps running while you do it — for teams handling millions of daily users, taking the application offline…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}