Backup and recovery
Spine does not ship backup machinery — backups are Supabase's job. This page is what to do around a restore.
What Supabase backs up
Depends on the plan the project's Supabase org is on:
- Pro and above — daily automated backups (retained ~7 days) in the dashboard under Database → Backups; Point-in-Time Recovery (PITR) is an add-on for finer granularity. Large databases may be on physical backups.
- Free tier — no managed backups. If the project must be recoverable, schedule your own
pg_dumpexports or move the project to a paid plan. - Check the project's actual plan/features in the Supabase dashboard — tiers change, and this runbook deliberately doesn't re-spec Supabase's current offerings.
How to restore
- Dashboard restore — pick the backup or PITR timestamp; Supabase restores the whole database into place.
- Own dump —
pg_restore/psqlthe export into the project. - A restore rolls back everything DB-side at once: schema and data. It does not touch your git checkout, deployed functions, or env vars.
What git restores vs. what backups restore
| Lost thing | Restored by |
|---|---|
Code, functions, seeds, spine.config.json, app packages | git — redeploy, migrate, seed-app |
| Migration definitions | git — .framework/migrations/, custom/migrations/ |
| Runtime data: records, people, types rows, invites, keys, logs, executions | only the DB backup |
Applied-migration ledger (_spine_migrations) | the backup — it rolls back with the data |
The ledger rollback is the trap: after a restore, the DB "forgets" it ran migrations that the deployed code expects. That's what the next section reconciles.
After a restore — reconcile in this order
See where the ledger landed:
npx spine-framework migrations statusWith
SUPABASE_URL/SUPABASE_DB_PASSWORDpointed at the restored project. Expect pending entries for every migration applied after the backup was taken.Re-apply what's missing:
npx spine-framework migrate --dry-run # review what will run npx spine-framework migrateMigrations are written to be idempotent (
IF NOT EXISTS, guard clauses), so re-applying over a partially-restored schema is the designed path — but read the dry-run output: if a migration's objects were partially restored, the guard clauses decide whether it no-ops or partially applies. A guard that can't see half-restored objects is a real failure mode — repair the drift by hand rather than editing the applied migration file.Re-seed apps whose seed data lived after the backup point:
npx spine-framework seed-app <slug>Seeds are idempotent by design (
conflict:keys); this tops up what the restore lost rather than duplicating.Health-check the wiring:
npx spine-framework doctor npx spine-framework system health npx spine-framework system manifestdoctorvalidates env/files/DB reachability;system manifesttells you the deployed code version — compare it against the migration ledger: code ahead of schema is the dangerous combination (new code calling objects the restored DB doesn't have). If code is ahead, either finish step 2's migrations or redeploy the older code until the schema catches up.- Re-check the runtime surface.
system health→healthy; non-admin path smoke (submit/read something real); checkdeliveriesandpipeline_executionsfor backlog accumulated during the gap — triggers and timers don't retro-fire for the missing window.
Common failure shapes
- Code ahead of restored schema — functions error on missing columns/tables. Fix:
migrate(step 2) or pin back the deploy. - Partially-restored objects — a table exists but its trigger/index doesn't. Fix: repair the specific objects, don't force the migration.
- Secrets, not data — API keys' hashes restore fine, but env-side secrets (Supabase keys,
INTERNAL_INVOKE_SECRET,OPENAI_API_KEY) live outside the DB. Verify env vars after any project-level recovery. - Timers/schedules after restore —
next_executionvalues in the restored data may be in the past; timers arm on next tick normally, but check any timer-driven automations actually resumed.
Related
- Migrations — ledger semantics, dry-run, ordering.
- Troubleshooting — diagnosis when restore reveals something else broken.
- Environment variables — the non-DB state you must re-verify.