| 1 | -- SPDX-License-Identifier: AGPL-3.0-or-later |
| 2 | |
| 3 | -- name: InsertWorkflowStep :one |
| 4 | INSERT INTO workflow_steps ( |
| 5 | job_id, step_index, step_id, step_name, if_expr, |
| 6 | run_command, uses_alias, working_directory, step_env, continue_on_error, |
| 7 | step_with |
| 8 | ) VALUES ( |
| 9 | $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11 |
| 10 | ) |
| 11 | RETURNING id, job_id, step_index, step_id, step_name, if_expr, |
| 12 | run_command, uses_alias, working_directory, step_env, |
| 13 | continue_on_error, status, conclusion, log_object_key, |
| 14 | log_byte_count, started_at, completed_at, version, |
| 15 | created_at, updated_at, step_with; |
| 16 | |
| 17 | -- name: GetWorkflowStepByID :one |
| 18 | SELECT id, job_id, step_index, step_id, step_name, if_expr, |
| 19 | run_command, uses_alias, working_directory, step_env, |
| 20 | continue_on_error, status, conclusion, log_object_key, |
| 21 | log_byte_count, started_at, completed_at, version, |
| 22 | created_at, updated_at, step_with |
| 23 | FROM workflow_steps |
| 24 | WHERE id = $1; |
| 25 | |
| 26 | -- name: UpdateWorkflowStepStatus :one |
| 27 | UPDATE workflow_steps |
| 28 | SET status = $2, |
| 29 | conclusion = sqlc.narg(conclusion)::check_conclusion, |
| 30 | started_at = sqlc.narg(started_at)::timestamptz, |
| 31 | completed_at = sqlc.narg(completed_at)::timestamptz, |
| 32 | version = version + 1, |
| 33 | updated_at = now() |
| 34 | WHERE id = $1 |
| 35 | RETURNING id, job_id, step_index, step_id, step_name, if_expr, |
| 36 | run_command, uses_alias, working_directory, step_env, |
| 37 | continue_on_error, status, conclusion, log_object_key, |
| 38 | log_byte_count, started_at, completed_at, version, |
| 39 | created_at, updated_at, step_with; |
| 40 | |
| 41 | -- name: UpdateWorkflowStepLogObject :one |
| 42 | UPDATE workflow_steps |
| 43 | SET log_object_key = sqlc.narg(log_object_key)::text, |
| 44 | log_byte_count = sqlc.arg(log_byte_count)::bigint, |
| 45 | version = version + 1, |
| 46 | updated_at = now() |
| 47 | WHERE id = sqlc.arg(id)::bigint |
| 48 | RETURNING id, job_id, step_index, step_id, step_name, if_expr, |
| 49 | run_command, uses_alias, working_directory, step_env, |
| 50 | continue_on_error, status, conclusion, log_object_key, |
| 51 | log_byte_count, started_at, completed_at, version, |
| 52 | created_at, updated_at, step_with; |
| 53 | |
| 54 | -- name: ListRunnerStepsForJob :many |
| 55 | SELECT id, job_id, step_index, step_id, step_name, if_expr, |
| 56 | run_command, uses_alias, working_directory, step_env, |
| 57 | continue_on_error, status, conclusion, log_byte_count, |
| 58 | started_at, completed_at, created_at, step_with |
| 59 | FROM workflow_steps |
| 60 | WHERE job_id = $1 |
| 61 | ORDER BY step_index ASC; |
| 62 | |
| 63 | -- name: GetFirstStepForJob :one |
| 64 | SELECT id, job_id, step_index, step_id, step_name, if_expr, |
| 65 | run_command, uses_alias, working_directory, step_env, |
| 66 | continue_on_error, status, conclusion, log_object_key, |
| 67 | log_byte_count, started_at, completed_at, version, |
| 68 | created_at, updated_at, step_with |
| 69 | FROM workflow_steps |
| 70 | WHERE job_id = $1 |
| 71 | ORDER BY step_index ASC |
| 72 | LIMIT 1; |
| 73 | |
| 74 | -- name: ListStepsForJob :many |
| 75 | SELECT id, job_id, step_index, step_id, step_name, run_command, |
| 76 | uses_alias, status, conclusion, log_byte_count, |
| 77 | started_at, completed_at, created_at |
| 78 | FROM workflow_steps |
| 79 | WHERE job_id = $1 |
| 80 | ORDER BY step_index ASC; |
| 81 |