Skip to main content

schemabrain diff

Compares an on-disk project tree against the local store. Reports three kinds of drift per resource type:
  • only-on-disk — file exists, no corresponding store row.
  • only-in-store — store row exists, no corresponding file.
  • value-mismatch — both exist; the YAML body differs.
The comparison round-trips both sides through the YAML serialiser so the semantics match export-allapply exactly. Trust-signal fields are deliberately excluded from comparison — they’re not part of the YAML grammar.
Expected layout: identical to schemabrain apply.

Flags


Exit codes (CI-friendly)

This shape makes diff safe in CI gates:
Fails the job on drift; passes when the on-disk definitions agree with the store.

Examples

Pre-deploy gate

Apply only if clean

Investigate drift before resolving


What diff does not check

  • Source schema drift (added or removed columns in Postgres) — use schemabrain check for that.
  • Trust-signal drift (origin, inference_method, validation_state) — those fields are deliberately not part of the YAML grammar, so they would always read as drift if compared. Use schemabrain inspect to view trust signals.
  • dbt-owned resources — resources with origin='dbt' are still compared; if you want to skip them, filter the project tree before diffing.

schemabrain apply

Resolve drift by applying the on-disk version to the store.

schemabrain check

Source-schema drift (the orthogonal question).

schemabrain inspect

Browse trust signals that diff deliberately ignores.

schemabrain entities export-all

Re-export to disk to resolve only-in-store drift.