Fixed that Builder_db_app.job_remove didn't take all related tables into account
+ Added a function for making a db-id into an int64 for printing
This commit is contained in:
parent
7bb9e2d8fe
commit
5897484cb2
4 changed files with 20 additions and 0 deletions
|
@ -164,6 +164,8 @@ let job_remove () datadir jobname =
|
||||||
(Ok ())
|
(Ok ())
|
||||||
builds
|
builds
|
||||||
in
|
in
|
||||||
|
let* () = Db.exec Builder_db.Access_list.remove_by_job job_id in
|
||||||
|
let* () = Db.exec Builder_db.Job_tag.remove_by_job job_id in
|
||||||
let* () = Db.exec Builder_db.Job.remove job_id in
|
let* () = Db.exec Builder_db.Job.remove job_id in
|
||||||
Db.commit ()
|
Db.commit ()
|
||||||
in
|
in
|
||||||
|
|
|
@ -152,6 +152,12 @@ module Job_tag = struct
|
||||||
Caqti_type.(tup2 (id `tag) (id `job))
|
Caqti_type.(tup2 (id `tag) (id `job))
|
||||||
Caqti_type.string
|
Caqti_type.string
|
||||||
"SELECT value FROM job_tag WHERE tag = ? AND job = ?"
|
"SELECT value FROM job_tag WHERE tag = ? AND job = ?"
|
||||||
|
|
||||||
|
let remove_by_job =
|
||||||
|
Caqti_request.exec
|
||||||
|
(id `job)
|
||||||
|
"DELETE FROM job_tag WHERE job = ?"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Build_artifact = struct
|
module Build_artifact = struct
|
||||||
|
@ -649,6 +655,11 @@ module Access_list = struct
|
||||||
Caqti_type.(tup2 (id `user) (id `job))
|
Caqti_type.(tup2 (id `user) (id `job))
|
||||||
"DELETE FROM access_list WHERE user = ? AND job = ?"
|
"DELETE FROM access_list WHERE user = ? AND job = ?"
|
||||||
|
|
||||||
|
let remove_by_job =
|
||||||
|
Caqti_request.exec
|
||||||
|
(id `job)
|
||||||
|
"DELETE FROM access_list WHERE job = ?"
|
||||||
|
|
||||||
let remove_all_by_username =
|
let remove_all_by_username =
|
||||||
Caqti_request.exec
|
Caqti_request.exec
|
||||||
Caqti_type.string
|
Caqti_type.string
|
||||||
|
|
|
@ -8,6 +8,7 @@ module Rep : sig
|
||||||
size : int;
|
size : int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val id_to_int64 : 'a id -> int64
|
||||||
val untyped_id : untyped_id Caqti_type.t
|
val untyped_id : untyped_id Caqti_type.t
|
||||||
val id : 'a -> 'a id Caqti_type.t
|
val id : 'a -> 'a id Caqti_type.t
|
||||||
val uuid : Uuidm.t Caqti_type.t
|
val uuid : Uuidm.t Caqti_type.t
|
||||||
|
@ -74,6 +75,8 @@ module Job_tag : sig
|
||||||
([`tag] id * string * [`job] id, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
([`tag] id * string * [`job] id, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
||||||
val get_value :
|
val get_value :
|
||||||
([`tag] id * [`job] id, string, [< `Many | `One | `Zero > `Zero `One ]) Caqti_request.t
|
([`tag] id * [`job] id, string, [< `Many | `One | `Zero > `Zero `One ]) Caqti_request.t
|
||||||
|
val remove_by_job :
|
||||||
|
([`job] id, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
||||||
end
|
end
|
||||||
|
|
||||||
module Build_artifact : sig
|
module Build_artifact : sig
|
||||||
|
@ -176,6 +179,8 @@ module Access_list : sig
|
||||||
([`user] id * [`job] id, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
([`user] id * [`job] id, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
||||||
val remove :
|
val remove :
|
||||||
([`user] id * [`job] id, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
([`user] id * [`job] id, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
||||||
|
val remove_by_job :
|
||||||
|
([`job] id, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
||||||
val remove_all_by_username :
|
val remove_all_by_username :
|
||||||
(string, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
(string, unit, [< `Many | `One | `Zero > `Zero ]) Caqti_request.t
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,6 +26,8 @@ type 'a id = untyped_id
|
||||||
let id (_ : 'a) : 'a id Caqti_type.t = untyped_id
|
let id (_ : 'a) : 'a id Caqti_type.t = untyped_id
|
||||||
let any_id : 'a id Caqti_type.t = untyped_id
|
let any_id : 'a id Caqti_type.t = untyped_id
|
||||||
|
|
||||||
|
let id_to_int64 (id : 'a id) : int64 = id
|
||||||
|
|
||||||
type file = {
|
type file = {
|
||||||
filepath : Fpath.t;
|
filepath : Fpath.t;
|
||||||
localpath : Fpath.t;
|
localpath : Fpath.t;
|
||||||
|
|
Loading…
Reference in a new issue