summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-02-22 08:32:51 +0100
committerMatthias Beyer <matthias.beyer@atos.net>2021-02-22 08:52:15 +0100
commitfb8296ec16627f11b555bed1e2678437280302ab (patch)
treed7eb0eceefe88c14b6bbe03fdf145fcfbf452d7d /src/db
parent41a98f8d81f0f14ff05f4924ba708bb7cf1818cb (diff)
Fix: Re-use submit UUID if staging directory is overwritten
This patch changes the behaviour if the staging directory is re-used. If the staging directory is re-used, we take the submit UUID from there instead of generating a new one. This way, database entries are added to the already existing submit instead of added to a new one, but the artifacts are put into the staging store of the reused one. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net> Tested-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/db')
-rw-r--r--src/db/models/submit.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/db/models/submit.rs b/src/db/models/submit.rs
index 7792adf..154ed1b 100644
--- a/src/db/models/submit.rs
+++ b/src/db/models/submit.rs
@@ -63,7 +63,10 @@ impl Submit {
diesel::insert_into(submits::table)
.values(&new_submit)
+
+ // required because if we re-use the staging store, we do not create a new UUID but re-use the old one
.on_conflict_do_nothing()
+
.execute(database_connection)
.context("Inserting new submit into submits table")?;