Refactoring DB queries related to archiving.

- Using Squirrel RunWith instead of ToSql.
This commit is contained in:
Aleksandr Melnikov
2020-05-21 22:19:26 -07:00
parent e6d30407c9
commit 1a9ce9870d
2 changed files with 45 additions and 6 deletions

View File

@@ -1488,3 +1488,19 @@ func (c *Client) DeleteWorkflowExecutionDb(workflowUid string) error {
}
return nil
}
func (c *Client) ArchiveWorkflowExecutionDB(namespace, uid string) error {
tx, err := c.DB.Begin()
if err != nil {
return err
}
defer tx.Rollback()
_, err = sb.Update("workflow_executions").Set("is_archived", true).Where(sq.Eq{
"uid": uid,
"namespace": namespace,
}).RunWith(tx).Exec()
if err != nil {
return err
}
return nil
}