chore: add form_type parameter argument to db (#17920)

`form_type` is a new parameter field in the terraform provider. Bring
that field into coder/coder.

Validation for `multi-select` has also been added.
This commit is contained in:
Steven Masley
2025-05-29 08:55:19 -05:00
committed by GitHub
parent 776c144128
commit 8387dd27ab
35 changed files with 1556 additions and 822 deletions
+19
View File
@@ -132,6 +132,22 @@ CREATE TYPE parameter_destination_scheme AS ENUM (
'provisioner_variable'
);
CREATE TYPE parameter_form_type AS ENUM (
'',
'error',
'radio',
'dropdown',
'input',
'textarea',
'slider',
'checkbox',
'switch',
'tag-select',
'multi-select'
);
COMMENT ON TYPE parameter_form_type IS 'Enum set should match the terraform provider set. This is defined as future form_types are not supported, and should be rejected. Always include the empty string for using the default form type.';
CREATE TYPE parameter_scope AS ENUM (
'template',
'import_job',
@@ -1434,6 +1450,7 @@ CREATE TABLE template_version_parameters (
display_name text DEFAULT ''::text NOT NULL,
display_order integer DEFAULT 0 NOT NULL,
ephemeral boolean DEFAULT false NOT NULL,
form_type parameter_form_type DEFAULT ''::parameter_form_type NOT NULL,
CONSTRAINT validation_monotonic_order CHECK ((validation_monotonic = ANY (ARRAY['increasing'::text, 'decreasing'::text, ''::text])))
);
@@ -1469,6 +1486,8 @@ COMMENT ON COLUMN template_version_parameters.display_order IS 'Specifies the or
COMMENT ON COLUMN template_version_parameters.ephemeral IS 'The value of an ephemeral parameter will not be preserved between consecutive workspace builds.';
COMMENT ON COLUMN template_version_parameters.form_type IS 'Specify what form_type should be used to render the parameter in the UI. Unsupported values are rejected.';
CREATE TABLE template_version_preset_parameters (
id uuid DEFAULT gen_random_uuid() NOT NULL,
template_version_preset_id uuid NOT NULL,