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.
Flags
| Argument / Flag | Default | Purpose |
|---|---|---|
project_dir (positional) | ./schemabrain | Path to the project tree. |
--source URL | (none) | Source URL the YAMLs attach to. Deprecated when the URL contains a password. |
--url-env VARNAME | (none) | Env var holding the source URL. Preferred. |
--store-path PATH | ./schemabrain.db | Path to the local SQLite store. |
How it relates to per-resource apply
| You want to … | Use |
|---|---|
| Apply a whole project tree | schemabrain apply <dir> |
| Apply one entity file | schemabrain entities apply <file> |
| Apply one metric file | schemabrain metrics apply <file> |
| Apply one join file | schemabrain joins apply <file> |
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
Drift-check before applying (recommended)
diff exits 0 only when there’s no drift; chain with && to apply only on clean state.
Related
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.