2021-02-02 09:23:54 +00:00
|
|
|
open Rresult.R.Infix
|
|
|
|
|
2021-06-01 15:43:55 +00:00
|
|
|
let migrate _datadir (module Db : Caqti_blocking.CONNECTION) =
|
2021-02-02 09:23:54 +00:00
|
|
|
let job_build_idx =
|
|
|
|
Caqti_request.exec ~oneshot:true
|
|
|
|
Caqti_type.unit
|
|
|
|
"CREATE INDEX job_build_idx ON build(job)";
|
|
|
|
in
|
2021-03-10 09:50:15 +00:00
|
|
|
Grej.check_version ~user_version:1L (module Db) >>= fun () ->
|
|
|
|
Db.exec job_build_idx ()
|
2021-02-02 09:23:54 +00:00
|
|
|
|
2021-06-01 15:43:55 +00:00
|
|
|
let rollback _datadir (module Db : Caqti_blocking.CONNECTION) =
|
2021-02-02 09:23:54 +00:00
|
|
|
let q =
|
|
|
|
Caqti_request.exec ~oneshot:true
|
|
|
|
Caqti_type.unit
|
|
|
|
"DROP INDEX IF EXISTS job_build_idx"
|
|
|
|
in
|
2021-03-10 09:50:15 +00:00
|
|
|
Grej.check_version ~user_version:1L (module Db) >>= fun () ->
|
|
|
|
Db.exec q ()
|