Database Restore (Production)
Executive Overview — all summaries for decision-makers.
See also: BACKUP RESTORE RUNBOOK
Restore a PostgreSQL directory-format dump (e.g. from Coolify/Render backup) into Render Postgres.
Prerequisites
- PostgreSQL 18+ client (
pg_restore) — e.g.brew install postgresql@18 - Render External database URL (or internal URL when running on Render)
- Your IP allowed on Render Postgres (Dashboard → Access Control)
Steps
bash
# 1. External URL from Render Dashboard (PostgreSQL → Connections → External)
export DATABASE_URL='postgresql://user:pass@dpg-xxx-a.frankfurt-postgres.render.com/dbname?sslmode=require'
# 2. Restore (replaces existing objects)
./backend/scripts/restore-production-db.sh /path/to/backup.dir.tar.gz
# 3. Sync migration history (if dump schema is newer than _prisma_migrations)
cd backend && npx prisma migrate deploy
# If migrations fail because objects already exist:
# npx prisma migrate resolve --applied <migration_name>
# 4. Verify
psql "$DATABASE_URL" -c 'SELECT COUNT(*) FROM "User";'Production Deploy
- No auto-seed on deploy (
docker-entrypoint.shrunsprisma migrate deployonly) /api/admin/seeddisabled in production- Do not set
FORCE_SEED=trueon Render
Security
- Remove broad IP allowlists (
0.0.0.0/0) after restore - Never commit database dumps or
DATABASE_URLto git