Staging Deployment

Staging Migration Runbook

Do not run destructive reset commands in staging. Do not truncate tables.

Use this when...

Use this when you need a repeatable operational procedure.

Do not run destructive reset commands in staging. Do not truncate tables.

Before Migration

  1. Confirm pnpm env:check:staging passes.
  2. Confirm the real untracked staging environment passes node scripts/env-check.mjs staging --file=.env.staging.
  3. Take a database backup.
  4. Run pnpm db:generate.
  5. Run pnpm db:migrate:status.

Apply Migration

Use deployment-style migrations:

pnpm db:migrate:deploy
pnpm db:migrate:status

Do not use prisma migrate dev in staging.

If Migration Fails

  1. Stop the rollout.
  2. Preserve logs and the migration error.
  3. Do not manually edit production-like data.
  4. Decide whether to fix forward or restore from backup.
  5. 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