Skip to content

Commit

Permalink
fix verify migration pending
Browse files Browse the repository at this point in the history
  • Loading branch information
mabiede committed Sep 11, 2024
1 parent fb83d5b commit 1da1f44
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions pool/app/pool_database/tenant.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion pool/database/database.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pool/database/migration/migration.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1da1f44

Please sign in to comment.