Liking cljdoc? Tell your friends :D

syncopate.schema

Declarative schema deltas for Datalevin migrations.

A delta is a map with either or both of: :schema - map of attr -> attribute-definition to add or update, applied via datalevin.core/update-schema. :schema/remove - collection of attrs to drop. Datalevin won't drop an attr that still has datoms, so we retract them first.

Additive deltas (:schema only) are invertible, which is what powers the auto-:down sugar in syncopate.core.

Declarative schema deltas for Datalevin migrations.

A delta is a map with either or both of:
  :schema        - map of attr -> attribute-definition to add or update,
                   applied via `datalevin.core/update-schema`.
  :schema/remove - collection of attrs to drop. Datalevin won't drop an attr
                   that still has datoms, so we retract them first.

Additive deltas (`:schema` only) are invertible, which is what powers the
auto-`:down` sugar in `syncopate.core`.
raw docstring

additive?clj

(additive? step)

True if step is a purely additive schema delta (a :schema with no :schema/remove) — the only shape we can automatically invert.

True if `step` is a purely additive schema delta (a `:schema` with no
`:schema/remove`) — the only shape we can automatically invert.
sourceraw docstring

apply-delta!clj

(apply-delta! conn {add :schema remove :schema/remove})

Apply a schema delta to Datalog connection conn.

Removals retract every datom of each attr before the attr is dropped from the schema, so no data is silently orphaned and update-schema won't reject the drop.

Apply a schema delta to Datalog connection `conn`.

Removals retract every datom of each attr before the attr is dropped from the
schema, so no data is silently orphaned and `update-schema` won't reject the
drop.
sourceraw docstring

invertclj

(invert {add :schema})

Invert a purely additive schema delta: adding attrs becomes removing them. Removals cannot be auto-inverted (the prior attribute definitions are unknown), so callers must guard with additive? first.

Invert a purely additive schema delta: adding attrs becomes removing them.
Removals cannot be auto-inverted (the prior attribute definitions are
unknown), so callers must guard with `additive?` first.
sourceraw docstring

schema-delta?clj

(schema-delta? step)

True if step is a well-formed declarative schema delta: a map carrying a :schema (attr keyword -> definition map) and/or a :schema/remove (collection of attr keywords). Malformed shapes are rejected so they surface as an "unrecognised step" early rather than as a cryptic Datalevin error.

True if `step` is a well-formed declarative schema delta: a map carrying a
`:schema` (attr keyword -> definition map) and/or a `:schema/remove`
(collection of attr keywords). Malformed shapes are rejected so they surface as
an "unrecognised step" early rather than as a cryptic Datalevin error.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close