Status: Accepted (2026-08-03). Schema is basis-versioned data, and
additive, validate-reindex, protection, and retirement changes apply through
corium schema update --apply; rewrite and destructive changes remain
refused, and the delivery plan records what is left. Design:
docs/design/schema-migrations.md. Relates
to ADR-0009, which fixes the supported attribute model,
ADR-0018, whose forward-only protection
timeline is schema migration work, and
ADR-0019, which supplies the eventual home for
long-running migration jobs.
Corium accepted a schema only when a database was created. The implementation
stored the resulting Schema and ident registry in creation-time metadata and
sent that snapshot in a peer handshake. Ordinary transactions neither altered
the schema cache nor told connected peers to replace it. This fell short of
the project's intended model that schema is data and made a CLI-only update
command impossible to implement safely.
Schema differences also have radically different costs. Adding an unused attribute needs no data work. Adding uniqueness needs a duplicate scan and an index backfill. Collapsing cardinality may need conflict resolution. Removing an attribute or changing its type cannot erase or reinterpret immutable history. Treating all of these as equivalent map edits would conceal the exact operational risk the command needs to expose.
Schema updates use a declarative, basis-fenced plan/apply workflow, and schema becomes basis-versioned data before any update is applied.
corium schema update <db> --schema <file> is read-only by default. It
normalizes the desired schema, reads the installed schema at one basis,
computes a property-level diff, measures affected facts and constraint
violations, and emits a deterministic plan digest. Advisory counts, samples,
and estimates accompany the plan. The digest excludes these observations, so
harmless data drift does not contradict the rule below.--apply --plan <digest>. The request carries the observed
basis for audit. The transactor validates the installed-schema fingerprint,
desired digest, and safety preconditions inside its single-writer path.
Schema or safety-relevant drift aborts the whole apply and requires a new
plan. Harmless ordinary data writes do not prevent an additive update.--prune explicitly requests
retirement, which preserves schema metadata and history while refusing new
assertions. Hard deletion and excision are separate operations.Db values derive their Schema and idents from the seed and later changes.
This rule also applies to time views. Peers learn changes through ordinary tx
reports.t
validates and interprets data with the schema at t, and live peers converge
without reconnecting.Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |