Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
>:(
  • Loading branch information
aslilac committed Mar 20, 2025
commit 11d20d5e6ceb0abe1b423ec6a9bf181d5fea85d0
28 changes: 9 additions & 19 deletions coderd/database/queries/templateversions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ LIMIT

-- name: GetTemplateVersionByJobID :one
SELECT
id, template_id, organization_id, created_at, updated_at, name, readme,
job_id, created_by, external_auth_providers, message, archived,
source_example_id, created_by_avatar_url, created_by_username
*
FROM
template_version_with_user AS template_versions
WHERE
Expand All @@ -54,9 +52,7 @@ SELECT * FROM template_version_with_user AS template_versions WHERE created_at >

-- name: GetTemplateVersionByTemplateIDAndName :one
SELECT
id, template_id, organization_id, created_at, updated_at, name, readme,
job_id, created_by, external_auth_providers, message, archived,
source_example_id, created_by_avatar_url, created_by_username
*
FROM
template_version_with_user AS template_versions
WHERE
Expand All @@ -65,19 +61,15 @@ WHERE

-- name: GetTemplateVersionByID :one
SELECT
id, template_id, organization_id, created_at, updated_at, name, readme,
job_id, created_by, external_auth_providers, message, archived,
source_example_id, created_by_avatar_url, created_by_username
*
FROM
template_version_with_user AS template_versions
WHERE
id = $1;

-- name: GetTemplateVersionsByIDs :many
SELECT
id, template_id, organization_id, created_at, updated_at, name, readme,
job_id, created_by, external_auth_providers, message, archived,
source_example_id, created_by_avatar_url, created_by_username
*
FROM
template_version_with_user AS template_versions
WHERE
Expand Down Expand Up @@ -125,16 +117,14 @@ WHERE
UPDATE
template_versions
SET
external_auth_providers = @external_auth_providers,
updated_at = @updated_at
external_auth_providers = $2,
updated_at = $3
WHERE
job_id = @job_id;
job_id = $1;

-- name: GetPreviousTemplateVersion :one
SELECT
id, template_id, organization_id, created_at, updated_at, name, readme,
job_id, created_by, external_auth_providers, message, archived,
source_example_id, created_by_avatar_url, created_by_username
*
FROM
template_version_with_user AS template_versions
WHERE
Expand Down Expand Up @@ -178,7 +168,7 @@ FROM
-- Scope an archive to a single template and ignore already archived template versions
(
SELECT
id, job_id, template_id
*
FROM
template_versions
WHERE
Expand Down
Loading