mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Allow inheriting parameters from previous template_versions when updating a template (#2397)
* WIP: feat: Update templates also updates parameters * Insert params for template version update * Working implementation of inherited params * Add "--always-prompt" flag and logging info
This commit is contained in:
@@ -1,17 +1,43 @@
|
||||
-- name: ParameterValue :one
|
||||
SELECT * FROM
|
||||
parameter_values
|
||||
WHERE
|
||||
id = $1;
|
||||
|
||||
|
||||
-- name: DeleteParameterValueByID :exec
|
||||
DELETE FROM
|
||||
parameter_values
|
||||
WHERE
|
||||
id = $1;
|
||||
|
||||
-- name: GetParameterValuesByScope :many
|
||||
-- name: ParameterValues :many
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
parameter_values
|
||||
WHERE
|
||||
scope = $1
|
||||
AND scope_id = $2;
|
||||
CASE
|
||||
WHEN cardinality(@scopes :: parameter_scope[]) > 0 THEN
|
||||
scope = ANY(@scopes :: parameter_scope[])
|
||||
ELSE true
|
||||
END
|
||||
AND CASE
|
||||
WHEN cardinality(@scope_ids :: uuid[]) > 0 THEN
|
||||
scope_id = ANY(@scope_ids :: uuid[])
|
||||
ELSE true
|
||||
END
|
||||
AND CASE
|
||||
WHEN cardinality(@ids :: uuid[]) > 0 THEN
|
||||
id = ANY(@ids :: uuid[])
|
||||
ELSE true
|
||||
END
|
||||
AND CASE
|
||||
WHEN cardinality(@names :: text[]) > 0 THEN
|
||||
"name" = ANY(@names :: text[])
|
||||
ELSE true
|
||||
END
|
||||
;
|
||||
|
||||
-- name: GetParameterValueByScopeAndName :one
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user