The Change You Can't Take Back: Schema Migrations
RedHub AI Editorialupdated November 5, 20265 min read

Jump to a section7
A database migration rollback can put the migration code back. It cannot always put the data back. A schema migration adds, drops, or reshapes tables and columns. Once it has run against real rows, reverting the code does not restore values a drop removed, and it does not split a merge back into the two tables you started with. What makes a schema change reversible is a restorable copy of the data, taken before the change runs.
TL;DR: Code and data fail differently. Reverting code takes you back to where you were. Data a migration already changed stays changed when you revert the code that changed it. Before you accept an AI change that touches your schema, ask whether a copy of the data exists that you could put back. If the answer is no, "not needed," or "I can't tell," hold the change until a copy exists.
Code reverts. Changed data stays changed.
Most code changes can be walked back. A broken layout, a crashed page, a feature that misbehaves: revert the code and the app goes back to how it was, as long as the change never wrote anything to your stored data.
A schema migration that has already run against real data is different. You can revert the migration file and stop it from running again. You cannot get back what it already did. If a column was dropped and real rows had values in it, those values are gone once the drop runs, whether or not you revert the migration later. If two tables were merged and the merge resolved conflicting rows, that resolution already happened.
Some migration tools ship a "down" step that reverses the schema change. That step can rebuild a column. It cannot refill the column with the values that were in it unless those values were copied somewhere first. Check your own tool's documentation for exactly what its rollback restores before you rely on it.
The question that decides it
For any change that touches your schema or how money is handled, one question decides whether you could get back: is there a copy of the data you could restore if this is wrong? Not "there is probably a backup somewhere." A copy you could point to, and a way you know to put it back.
The Accept-or-Revert Ladder makes that question a gate. On a change marked as touching your data shape or money, any answer other than yes reads DO NOT ACCEPT YET. That includes "no," "cant_find," and "not_needed." With a copy in place, the change still has to pass the ordinary checks. If the current version is not saved, or undo is not one step, it reads CHECKPOINT FIRST. Only with all three in place does it read SAFE TO ACCEPT.
Three schema changes from the worked example
The Ladder ships with a worked example of ten changes. Three of them touch the schema. All three were saved and all three had a one-step undo. Only the data copy differs.
| Change | Data copy? | Verdict | Why |
|---|---|---|---|
| Add a column to the orders table | yes | SAFE TO ACCEPT | A copy exists, it is saved, undo is one step |
| Add a column to the users table | no | DO NOT ACCEPT YET | Nothing to restore the data from |
| Merge two tables together | cant_find | DO NOT ACCEPT YET | An answer you can't find is scored as none |
The first two rows describe the same kind of change: one new column on one table. In a diff they would look alike. They get opposite verdicts because of a fact the diff does not show. Reading the migration code more carefully would not have told you which one was safe.
The merge is the row to look at longest. A merge decides what happens to rows that conflict, and that decision is hard to rebuild afterward. Here the honest answer to "is there a copy?" was "I couldn't find out." The Ladder scores that as the worst answer the question could have had, so it reads the same as no. On the dashboard, that row is the one named under FIX FIRST, because the answer might turn out better once someone goes and looks.
"A copy wasn't needed"
The worked example has one more change in this class: changing how refunds are calculated. It was saved, undo was one step, and the copy was marked "not_needed." It still reads DO NOT ACCEPT YET. The Ladder's note on that row says that on a change like this, "not needed" is "the thing that will be wrong." The same goes for migrations. "It only adds a column, so no copy is needed" is the assumption the gate is built to catch. The dashboard counts these rows separately, under "where you decided a copy was not needed and it was."
What this doesn't check
The Ladder only asks whether a schema change could be undone. It says nothing about whether the schema is well designed, such as whether a table should exist or whether it enforces its own rules. That is a different question, and the Data Model Sanity Bench answers it. The Ladder also cannot see your database. It reads back your answers. If you mark a migration as app behavior, the gate will not fire.
None of this grades whether the migration was written well, and it never grades whoever wrote it or accepted it. It grades one pending change on one question: if this is wrong, is there a copy you could get back to?
More in this guide
Frequently asked questions
Why is a schema migration different from other code changes?
Because it changes stored data, and data does not revert with the code. Reverting a migration stops it from running again, but it does not restore values a drop removed or undo a merge that already combined rows. Only a copy of the data taken before the migration ran can bring those back.
What if I'm not sure whether a copy of the data exists?
Treat it as if it doesn't. In the Accept-or-Revert Ladder, "cant_find" on the data-copy question is scored as no copy, so a schema or money change with that answer reads DO NOT ACCEPT YET until someone checks.
If a copy exists, is the migration safe to accept?
Not by itself. In the Accept-or-Revert Ladder, a schema change with a data copy reads SAFE TO ACCEPT only if the current version is also saved and undo is one step. If either is missing, it reads CHECKPOINT FIRST. Either way, the verdict is about whether you could get back, not whether the migration is correct.
Does this tell me whether my schema is designed well?
No. It only asks whether a pending change could be undone. Whether a table enforces the rules you rely on is a separate question, answered by the Data Model Sanity Bench.
Does my migration tool's rollback mean I don't need a copy?
Check your tool's documentation for what its rollback restores. A step that reverses the schema can rebuild a dropped column, but it cannot refill it with the values that were there unless they were copied first. A copy of the data covers that gap.


The gate this post refers to, drawn from the tool’s own logic. See the tool.