feat: store coder_workspace_tags in the database (#13294)

This commit is contained in:
Marcin Tojek
2024-05-20 15:30:19 +02:00
committed by GitHub
parent 45b45f1107
commit b8b80fe6d2
30 changed files with 1052 additions and 397 deletions
+12
View File
@@ -943,6 +943,12 @@ CREATE VIEW template_version_with_user AS
COMMENT ON VIEW template_version_with_user IS 'Joins in the username + avatar url of the created by user.';
CREATE TABLE template_version_workspace_tags (
template_version_id uuid NOT NULL,
key text NOT NULL,
value text NOT NULL
);
CREATE TABLE templates (
id uuid NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -1536,6 +1542,9 @@ ALTER TABLE ONLY template_version_parameters
ALTER TABLE ONLY template_version_variables
ADD CONSTRAINT template_version_variables_template_version_id_name_key UNIQUE (template_version_id, name);
ALTER TABLE ONLY template_version_workspace_tags
ADD CONSTRAINT template_version_workspace_tags_template_version_id_key_key UNIQUE (template_version_id, key);
ALTER TABLE ONLY template_versions
ADD CONSTRAINT template_versions_pkey PRIMARY KEY (id);
@@ -1797,6 +1806,9 @@ ALTER TABLE ONLY template_version_parameters
ALTER TABLE ONLY template_version_variables
ADD CONSTRAINT template_version_variables_template_version_id_fkey FOREIGN KEY (template_version_id) REFERENCES template_versions(id) ON DELETE CASCADE;
ALTER TABLE ONLY template_version_workspace_tags
ADD CONSTRAINT template_version_workspace_tags_template_version_id_fkey FOREIGN KEY (template_version_id) REFERENCES template_versions(id) ON DELETE CASCADE;
ALTER TABLE ONLY template_versions
ADD CONSTRAINT template_versions_created_by_fkey FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE RESTRICT;