When to Roll Back a Release, and When the Database Goes Back Too
Every app ships a bad release sooner or later. What matters is how long your customers feel it, and whether any of their data is lost.
A good rollback plan answers that before it happens: which problem gets which fix, how fast, and when the database goes back too.
A plan only counts once it’s checked
While getting a job-alert app I built ready for its first users, I checked its rollback plan against the live setup, line by line. Three things turned up:
- The nightly backup had failed three nights in a row, and nobody had noticed.
- The snapshot before each database change was built, but not switched on yet.
- AI features on the live site could not run: the key was saved under a misspelled name. Rolling back would not have helped, because the older version reads the same setting. The fix was forward: correct the name, rebuild, done in minutes.
All three turned up before any customer was on the app. The key was fixed the same day; the other two sit on the launch checklist.
The restore itself was practised on the test copy: take a snapshot, add a test record, restore, check the record is gone and the site still runs. Trying it once, before it matters, is the point.
Here is the plan it was checked against.
Three moves, cheapest first
| Move | What it does | How fast | What it costs |
|---|---|---|---|
| Fix forward | Ship a small fix | Minutes | Nothing, if the fix is small and sure |
| Roll back the code | The live site goes back to the version before | Seconds on modern hosting | Nothing: customer data stays as it is |
| Restore the database | The data goes back to an earlier minute | Minutes | Everything every customer did after that minute |
Pick the cheapest move that stops the harm. The database goes back last.
Which problem gets which move
- Customers are blocked (site down, can’t sign in, the main feature fails for everyone): roll back the code first, find the cause after.
- A customer sees someone else’s data: roll back now. Then write down who saw what, and when.
- One feature is broken, the rest works: fix forward, if the fix can be live within about an hour. If not, roll back.
- It looks wrong but nothing is blocked: fix it in the next release.
- An outside service is down (hosting, sign-in, the AI provider): nothing to roll back. Turn off the feature that depends on it and wait.
- A bug wrote wrong data: roll back the code so it stops. Then repair only the damaged rows. A full database restore is the last resort.
The short rule: customers blocked, roll back first. Not blocked, fix forward.
Why rolling back the code leaves the data alone
The trap is a release that changed the database: the older code may not understand the new tables.
So database changes only add: a new table, a new column. A change that deletes data stops the release unless it is approved, one file at a time. The version before keeps working with the new tables, so rolling back the code never needs the data to go back with it.
More on how those changes ship safely: Real test data, locked-down production.
Five questions to ask your developer before launch
- How long does a rollback take, and who can do it? Seconds, and one named person, is a good answer.
- If a release changed the database, can you still roll back? Listen for “changes only add”.
- How old is the newest backup, and when did a restore last work? A backup nobody has restored is a hope.
- What do customers lose if the database goes back? Everything after the restore point. Do they know that?
- How do you hear that something broke? An uptime check and error alerts, not a customer email. More in Keep automations running unwatched.
You don’t need to run any of this yourself. I write the plan for your app, try the restore once, and hand you one page that answers these five.
The short version
Three moves: fix forward, roll back the code, restore the database. Customers blocked: roll back first. Not blocked: fix forward. The database goes back last, because it costs every customer their recent work. And a plan only counts once a restore has been tried.
If your app broke right now, who would roll it back, and how long would it take?
The setup behind the plan, on Vercel and Neon Postgres.
Code rollback
- Vercel Instant Rollback moves the domain back to an older build without rebuilding.
- The free plan rolls back one step, so my ship script deletes old builds but always keeps exactly one older live build.
- After a rollback, Vercel stops putting new builds live on its own. The fix goes live with an explicit Promote, so a half-fixed build can’t slip out.
Database changes run in the build
- Pending migration files run before
next build, using the production connection string stored only in Vercel. No laptop holds it. - Each file runs in its own transaction. A failing file undoes itself, the build fails, and a failed build never goes live.
Deletes are opt-in, per file
A pending file containing DROP TABLE, DROP COLUMN, TRUNCATE or DELETE FROM (comments stripped) fails the production build unless ALLOW_DELETE names that exact file. Set it, redeploy, remove it: a leftover setting can’t wave through the next one.
That keeps every release expand-only, which is what makes a code-only rollback safe.
Snapshot first
The build can take a Neon snapshot named pre-migrate-<day>-<file> before it applies anything, and refuse to change the database without one. It needs a Neon API key in the build settings; that switch goes on before the first users arrive.
Repairing data
- Neon keeps 6 hours of history on the free plan (7 days on paid).
- Rows deleted by a bug: branch from a minute before the bug, copy the rows back with a new migration file, delete the branch. The live database keeps running.
- Most data damaged: restore the whole branch to that minute. Last resort: every write after it is lost.
Kill switch and alerts
- One admin toggle pauses every AI call and emails members, for when the AI provider misbehaves or costs spike.
- An uptime monitor pings a version endpoint that never touches the database, so it doesn’t keep a scale-to-zero database awake.
More Posts
All posts
November 25, 2026
Why Your App Went Offline on Vercel's Free Plan (and How to Stay Under the Limits)
Vercel's free plan pauses every site on the account when one monthly limit runs out. What the limits mean in plain words, what uses them up, and the fixes, from a real case.
November 24, 2026
Why Your Project Starts With a Small Paid Step: Requirements and an Estimate Before the Build
A price given before the work is measured is a guess, and someone pays for it later. What a small paid first step gets you: written decisions, a cost range and a time range, and the choice to stop there.