Builder_db.Job_tag.add: use INSERT OR REPLACE to avoid constraint violation

This commit is contained in:
Robur 2021-06-30 09:56:47 +00:00
parent 9a271add7b
commit eb786088e7
3 changed files with 3 additions and 3 deletions

View file

@ -75,7 +75,7 @@ let infer_section_and_synopsis artifacts =
if OpamPackage.Set.exists (fun p -> OpamPackage.Name.equal p.OpamPackage.name influx) if OpamPackage.Set.exists (fun p -> OpamPackage.Name.equal p.OpamPackage.name influx)
switch.OpamFile.SwitchExport.selections.OpamTypes.sel_installed switch.OpamFile.SwitchExport.selections.OpamTypes.sel_installed
then then
"Unikernel (monitoring)" "Unikernel (with metrics reported to Influx)"
else else
"Unikernel" "Unikernel"
in in

View file

@ -157,7 +157,7 @@ module Job_tag = struct
let add = let add =
Caqti_request.exec Caqti_request.exec
Caqti_type.(tup3 id string id) Caqti_type.(tup3 id string id)
"INSERT INTO job_tag (tag, value, job) VALUES (?, ?, ?)" "INSERT OR REPLACE INTO job_tag (tag, value, job) VALUES (?, ?, ?)"
let get_value = let get_value =
Caqti_request.find Caqti_request.find

View file

@ -209,7 +209,7 @@ let infer_section_and_synopsis artifacts =
if OpamPackage.Set.exists (fun p -> OpamPackage.Name.equal p.OpamPackage.name influx) if OpamPackage.Set.exists (fun p -> OpamPackage.Name.equal p.OpamPackage.name influx)
switch.OpamFile.SwitchExport.selections.OpamTypes.sel_installed switch.OpamFile.SwitchExport.selections.OpamTypes.sel_installed
then then
"Unikernel (monitoring)" "Unikernel (with metrics reported to Influx)"
else else
"Unikernel" "Unikernel"
in in