2021-06-10 10:08:14 +00:00
|
|
|
let old_version = 1L and new_version = 1L
|
|
|
|
let identifier = "2021-02-02"
|
|
|
|
let migrate_doc = "add index job_build_idx on build"
|
|
|
|
let rollback_doc = "rollback index job_build_idx on build"
|
|
|
|
|
2021-10-20 09:10:43 +00:00
|
|
|
open Grej.Infix
|
2021-02-02 09:23:54 +00:00
|
|
|
|
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 =
|
2022-04-04 16:30:21 +00:00
|
|
|
Caqti_type.unit ->. Caqti_type.unit @@
|
|
|
|
"CREATE INDEX job_build_idx ON build(job)";
|
2021-02-02 09:23:54 +00:00
|
|
|
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 =
|
2022-04-04 16:30:21 +00:00
|
|
|
Caqti_type.unit ->. Caqti_type.unit @@
|
|
|
|
"DROP INDEX IF EXISTS job_build_idx"
|
2021-02-02 09:23:54 +00:00
|
|
|
in
|
2021-03-10 09:50:15 +00:00
|
|
|
Grej.check_version ~user_version:1L (module Db) >>= fun () ->
|
|
|
|
Db.exec q ()
|