diff --git a/pool/app/pool_database/tenant.ml b/pool/app/pool_database/tenant.ml index e8993e2c9..e09fd6097 100644 --- a/pool/app/pool_database/tenant.ml +++ b/pool/app/pool_database/tenant.ml @@ -107,10 +107,12 @@ let start () = let check_migration_status pool = let open Migration in let%lwt () = - let%lwt up_to_date = pending_migrations pool () ||> CCList.is_empty in + let%lwt up_to_date = + pending_migrations pool ~migrations:(steps ()) () ||> CCList.is_empty + in Tenant.update_status pool - (if not up_to_date then MigrationsPending else Active) + (if up_to_date then Active else MigrationsPending) in check_migrations_status pool ~migrations:(steps ()) () in diff --git a/pool/database/database.mli b/pool/database/database.mli index c846479e3..dd3678669 100644 --- a/pool/database/database.mli +++ b/pool/database/database.mli @@ -272,7 +272,11 @@ module Migration : sig An empty list means that there are no pending migrations and that the database schema is up-to-date. *) - val pending_migrations : Label.t -> unit -> (string * int) list Lwt.t + val pending_migrations + : ?migrations:t list + -> Label.t + -> unit + -> (string * int) list Lwt.t val start : Label.t -> unit -> unit Lwt.t val extend_migrations : (string * steps) list -> unit -> (string * steps) list diff --git a/pool/database/migration/migration.ml b/pool/database/migration/migration.ml index ca7cbffa2..d8610842a 100644 --- a/pool/database/migration/migration.ml +++ b/pool/database/migration/migration.ml @@ -280,8 +280,8 @@ let migrations_status ?migrations database_label () = namespaces_to_check ;; -let pending_migrations database_label () = - let%lwt unapplied = migrations_status database_label () in +let pending_migrations ?migrations database_label () = + let%lwt unapplied = migrations_status ?migrations database_label () in let rec find_pending result = function | (namespace, Some n) :: xs -> if n > 0