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.

Markdown
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

More in Rebuild and safe change.