package sihl

  1. Overview
  2. Docs

Parameters

module Repo : sig ... end

Signature

val register_migration : (string * Sihl__.Contract_migration.step list) -> unit

register_migration migration registers a migration migration with the migration service so it can be executed with `run_all`.

val register_migrations : (string * Sihl__.Contract_migration.step list) list -> unit

register_migrations migrations registers migrations migrations with the migration service so it can be executed with `run_all`.

val execute : ?ctx:(string * string) list -> (string * Sihl__.Contract_migration.step list) list -> unit Lwt.t

execute ?ctx migrations runs all migrations migrations on the connection pool.

val run_all : ?ctx:(string * string) list -> unit -> unit Lwt.t

run_all ?ctx () runs all migrations that have been registered on the connection pool.

val migrations_status : ?ctx:(string * string) list -> ?migrations:(string * Sihl__.Contract_migration.step list) list -> unit -> (string * int option) list Lwt.t

migrations_status ?ctx ?migrations () returns a list of migration namespaces and the number of their unapplied migrations.

By default, the migrations are checked that have been registered when registering the migration service. Custom migrations can be provided to override this behaviour.

val check_migrations_status : ?ctx:(string * string) list -> ?migrations:(string * Sihl__.Contract_migration.step list) list -> unit -> unit Lwt.t

check_migration_status ?ctx ?migrations () returns a list of migration namespaces and the number of their unapplied migrations.

It does the same thing as migration_status and additionally interprets whether there are too many, not enough or just the right number of migrations applied. If there are too many or not enough migrations applied, a descriptive warning message is logged.

val pending_migrations : ?ctx:(string * string) list -> unit -> (string * int) list Lwt.t

pending_migrations ?ctx () returns a list of migrations that need to be executed in order to have all migrations applied on the connection pool. The returned migration is a tuple (namespace, number) where namespace is the namespace of the migration and number is the number of pending migrations that need to be applied in order to achieve the desired schema version.

An empty list means that there are no pending migrations and that the database schema is up-to-date.

val register : (string * Sihl__.Contract_migration.step list) list -> Sihl__.Core_service.t
val lifecycle : Sihl__.Core_lifecycle.lifecycle
OCaml

Innovation. Community. Security.