mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
fix: Allow template names to be re-used after deletion (#2454)
Fixes #2152
This commit is contained in:
committed by
GitHub
parent
289b98978f
commit
17ba4c8e88
7
coderd/database/dump.sql
generated
7
coderd/database/dump.sql
generated
@ -399,9 +399,6 @@ ALTER TABLE ONLY template_versions
|
||||
ALTER TABLE ONLY template_versions
|
||||
ADD CONSTRAINT template_versions_template_id_name_key UNIQUE (template_id, name);
|
||||
|
||||
ALTER TABLE ONLY templates
|
||||
ADD CONSTRAINT templates_organization_id_name_key UNIQUE (organization_id, name);
|
||||
|
||||
ALTER TABLE ONLY templates
|
||||
ADD CONSTRAINT templates_pkey PRIMARY KEY (id);
|
||||
|
||||
@ -453,13 +450,11 @@ CREATE UNIQUE INDEX idx_organization_name ON organizations USING btree (name);
|
||||
|
||||
CREATE UNIQUE INDEX idx_organization_name_lower ON organizations USING btree (lower(name));
|
||||
|
||||
CREATE UNIQUE INDEX idx_templates_name_lower ON templates USING btree (lower((name)::text));
|
||||
|
||||
CREATE UNIQUE INDEX idx_users_email ON users USING btree (email);
|
||||
|
||||
CREATE UNIQUE INDEX idx_users_username ON users USING btree (username);
|
||||
|
||||
CREATE UNIQUE INDEX templates_organization_id_name_idx ON templates USING btree (organization_id, name) WHERE (deleted = false);
|
||||
CREATE UNIQUE INDEX templates_organization_id_name_idx ON templates USING btree (organization_id, lower((name)::text)) WHERE (deleted = false);
|
||||
|
||||
CREATE UNIQUE INDEX users_username_lower_idx ON users USING btree (lower(username));
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
DROP INDEX templates_organization_id_name_idx;
|
||||
CREATE UNIQUE INDEX templates_organization_id_name_idx ON templates USING btree (organization_id, name) WHERE deleted = false;
|
||||
CREATE UNIQUE INDEX idx_templates_name_lower ON templates USING btree (lower(name));
|
||||
|
||||
ALTER TABLE ONLY templates ADD CONSTRAINT templates_organization_id_name_key UNIQUE (organization_id, name);
|
@ -0,0 +1,5 @@
|
||||
DROP INDEX idx_templates_name_lower;
|
||||
DROP INDEX templates_organization_id_name_idx;
|
||||
CREATE UNIQUE INDEX templates_organization_id_name_idx ON templates (organization_id, lower(name)) WHERE deleted = false;
|
||||
|
||||
ALTER TABLE ONLY templates DROP CONSTRAINT templates_organization_id_name_key;
|
Reference in New Issue
Block a user