Backups

D1 + KV snapshots. Daily 30d, weekly 1y, monthly forever (R2 lifecycle on the bucket itself — configure once via wrangler r2 bucket lifecycle).

Non-JSON response (200)
KeyWhenSizeMetadata
No backups in this tier yet.
Restore — manual procedure

Restore is a deliberate human action; no auto-button by design.

  1. Download a backup: npx wrangler r2 object get loft-mission-control/<key> --pipe > backup.json
  2. Apply migrations to target DB (or new throwaway DB for drill): for f in apps/admin-api/migrations/*.sql; do npx wrangler d1 execute <db> --remote --file=$f; done
  3. Restore: use scripts/restore-d1.mjs (TODO Plan 3.15 Task 4) or hand-roll an INSERT loop from the JSON. Verify row counts match the backup header before declaring done.
  4. Document the drill outcome in .kb/work/mission-control/15-backup-restore-drills/YYYY-MM.md.