mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd): use task data model when creating a new task (#20275)
Updates coder/internal#976
This commit is contained in:
@@ -5,6 +5,25 @@ VALUES
|
||||
(gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8)
|
||||
RETURNING *;
|
||||
|
||||
-- name: UpdateTaskWorkspaceID :one
|
||||
UPDATE
|
||||
tasks
|
||||
SET
|
||||
workspace_id = $2
|
||||
FROM
|
||||
workspaces w
|
||||
JOIN
|
||||
template_versions tv
|
||||
ON
|
||||
tv.template_id = w.template_id
|
||||
WHERE
|
||||
tasks.id = $1
|
||||
AND tasks.workspace_id IS NULL
|
||||
AND w.id = $2
|
||||
AND tv.id = tasks.template_version_id
|
||||
RETURNING
|
||||
tasks.*;
|
||||
|
||||
-- name: UpsertTaskWorkspaceApp :one
|
||||
INSERT INTO task_workspace_apps
|
||||
(task_id, workspace_build_number, workspace_agent_id, workspace_app_id)
|
||||
|
||||
Reference in New Issue
Block a user