Running database migrations safely

Schema changes are where confident teams get burned. How we change the database without breaking production.

Engineering

Engineering

Change the foundation, carefully

The database is the one place you cannot just roll back.

We make schema changes in safe, backward-compatible steps, test them against realistic data, and keep a path back, so evolving the data model never risks the live system.

How we change schemas without fear

Backward-compatible

Each step works with both the old and new code.

Small increments

Add, backfill, then remove, never all at once.

Reversible path

Every step has a tested way back before we take the next.

Where teams get burned

The database is the one place you can't just roll back

Code reverts in seconds; data doesn't forgive as easily.

A bad deploy can be undone by shipping the old binary. A bad schema change can leave data half-transformed, with no clean way back. That asymmetry is why confident teams treat migrations with extra care.

We change schemas in small, backward-compatible steps, add before remove, migrate data separately, and keep the old and new shapes working together until the switch is truly safe.

Highlights

How we stay safe

Backward compatible

Old and new code both work mid-change.

Tested on real data

No surprises in production.

Reversible

A clear path back at every step.

Deep dive

Migrations are deployments in disguise

The mental shift that prevents disasters: a migration is not a script, it is a deployment with a data payload. It deserves the same review, staging rehearsal and rollback plan as any code release, and the rehearsal must run against production-sized data, where the ten-second ALTER becomes a ten-minute lock.

Expand-and-contract is the pattern that pays the bills: add the new column or table, dual-write, backfill in throttled batches, verify, then remove the old shape in a later release. Each step is individually reversible, which is the whole point.

Long operations get instrumentation, progress logged per batch, resumable checkpoints, and a kill switch that stops cleanly. A migration you cannot pause is a hostage situation with your database.

Team for AppsProduct & Engineering

We build software for teams who want their tools to fit the way they actually work — web, mobile, AI and the systems that tie them together. We write here about what we learn shipping it.

Have a project in mind?

Tell us what you're building and we'll get back to you within one business day.