Prompt·Rebuild and safe change·PG15
Can we rebuild this database from its sources?
You worry about disaster recovery, production-only state, or whether the data could be rebuilt.
Prompt
Determine whether this database can be reconstructed from the repository, migrations, original source material and retained operational records. Identify anything that exists only in production, any transformations that cannot be reproduced, and data that would be permanently lost. Where possible, test the reconstruction on an isolated database and compare the resulting records and relationships.
- What it returns
- The exact inputs needed to rebuild, the migration chain, a sampled comparison of a rebuilt copy against production, and the gaps that can't be recovered.
- Skip it when
- The database is a disposable cache you can refill at any time.
- Avoid
- Running a destructive restore against production, or treating a list of backups as proof they restore.
- Changes
- Tests on a separate copy
- Sessions
- Look first, then fix in a new session
- Tools
- Needs: the repository, read-only production access and a separate database you are allowed to build into.
- Works on
- Any PostgreSQL host: Supabase, Neon, RDS, Cloud SQL or self-hosted.
Related prompts
- Why production might not match mainPromptLists every way 'merged' can fail to mean 'live'.
- Where did this number come from?PromptChecks that every number on screen can be traced back to a source document.
- Reproduce what the database believed in the pastPromptPast reports, backfills, restatements or changed classification rules matter.
- Are our database changes safe before we merge?PromptA migration, or a change to functions, views, RLS, types or column meaning, is about to ship.
More in Rebuild and safe change.