Preview without changing the live database
restore writes a new file and runs SQLite’s quick_check before returning. The destination directory must exist and the file must not exist. Open the copy separately to check Acme’s records and test the app against the old schema before deciding to revert.
Choose a time instead
Both restore and revert accept --time with an RFC 3339 timestamp instead of --version. They select the newest retained version at or before that time. Replace this example time with a moment before Acme’s import.
# Preview Acme’s database at or before the chosen time.
litebackup restore tenants/acme.sqlite /tmp/acme-before-import.sqlite --time 2026-11-28T09:00:00Z
After inspecting the preview, pause Acme as in step 3 before applying the same time.
# Roll back Acme’s database to the chosen time.
litebackup revert tenants/acme.sqlite --time 2026-11-28T09:00:00Z
These are alternatives to the version examples. Each SDK also accepts a time in place of a version. See the restore guide and SDK reference.
Undo the rollback
A revert replaces Acme’s whole database with the chosen version, including its schema. Valid changes made after that version are absent from the current database too.
Revert puts the chosen content back under Acme’s database name as a new head, one version beyond the current head. Like git revert adding a commit, it adds to the version list rather than erasing later versions. Those versions remain restorable for as long as retention keeps them. Revert to the version from before the rollback to undo it.
The revert changes only Acme’s database. Other tenants keep their current databases and changes. Resume Acme’s work after the revert succeeds and the app can use the restored database.
Offer customers an undo action
An admin or support action in your SaaS can use the same SDK calls. Your app checks who may recover the account and maps that account to its database name. List that database’s versions so the person can choose one to preview.
const versions = await litebackup.databases.versions("tenants/acme.sqlite");
After the person checks the preview and confirms the rollback, pause Acme as in step 3 and revert to the chosen version on its writer machine.
await litebackup.databases.revert("tenants/acme.sqlite", { version: 120 });
Your app supplies the customer interface, permission checks, and coordination with its workers. Litebackup supplies the version list, preview restore, and revert. A database per tenant makes the rollback one operation without extracting or merging shared tables.
Questions
What happens to Acme’s writes after the bad import?
A revert replaces Acme’s whole database with the chosen version, including its schema. Valid changes made after that version are absent from the current database too. Later captured versions remain restorable under retention. If Acme needs those newer changes, use the preview to work out a selective repair instead of reverting the whole database. The deleted rows guide shows how to copy selected rows back.
What if the app is writing during revert?
Pause Acme as in step 3. Revert refuses an open file with still_open. If the file holds writes the server lacks, it refuses with conflict and leaves the file untouched. This protection prevents overwriting unsynced writes. It does not preserve newer changes that have already synced when you choose an older version.
How far back can I go?
Only as far as the versions Litebackup captured and still retains. Choose retention in the console under Retention, and use litebackup versions tenants/acme.sqlite to see what is available now. A time selects a retained version at or before it. It does not reconstruct individual transactions between captured versions.
Can I do this with customers in shared tables?
Litebackup restores or reverts a whole SQLite database. It does not select a tenant’s rows, track dependencies across tables, or merge them into a shared database. A separate database per customer is what makes the per-customer rollback a single operation.
Install
Install Litebackup, then back up your tenant databases. The examples above show the calls after setup. Backups must already contain a version from before the mistake. See pricing for plans.