Syncopate — a production-quality ragtime adaptor for Datalevin.
Public surface:
store construct the ragtime DataStore (re-exported from
syncopate.store).load-resources build migrations from EDN/CLJ files on the classpath.->migration build a single migration from a spec map.pending / status observability without running anything.Migrations are EDN-first. A migration spec is a map:
{:id "0002-split-names" ; optional; defaults to the filename :up <step | [step ...]> :down <step | [step ...]> ; optional if :up is purely additive :transaction? true ; optional, default true :irreversible? false} ; optional
A step is one of:
transact! dataSugar:
:up/:down may be a single step instead of a vector.:down and it is derived automatically iff every :up step is a
purely additive schema delta. Otherwise supply :down, or set
:irreversible? true to opt out of rollback with a clear error.Syncopate — a production-quality ragtime adaptor for Datalevin.
Public surface:
- `store` construct the ragtime DataStore (re-exported from
`syncopate.store`).
- `load-resources` build migrations from EDN/CLJ files on the classpath.
- `->migration` build a single migration from a spec map.
- `pending` / `status` observability without running anything.
Migrations are EDN-first. A migration spec is a map:
{:id "0002-split-names" ; optional; defaults to the filename
:up <step | [step ...]>
:down <step | [step ...]> ; optional if :up is purely additive
:transaction? true ; optional, default true
:irreversible? false} ; optional
A *step* is one of:
- {:schema {attr def ...}} add/update attrs (invertible)
- {:schema/remove [attr ...]} retract + drop attrs
- {:tx [tx-data ...]} raw `transact!` data
- a fully-qualified symbol resolved to (fn [conn] ...) and called
- (in .clj files) an actual fn called as (fn [conn] ...)
Sugar:
- `:up`/`:down` may be a single step instead of a vector.
- Omit `:down` and it is derived automatically iff every `:up` step is a
purely additive schema delta. Otherwise supply `:down`, or set
`:irreversible? true` to opt out of rollback with a clear error.(->migration {:keys [id up down transaction? irreversible?] :as spec})Build a SyncopateMigration from a spec map (see the namespace docstring).
Build a `SyncopateMigration` from a spec map (see the namespace docstring).
(load-resources path)Load migrations from a classpath prefix, sorted by id. Works from both exploded directories (dev) and jars (production).
Load migrations from a classpath prefix, sorted by id. Works from both exploded directories (dev) and jars (production).
(migrate! store migration)Atomically apply migration's :up and record it as applied. Returns store.
Atomically apply `migration`'s `:up` and record it as applied. Returns `store`.
(migrate-all! store migrations)Apply every pending migration from migrations in order, each atomically.
Idempotent: a second call with nothing pending is a no-op. Returns store.
Apply every pending migration from `migrations` in order, each atomically. Idempotent: a second call with nothing pending is a no-op. Returns `store`.
(pending store migrations)The migrations from migrations not yet recorded as applied in store,
in order (ragtime issue #127).
The migrations from `migrations` not yet recorded as applied in `store`, in order (ragtime issue #127).
(rollback! store migration)Atomically apply migration's :down and un-record it. Returns store.
Atomically apply `migration`'s `:down` and un-record it. Returns `store`.
(rollback-last! store migrations)Atomically roll back the most recently applied migration, resolving its
:down from migrations. No-op if nothing is applied. Returns store.
Atomically roll back the most recently applied migration, resolving its `:down` from `migrations`. No-op if nothing is applied. Returns `store`.
(status store migrations)A report of applied vs pending migration ids (ragtime issues #85/#127).
A report of applied vs pending migration ids (ragtime issues #85/#127).
(store conn)(store conn opts)Construct a Syncopate ragtime DataStore over a live Datalevin connection.
See syncopate.store/store for options.
Construct a Syncopate ragtime DataStore over a live Datalevin connection. See `syncopate.store/store` for options.
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 |