Skip to main content
Use type-contract to inspect breaking changes to the generated type surface. type-contract diffs the type shapes of two schema sources (before vs after). It does not connect to a database. supaschema sync runs type-safety gates through workflow.type_safety. The deploy gate compares the configured before and after source models, not the live target catalog. The default policy reports diagnostics without blocking; deploy_blocking makes those findings refuse target mutation. The standalone type-contract --enforce flag provides the same fail-closed behavior without running sync. type-contract --enforce exits 2 when it finds a breaking change. Without --enforce, the command reports the findings and exits 0.

Use this when

  • A migration must not break downstream TypeScript/Zod consumers.
  • CI should gate breaking type-contract changes on a pull request.
  • You want to understand the type-safety diagnostics that sync can block before apply.

Run it

With no flags, --from defaults to git:HEAD and --to to the declarative tree.

Flags

source
Previous schema source. Defaults to git:HEAD.
source
New schema source. Defaults to the declarative tree.
text | json | github | sarif
Output format. An unknown value exits 2 with an error.
boolean
Fail (exit 2) on a breaking change in the standalone command. The sync deploy-safety gate is configured separately by workflow.type_safety.

What it flags as breaking

  • a removed table;
  • a removed column;
  • a changed column type;
  • a removed enum, or a removed enum value.

Exit codes

ORM-free apps

See how generated types and validators replace ORM schema ownership.

Sync command

Run deploy-blocking type-safety and RLS-safety gates before apply.
Last modified on July 24, 2026