Staging Deployment
Staging Migration Runbook
Do not run destructive reset commands in staging. Do not truncate tables.
Use this when you need a repeatable operational procedure.
Do not run destructive reset commands in staging. Do not truncate tables.
Before Migration
- Confirm
pnpm env:check:stagingpasses. - Confirm the real untracked staging environment passes
node scripts/env-check.mjs staging --file=.env.staging. - Take a database backup.
- Run
pnpm db:generate. - Run
pnpm db:migrate:status.
Apply Migration
Use deployment-style migrations:
pnpm db:migrate:deploy
pnpm db:migrate:statusDo not use prisma migrate dev in staging.
If Migration Fails
- Stop the rollout.
- Preserve logs and the migration error.
- Do not manually edit production-like data.
- Decide whether to fix forward or restore from backup.
- Document the decision in System QA or the release notes.
Drift Recovery
For local drift, recreate local containers if approved. For staging drift, compare migration history, backup first, then use Prisma-supported resolution only after human approval.
Developer Details
- Source
- apps/docs/content/staging-deployment/migration-runbook.md
- Owner
- Platform / Operations
- Status
- Current
- Module
- Staging Deployment
- Related route
- /api/health