Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deletion of recent runs as these are no longer created #60

Merged
merged 1 commit into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions archives/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(?)
Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 0 additions & 9 deletions testdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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)
Expand Down