Skip to main content
Use this when a migration must survive retries after a partial deploy. supaschema renders guarded DDL where PostgreSQL supports it and catalog-checked blocks where it does not. The goal is simple: a second apply should converge instead of failing on objects that already exist.

Use this when

  • Deploy jobs can be retried after timeouts, locks, or crashes.
  • Migration files are reviewed before a database has caught up.
  • Existing migrations need static safety checks.
  • CI should reject unguarded DDL or unsafe CASCADE.

Do this

Generate migrations from the schema tree:
npx supaschema diff
Check generated or hand-written files:
npx supaschema check database/migrations/*.sql
Use exact destructive hints only for reviewed object keys. Broad drops are not an idempotency shortcut.

Verify

When a disposable database is available, prove replay behavior:
npx supaschema verify
For pull request annotations or code scanning:
npx supaschema check --reporter github
npx supaschema check --reporter sarif

Check command

See diagnostics and reporter flags.

Verify command

Apply pending migrations twice in a disposable database.

Destructive hints

Approve risky operations deliberately.

Migration pipeline

See how diff, check, and verify fit together.
Last modified on June 16, 2026