From e9db46c9452faa9cd665d714dbd6e9854d271e38 Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Wed, 23 Feb 2022 14:06:50 -0500 Subject: [PATCH] Stop setting delete_reason on runs before deletion --- archives/runs.go | 14 +------------- testdb.sql | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/archives/runs.go b/archives/runs.go index 361764d..49d2b12 100644 --- a/archives/runs.go +++ b/archives/runs.go @@ -100,12 +100,6 @@ WHERE fr.org_id = $1 AND fr.modified_on >= $2 AND fr.modified_on < $3 ORDER BY fr.modified_on ASC, fr.id ASC ` -const setRunDeleteReason = ` -UPDATE flows_flowrun -SET delete_reason = 'A' -WHERE id IN(?) -` - const deleteRuns = ` DELETE FROM flows_flowrun WHERE id IN(?) @@ -190,13 +184,7 @@ func DeleteArchivedRuns(ctx context.Context, config *Config, db *sqlx.DB, s3Clie return err } - // first update our delete_reason - err = executeInQuery(ctx, tx, setRunDeleteReason, idBatch) - if err != nil { - return errors.Wrap(err, "error updating delete reason") - } - - // finally, delete our runs + // delete our runs err = executeInQuery(ctx, tx, deleteRuns, idBatch) if err != nil { return errors.Wrap(err, "error deleting runs") diff --git a/testdb.sql b/testdb.sql index 65e56e2..8cda49f 100644 --- a/testdb.sql +++ b/testdb.sql @@ -175,7 +175,7 @@ CREATE TABLE flows_flowrun ( exited_on timestamp with time zone NULL, submitted_by_id integer NULL references auth_user(id), status varchar(1) NOT NULL, - delete_reason char(1) NULL + delete_from_results boolean ); DROP TABLE IF EXISTS archives_archive CASCADE;