Builder_db.Job_tag: provide next to add also an update

Model: if Job_tag.add fails, use Job_tag.update
This commit is contained in:
Robur 2021-06-30 10:15:50 +00:00
parent eb786088e7
commit 1e190e42c7

View file

@ -157,7 +157,10 @@ 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 OR REPLACE INTO job_tag (tag, value, job) VALUES (?, ?, ?)" {| INSERT INTO job_tag (tag, value, job)
VALUES (?1, ?2, ?3)
ON CONFLICT(x) DO UPDATE SET value = ?2 WHERE tag = ?1 AND job = ?3
|}
let get_value = let get_value =
Caqti_request.find Caqti_request.find