Skip to content

Commit

Permalink
Stop setting delete_reason on runs before deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Feb 23, 2022
1 parent 43aae95 commit e9db46c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions archives/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(?)
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion testdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e9db46c

Please sign in to comment.