tva
← Insights

Rollback after an update: when should you restore the database?

A hand compares two stacks of slips and marks a difference in pencil.

Test the old app against current data first

An update breaks the step that saves a request. The previous app version is available, but more requests have arrived since the last backup. Test the old app against a copy of the current database first. If the workflow still works, rolling back the app need not roll back the data.

A successful startup does not prove compatibility. Run the affected workflow, reload the saved request and check that the expected follow-up happens once. Disable external delivery or use a test destination. If the old app cannot handle the current schema or data, investigate a targeted fix to the current version first.

Two rows in each database, three changes at risk

For this article we backed up two synthetic requests in an isolated PostgreSQL environment and later restored the backup to a separate database. The restored copy showed requests 101 and 102 as open. In the newer copy, 101 was completed, 102 was deleted, and 103 had arrived.

Both copies contain two rows. Replacing the newer one would still undo the completion of 101, bring back 102 and lose 103. Compare stable business IDs and values, including deletions. Also check what has already gone out to connected systems: notifications, payments or other side effects.

Decide what must survive before switching over

A logical export with pg_dump captures a particular state. PostgreSQL point-in-time recovery instead requires a suitable base backup and a continuous sequence of archived write-ahead logs (WAL). It lets you choose another recovery point, but it does not distinguish intended business changes from unwanted ones.

If all relevant writers stopped before the backup and stayed stopped, an older state may be viable. Check that the database, file storage and dependent systems can be brought back to a consistent state. If writes continued or you are not sure, safeguard the current state before switching and determine which changes must carry forward.

tva builds these checks into existing release processes: an isolated restore, tests of critical workflows and explicit go/no-go criteria. See our disaster recovery guide for self-hosted services for the backup work that makes this possible.