schemabrain check
Probes the live source Postgres and compares its current schema to the snapshot in the local store. Surfaces three kinds of drift:
- Tables that were indexed but no longer exist.
- Columns that were indexed but no longer exist.
- Type / nullability changes on existing columns.
schemabrain diff.
Flags
| Flag | Default | Purpose |
|---|---|---|
--source URL | (none) | Source URL. Deprecated when the URL contains a password. One of --source / --url-env is required. |
--url-env VARNAME | (none) | Env var holding the source URL. Preferred. |
--store-path PATH | ./schemabrain.db | Path to the local SQLite store. |
--json | (off) | Emit JSON to stdout instead of the rich-rendered report to stderr. Pipe-friendly for CI / monitoring. |
When to run it
- After any database migration.
- On a schedule, paired with an alert when the JSON output reports non-empty drift.
- Before running
schemabrain servein a long-lived environment.
check reports drift, re-run schemabrain index --url-env DATABASE_URL --store-path ./schemabrain.db to refresh the snapshot. Indexing is idempotent and only re-enriches changed columns.
Examples
Default human report
CI-friendly JSON
Refresh after detecting drift
Related
schemabrain index
Refresh the snapshot after
check reports drift.schemabrain diff
The orthogonal drift question — project tree vs store.
schemabrain doctor
Broader health check covering host config + store.
schemabrain inspect
Browse the indexed schema without re-probing the source.