From 26280941b5d1b4fffbc507c1af04eebeadba2819 Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Wed, 12 Jan 2022 11:48:59 -0500 Subject: [PATCH] Remove deletion of recent runs as these are no longer created --- archives/runs.go | 11 ----------- testdb.sql | 9 --------- 2 files changed, 20 deletions(-) diff --git a/archives/runs.go b/archives/runs.go index 61ddfdd..361764d 100644 --- a/archives/runs.go +++ b/archives/runs.go @@ -106,11 +106,6 @@ SET delete_reason = 'A' WHERE id IN(?) ` -const deleteRecentRuns = ` -DELETE FROM flows_flowpathrecentrun -WHERE run_id IN(?) -` - const deleteRuns = ` DELETE FROM flows_flowrun WHERE id IN(?) @@ -201,12 +196,6 @@ func DeleteArchivedRuns(ctx context.Context, config *Config, db *sqlx.DB, s3Clie return errors.Wrap(err, "error updating delete reason") } - // any recent runs - err = executeInQuery(ctx, tx, deleteRecentRuns, idBatch) - if err != nil { - return errors.Wrap(err, "error deleting recent runs") - } - // finally, delete our runs err = executeInQuery(ctx, tx, deleteRuns, idBatch) if err != nil { diff --git a/testdb.sql b/testdb.sql index 7db2162..8922c0c 100644 --- a/testdb.sql +++ b/testdb.sql @@ -159,7 +159,6 @@ CREATE TABLE auth_user ( ); DROP TABLE IF EXISTS api_webhookevent CASCADE; -DROP TABLE IF EXISTS flows_flowpathrecentrun CASCADE; DROP TABLE IF EXISTS flows_actionlog CASCADE; DROP TABLE IF EXISTS flows_flowrun CASCADE; CREATE TABLE flows_flowrun ( @@ -204,11 +203,6 @@ CREATE TABLE channels_channellog ( msg_id integer NOT NULL references msgs_msg(id) ); -CREATE TABLE flows_flowpathrecentrun ( - id serial primary key, - run_id integer NOT NULL references flows_flowrun(id) DEFERRABLE INITIALLY DEFERRED -); - INSERT INTO orgs_org(id, name, is_active, is_anon, created_on) VALUES (1, 'Org 1', TRUE, FALSE, '2017-11-10 21:11:59.890662+00'), (2, 'Org 2', TRUE, FALSE, '2017-08-10 21:11:59.890662+00'), @@ -324,9 +318,6 @@ INSERT INTO flows_flowrun(id, uuid, responded, contact_id, flow_id, org_id, resu (5, 'abed67d2-06b8-4749-8bb9-ecda037b673b', TRUE, 7, 2, 3, '{}', '[]', '[]', '2017-10-10 21:11:59.890663+02:00','2017-10-10 21:11:59.890662+02:00','2017-10-10 21:11:59.890662+02:00', 'C', NULL), (6, '6262eefe-a6e9-4201-9b76-a7f25e3b7f29', TRUE, 7, 2, 3, '{}', '[]', '[]', '2017-12-12 21:11:59.890662+02:00','2017-12-12 21:11:59.890662+02:00','2017-12-12 21:11:59.890662+02:00', 'C', NULL); -INSERT INTO flows_flowpathrecentrun(id, run_id) VALUES -(1, 3); - -- update run #5 to have a path longer than 500 steps UPDATE flows_flowrun SET path = s.path FROM ( SELECT json_agg(CONCAT('{"uuid": "babf4fc8-e12c-4bb9-a9dd-61178a118b5a", "node_uuid": "accbc6e2-b0df-46cd-9a76-bff0fdf4d753", "arrived_on": "2017-10-12T15:07:24.', LPAD(gs.val::text, 6, '0'), '+02:00", "exit_uuid": "8249e2dc-c893-4200-b6d2-398d07a459bc"}')::jsonb) as path FROM generate_series(1, 1000) as gs(val)