mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-05 13:46:51 +08:00
Refactoring DB queries related to archiving.
- Using Squirrel RunWith instead of ToSql.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user