From fb8296ec16627f11b555bed1e2678437280302ab Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 22 Feb 2021 08:32:51 +0100 Subject: 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 Tested-by: Matthias Beyer --- src/db/models/submit.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/db') 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")?; -- cgit v1.2.3