Let workflows merge or discard their own tasks
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
func insertDefinition(ctx context.Context, tx *sql.Tx, def api.WorkflowDefinition) (string, error) {
|
||||
id := ids.New(ids.WorkflowDefinition)
|
||||
_, err := tx.ExecContext(ctx, `INSERT INTO workflow_definitions (id, description) VALUES (?, ?)`, id, def.Description)
|
||||
_, err := tx.ExecContext(ctx, `INSERT INTO workflow_definitions (id, description, auto_merge, auto_discard) VALUES (?, ?, ?, ?)`, id, def.Description, def.AutoMerge, def.AutoDiscard)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -63,7 +63,7 @@ type stepRow struct {
|
||||
|
||||
func loadDefinition(ctx context.Context, q querier, id string) (api.WorkflowDefinition, error) {
|
||||
def := api.WorkflowDefinition{}
|
||||
err := q.QueryRowContext(ctx, `SELECT description FROM workflow_definitions WHERE id = ?`, id).Scan(&def.Description)
|
||||
err := q.QueryRowContext(ctx, `SELECT description, auto_merge, auto_discard FROM workflow_definitions WHERE id = ?`, id).Scan(&def.Description, &def.AutoMerge, &def.AutoDiscard)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return def, fmt.Errorf("%w: no workflow definition %s", ErrNotFound, id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user