Module Migration.Make

Functor that creates a migration manager for a given configuration.

Internally creates the tracking table if needed, computes missing migrations, and applies them.

Parameters

Signature

val apply : Db.conn -> ?read_only:bool -> ?on_init:(unit -> unit Lwt.t) -> ?on_future:(applied:int -> known:int -> unit Lwt.t) -> ?on_applied:(name:string -> duration:Ptime.span -> unit Lwt.t) -> unit -> unit Tezos_error_monad.Error_monad.tzresult Lwt.t

apply conn ?read_only ?on_init ?on_future ?on_applied () creates the tracking table if absent (calling on_init), determines which migrations are missing, and applies them in order.

  • parameter read_only

    If true, fails when there are unapplied migrations instead of applying them. Default: false.

  • parameter on_init

    Called once when the tracking table is first created.

  • parameter on_future

    Called when the database has more migrations applied than are known — typically indicates a version mismatch.

  • parameter on_applied

    Called after each migration is applied, with the migration name and wall-clock duration in seconds.