Detect & review drift

Drift is any difference between your schema, your migrations, and the live database. Schemic gives you two commands to surface it before it bites: schemic diff previews the delta, and schemic check proves your migrations still reproduce your schema.

Preview the pending change

schemic diff shows what a migration would contain, without writing one. By default it diffs your schema against the recorded snapshot:

Shell
npx schemic diff

To diff against a running database instead — the real test of drift — add --live:

Shell
npx schemic diff --live

This is the command to run before gen or push: it tells you exactly what will change.

See the delta as TypeScript

By default diff renders the change as SurrealQL. Add --ts to render it as TypeScript instead, laid out the same way pull edits your files — useful when you think in s.*, not DDL:

Shell
npx schemic diff --ts

Useful diff options

FlagEffect
--liveDiff against the running database instead of the snapshot.
--tsRender the delta as TypeScript rather than SurrealQL.
--downShow the rollback (reverse) direction.
--fullShow the complete definitions, not only the delta.
--jsonMachine-readable output.
--watchRe-run the diff as your schema changes.
--pagerPage long output.

Verify migrations in CI

schemic check replays your migrations in a throwaway engine and confirms the result matches your schema. It catches the dangerous kind of drift — a migration history that no longer reproduces your source of truth:

Shell
npx schemic check

It exits non-zero on a mismatch, so it works directly as a CI gate. By default it runs against an ephemeral in-memory SurrealDB started from your local surreal CLI, leaving your real database untouched.

Where to go next