Taking the fear out of migrations
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.
Related posts
- Migrating Data Ingestion Systems at Meta Scale
Meta Engineering mediumAdeptMeta 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. Each job went through shadow, reverse-shadow and cleanup phases, with promotion gated on matching row counts and checksums plus no regression in landing latency or resource use. Because CDC carries bad data forward into new partitions, bad partitions were flagged in metadata to halt delta landing or fall back to older target partitions, and backfills gave early rollback signals. Automated promotion/demotion tooling, batch selection that excluded jobs with known issues, and reuse of legacy snapshots cut expensive full dumps under limited capacity.
- How we migrated a live routing system using AI-assisted refactoring
Datadog Engineering mediumAdeptDatadog 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. PostgreSQL backs the write path and DuckDB the in-memory read path. The KV model forced the app to rebuild relationships in-process and hit transaction size limits, and simply swapping in Postgres with the same access patterns was estimated at 45 minutes for the heaviest operations. The team designed the schema by hand, then used Claude and Cursor in a tightly scoped, test-driven loop: map the intent of the old code into markdown docs, stub one Controller method, feed in the failing end-to-end tests, and iterate until they pass. A blue/green validator compared live responses every 30 seconds for weeks before cutover. The models produced correct but suboptimal SQL, so batching, UNNEST and CTE optimizations needed human input, and broad prompts performed poorly. The project went from design to production in about 3 months.
- Why Your Staging Database Never Matches Production
Neon mediumAdept
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). Scheduled pg_dump refreshes only cap staleness while adding lock windows and slow restores at scale, and logical replication doesn't carry DDL. The proposed fix is ephemeral copy-on-write database branches created at test time, inheriting production schema, data and sequences, with optional per-column masking, as offered by Neon.
- Updating our data stack
incident.io mediumAdeptincident.io's two-person data team reworked its BigQuery/dbt analytics stack as the company grew from 10 to 30 people. Fivetran moved to a separate BigQuery project after dbt tests in CI timed out because concurrent interactive queries exceeded BigQuery's 100-query quota. A CircleCI queue orb now serialises overlapping dbt runs that were creating and dropping the same tables. Unreliable GOOGLEFINANCE FX rates were replaced with a version-controlled seed plus a daily APILayer pull, checked by uniqueness and gaplessness tests. Models now materialise as tables rather than views, intermediate models sit between staging and fact/dimension models to avoid duplicated logic, SQLFluff enforces formatting, and Metabase folders separate sandbox work from locked-down core dashboards.
- How to Deploy Schema Changes to a Million Databases
Turso mediumAdeptDatabase-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. The registry needs only a simple migrations table, with no per-tenant state or distributed locks. Check-in timing (before critical operations, daily, or on user workflows) trades consistency against performance. The pull model suits offline-first apps that reconnect several versions behind, and a proof-of-concept is written in Go with SQLite.