D1 time travel
A rolling window of restore points; a bookmark pins the exact state to return to.
A bad migration or a bulk delete is not fixed by a backup file you never restored. D1 has time travel and bookmarks; R2 has object versioning. The drill is to restore into a new place, verify the rows and objects, then decide on the cutover.
A rolling window of restore points; a bookmark pins the exact state to return to.
d1 export gives you a snapshot file; you still need a restore path.
Object versioning keeps old objects; lifecycle rules can delete them earlier than you think.
Bring the copy up next to production, verify, then switch. Never test on the only copy.
| Command | What it shows |
|---|---|
| npx wrangler d1 time-travel info <DB> | The current bookmark and the restore window. |
| npx wrangler d1 export <DB> --output=snapshot.sql | A logical snapshot for verification. |
| npx wrangler r2 object get <bucket>/<key> | Whether the object still exists and which version. |
| R2 lifecycle rules | How long non-current versions survive. |
Before the bad write; record the bookmark and the timestamp.
Verify row counts and a few business invariants, not just "it imported".
A database row can point at an R2 object that is gone; check both sides.
Freeze writes, switch, verify, then re-enable. Keep the old copy until the next day.
This page is free. The paid runbooks cover the operational failures around it, with detection commands, five failure modes and a migration checklist.