← Back to library

▶ quest log

Three Things to Build Before Changing a Live Database

Engineering Best PracticesAdvanced@mattmurphyaisaved AUG 08

◇ Could this help me?

Yes. Add before you remove is the standard expand-and-contract migration pattern, and pairing it with a rollback written up front and a staging rehearsal is exactly how teams change live schemas safely. It is worth adopting as a rule rather than a preference, because the failure it prevents is customer-visible and hard to undo. This is a general practice.

✦ Walkthrough+10 xp / step
0 / 4 steps · adopt for +40
$ suggested_prompt+40xp

I need to change the schema of a live database. Produce the change as an expand-and-contract migration: add the new structure, backfill it, switch reads and writes over in a separate step, and drop the old structure only in a final step I approve. Write the rollback script for each step at the same time, and describe exactly how to rehearse the whole sequence against a current mirror of production before it touches real data.

More from Engineering Best Practices

Enter world →