Skip to main content

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.
This is the source-side drift check. For drift between the store and an on-disk YAML project tree, use schemabrain diff.

Flags


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 serve in a long-lived environment.
After 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


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.