Files
agentic-coding-workflow/internal/run/queries/run_profiles.sql
T
2026-06-09 22:43:29 +08:00

46 lines
1.1 KiB
SQL

-- name: CreateRunProfile :one
INSERT INTO workspace_run_profiles (
id, workspace_id, slug, name, description, command, args, encrypted_env, enabled, created_by
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)
RETURNING *;
-- name: GetRunProfileByID :one
SELECT * FROM workspace_run_profiles WHERE id = $1;
-- name: ListRunProfilesByWorkspace :many
SELECT * FROM workspace_run_profiles
WHERE workspace_id = $1
ORDER BY created_at;
-- name: UpdateRunProfile :one
UPDATE workspace_run_profiles
SET slug = $2,
name = $3,
description = $4,
command = $5,
args = $6,
encrypted_env = $7,
enabled = $8,
updated_at = now()
WHERE id = $1
RETURNING *;
-- name: DeleteRunProfile :exec
DELETE FROM workspace_run_profiles WHERE id = $1;
-- name: MarkRunProfileStarted :one
UPDATE workspace_run_profiles
SET last_started_at = now(),
last_exit_code = NULL,
last_error = '',
updated_at = now()
WHERE id = $1
RETURNING *;
-- name: UpdateRunProfileExit :exec
UPDATE workspace_run_profiles
SET last_exit_code = $2,
last_error = $3,
updated_at = now()
WHERE id = $1;