Skip to content
Back

4 min read

The migration you cannot undo

Every destructive schema change is a decision made once and paid for repeatedly. Here is the checklist I use before running one.

  • databases
  • migrations
  • operations

Dropping a column is the cheapest line of SQL you will ever regret.

Why reversibility matters more than correctness

A correct migration that cannot be rolled back is still a gamble, because correctness is judged against the assumptions you held at the time. Reversibility is judged against reality.

The checklist

  1. Can this be expressed as two deploys instead of one? Add the new shape, backfill, switch readers, and only then remove the old shape.
  2. Is there a copy of the data outside this transaction? A dump taken five minutes ago is not a backup strategy, but it is better than nothing.
  3. What reads this column that I do not know about? Analytics jobs and internal dashboards are the usual answer.
  4. How will I know it worked? Write the verification query before the migration, not after.

What I actually do

I treat any DROP or ALTER ... TYPE as a two-week process rather than a deploy. The column stays, unused, until nothing has referenced it for a full billing cycle. It costs a few megabytes. It has saved me more than a few evenings.