kiroku-store-migrations: Schema migrations for kiroku-store

[ bsd3, database, eventing, library, program ] [ Propose Tags ] [ Report a vulnerability ]

Embedded codd migrations and a migration executable for installing and upgrading the PostgreSQL schema used by kiroku-store.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.18 && <5), bytestring (>=0.11 && <0.13), codd (>=0.1.8 && <0.2), file-embed (>=0.0.15 && <0.0.17), kiroku-store-migrations, streaming (>=0.2 && <0.3), text (>=2.0 && <2.2), time (>=1.12 && <1.15) [details]
License BSD-3-Clause
Author Nadeem Bitar
Maintainer nadeem@gmail.com
Uploaded by shinzui at 2026-05-23T21:11:39Z
Category Database, Eventing
Home page https://github.com/shinzui/kiroku
Bug tracker https://github.com/shinzui/kiroku/issues
Source repo head: git clone https://github.com/shinzui/kiroku.git
Distributions
Executables kiroku-store-migrate
Downloads 1 total (1 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for kiroku-store-migrations-0.1.0.0

[back to package description]

kiroku-store-migrations

kiroku-store-migrations owns schema evolution for kiroku-store. It embeds Kiroku's timestamped SQL migrations and runs them through codd, so a service can migrate its database before opening Kiroku.Store.withStore.

Run the executable with codd's standard environment variables:

CODD_CONNECTION='host=/tmp port=5432 dbname=kiroku user=kiroku_admin' \
CODD_MIGRATION_DIRS=unused-for-embedded-migrations \
CODD_EXPECTED_SCHEMA_DIR=unused-for-unverified-embedded-migrations \
CODD_SCHEMAS=kiroku \
kiroku-store-migrate

The bootstrap migration creates a dedicated kiroku schema and installs every Kiroku table, index, function, and trigger inside it, leaving public free for application objects. CODD_SCHEMAS=kiroku tells codd to track that schema. The runtime role therefore needs privileges on the kiroku schema (for example USAGE plus the table privileges it uses), not on public.

After migrations run, start the application normally:

withStore (defaultConnectionSettings connString) app

codd is forward-only. Once a migration has run in production, reverting the Haskell package does not undo the database change. Repair state by restoring from backup or by shipping another forward migration.

This first implementation runs without codd expected-schema verification because Kiroku does not yet ship a checked-in codd expected-schema snapshot. CODD_EXPECTED_SCHEMA_DIR is still required by codd's settings parser, but this executable does not read from it. Operators should treat the migration table as the source of applied-version truth until strict snapshots are added.