You Rolled the App Back, but the DB Schema Already Changed. Now What?

Keeping the previous WAR answers only half of the rollback question. The archived app also has to read and write against today's database. How expand and contract creates a window where old and new apps coexist, the trap where nothing errors but values are wrong, and the rollback deadline to write on the approval.

John Baek
John Baek
Founder, CollabOps
2 min read

The product admin screen broke, so we put yesterday's WAR back. The application server started cleanly and passed its health check. Then an operator opened a product, and that's when it failed. Today's deploy had renamed the name column, which yesterday's app still queries, to display_name.

In this situation, "we kept the previous version" answers only half the question. You also need to know whether the archived app can read and write against the database as it is now. That's why even a single column rename gets a deploy sequence with a stretch where old and new apps run together. Adding the new column, migrating data, and only then dropping the old one is called expand and contract (Martin Fowler, ParallelChange). (Products and timestamps are illustrative.)

An app rollback only works if the archived previous version can read and write against the current schema and the current data.

In which database states do the old and new apps both work?

The old and new apps both work only while both columns exist and writes from either app land consistently in both.

DB stateOld app using nameNew app using display_name
Only name existsWorksFails to query the new column
Both columns, existing values copied onceReads and writes the old columnValues edited after the copy can fall behind
Both columns, writes from both apps kept consistentWorksWorks
name droppedFails to query the old columnWorks

Seeing both columns doesn't mean you can roll back

At 10 a.m. you fill both columns with the same product names. At 2 p.m. someone edits a product name in the new app, and it lands only in the new column. Roll back to the old app at 3 p.m. and the screen opens fine. The user just sees the morning's product name. No error, no log line. That makes it harder to catch than a "column not found" failure.

So during the transition you also have to ask who's writing. If the old app and a nightly batch still modify name, having only the new app write both columns still leaves a gap. You can move every write path over, or design the database to stay consistent while both versions coexist. Either way, the test is concrete: edit a product in the old app and read it in the new one, then edit it again in the new app and read it in the old one. Reconcile the migrated historical data separately.

How should a deploy approval state whether rollback is possible?

Next to "rollback to previous version possible," write when that stops being true. For example: "App-only rollback possible until sync to the old column is turned off." If operations knows that point in time, then during an incident they can decide right away whether to redeploy the old WAR, correct the data, or roll forward with a compatible fix.

The same question stands when you are undoing what an agent did rather than an app release: does the reverted result work on top of the data as it is now?

  • #legacy-deploy
  • #rollback
  • #database
  • #schema-migration
  • #deployment