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

Stop setting delete_reason on runs before deletion #63

Merged
merged 1 commit into from
Feb 24, 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
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