---
title: "Taking the fear out of migrations"
description: "Data model migrations can be made low-risk with a four-step playbook: create the new model, dual-write to old and new (backfilling dependent and existing data with rerunnable jobs), read from both and alert on mismatches before switching reads behind a feature flag, then stop writing to and drop the old model. incident.io walks through the pattern using its move from hard-coded string incident statuses to a per-organisation incident_statuses table."
url: "https://swe.quest/articles/taking-the-fear-out-of-migrations-570a94639201ef71"
canonical: "https://incident.io/blog/how-we-run-migrations"
source: "incident.io"
published: "2023-02-28"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["schema-migrations","databases","deployment"]
---

# Taking the fear out of migrations

A post on [incident.io](https://swe.quest/sources/incident-io.md), published 2023-02-28, 9 min read, How-to. Original: [https://incident.io/blog/how-we-run-migrations](https://incident.io/blog/how-we-run-migrations)

## Summary

Data model migrations can be made low-risk with a four-step playbook: create the new model, dual-write to old and new (backfilling dependent and existing data with rerunnable jobs), read from both and alert on mismatches before switching reads behind a feature flag, then stop writing to and drop the old model. incident.io walks through the pattern using its move from hard-coded string incident statuses to a per-organisation incident\_statuses table. Every step before dropping the old writes is reversible, so nothing has to be rushed and the read cutover can be undone with a feature flag. Simple migrations still finish in half a day to a day, and the work can be split across several engineers once the schema exists.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)
- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)

## Prerequisites

- relational database schemas ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- foreign keys
- feature flags ([easy posts on Deployment](https://swe.quest/tags/deployment.md?difficulty=easy))

## Keywords

incident.io, dual writes, backfill, feature flags

## Related posts

- [Migrating Data Ingestion Systems at Meta Scale](https://swe.quest/articles/migrating-data-ingestion-systems-at-meta-scale-338df596ae05796f.md): Meta Engineering · 2026-05-12 · Medium · 9 min read · Data pipelines, Event-driven architecture, MySQL, Refactoring & migrations, Deployment
  Meta migrated tens of thousands of MySQL-to-warehouse change data capture (CDC) ingestion jobs, together moving several petabytes daily, from customer-owned pipelines to a self-managed warehouse service, and fully retired the legacy system.
- [How we migrated a live routing system using AI-assisted refactoring](https://swe.quest/articles/how-we-migrated-a-live-routing-system-using-ai-assisted-refactoring-db938ac15eae4cef.md): Datadog Engineering · 2026-06-23 · Medium · 13 min read · Refactoring & migrations, AI for coding, PostgreSQL, Schema migrations, Testing
  Datadog migrated Stream Router, the control plane that tells metrics producers and queriers which Kafka cluster, topic and partitions to use, from a FoundationDB key-value model to a relational schema.
- [Why Your Staging Database Never Matches Production](https://swe.quest/articles/why-your-staging-database-never-matches-production-0082e7428bf22c68.md): Neon · 2025-12-12 · Medium · 8 min read · PostgreSQL, Testing, Schema migrations, Privacy
  Staging databases drift from production continuously in three ways: data drift (stale dumps, sequence values that diverge so the same ID points to different records), schema drift (hotfixes, skipped migrations, mismatched indexes and extensions causing query plan divergence), and transformation drift (anonymization that breaks uniqueness, referential integrity and determinism).
- [Updating our data stack](https://swe.quest/articles/updating-our-data-stack-8fc5fea19caac0a4.md): incident.io · 2022-08-24 · Medium · 12 min read · Data pipelines, Analytics & OLAP, CI/CD, SQL
  incident.io's two-person data team reworked its BigQuery/dbt analytics stack as the company grew from 10 to 30 people.
- [How to Deploy Schema Changes to a Million Databases](https://swe.quest/articles/how-to-deploy-schema-changes-to-a-million-databases-356cdf3f01c11d17.md): Turso · 2025-06-02 · Medium · 4 min read · Schema migrations, Multi-tenancy, SQLite, Local-first & sync, Go
  Database-per-tenant schema migrations can scale to millions of databases by inverting control: a hosted schema registry stores a versioned catalog of SQL scripts, and each client periodically reports its schema version, pulls the missing migrations and applies them locally.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
