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:
npx schemic diffTo diff against a running database instead — the real test of drift — add --live:
npx schemic diff --liveThis 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:
npx schemic diff --tsUseful diff options
| Flag | Effect |
|---|---|
--live | Diff against the running database instead of the snapshot. |
--ts | Render the delta as TypeScript rather than SurrealQL. |
--down | Show the rollback (reverse) direction. |
--full | Show the complete definitions, not only the delta. |
--json | Machine-readable output. |
--watch | Re-run the diff as your schema changes. |
--pager | Page 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:
npx schemic checkIt 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
- Generate & run migrations — act on what
diffshows you. - Adopt an existing database — pull drift back into code.
- CLI commands — every flag for
diffandcheck.