Skip to main content

schemabrain apply

Walks an on-disk project tree and applies each subdirectory’s YAML files to the store. The tree shape mirrors what schemabrain init --emit-yaml-dir and schemabrain {entities,metrics,joins} export-all produce, so the full store ↔ YAML round-trip closes here.
Expected layout:
Missing subdirectories are skipped cleanly. The walker applies in a deliberate order — entities first, then metrics and joins which reference entities. The per-resource apply commands enforce FK invariants internally, so a broken reference fails the inner command and surfaces in the outer summary; the outer walker does not abort on a single bad file.

Flags


How it relates to per-resource apply

The top-level apply is a convenience over the three per-resource apply commands; it never does anything the per-resource commands can’t.

Examples

Round-trip: snapshot the store to disk, then re-apply

Bootstrap from init --emit-yaml-dir

diff exits 0 only when there’s no drift; chain with && to apply only on clean state.

schemabrain diff

Drift check between project tree and store before applying.

schemabrain init --emit-yaml-dir

Produces the project tree this command consumes.

schemabrain entities

Per-resource apply / export commands.

schemabrain metrics

Per-resource apply / export for metrics.