Skip to content

Commit 7fa1112

Browse files
authored
chore: Enforce workspace proxy unique name case insensitive (#7202)
* chore: Enforce workspace proxy unique name case insensitive
1 parent 9abfe97 commit 7fa1112

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

coderd/database/dump.sql

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
BEGIN;
2+
3+
DROP INDEX IF EXISTS workspace_proxies_lower_name_idx;
4+
5+
-- Enforces no active proxies have the same name.
6+
CREATE UNIQUE INDEX ON workspace_proxies (name) WHERE deleted = FALSE;
7+
8+
COMMIT;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
BEGIN;
2+
3+
-- No one is using this feature yet as of writing this migration, so this is
4+
-- fine. Just delete all workspace proxies to prevent the new index from having
5+
-- conflicts.
6+
DELETE FROM workspace_proxies;
7+
8+
DROP INDEX IF EXISTS workspace_proxies_name_idx;
9+
CREATE UNIQUE INDEX workspace_proxies_lower_name_idx ON workspace_proxies USING btree (lower(name)) WHERE deleted = FALSE;
10+
11+
COMMIT;

coderd/database/unique_constraint.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)