(** Versioned schema migrations for the SQLite store. Each migration is a numbered, named set of statements. A [schema_migrations] ledger records which versions a database file already carries, so applying on connect runs only the migrations the file is missing and never repeats one. Every statement still uses [IF NOT EXISTS], so a database created by an earlier, ledger-less build stays safe. Includes the [dream_session] table {!Dream.sql_sessions} expects. *) type migration = { version : int; name : string; statements : string list } (** One migration: a version, a human name, and the ordered statements it runs. *) val migrations : migration list (** Every migration, in ascending version order. *) val apply : (module Caqti_lwt.CONNECTION) -> (unit, Caqti_error.t) result Lwt.t (** Create the ledger, then apply every migration not yet recorded, each inside a transaction. Idempotent across reconnects. *) val statements : string list (** Every migration's statements, in order, exposed for documentation and tests. *)