mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix(coderd/database): ensure task name uniqueness (#20236)
This change ensures task names are unique per user the same way we do for workspaces. This ensures we don't create tasks that are impossible to start due to another task being named the same creating a workspace name conflict. Updates coder/internal#948 Supersedes coder/coder#20212
This commit is contained in:
committed by
GitHub
parent
952c69f412
commit
5dc57da6b4
Generated
+4
@@ -3345,6 +3345,10 @@ CREATE INDEX tasks_organization_id_idx ON tasks USING btree (organization_id);
|
||||
|
||||
CREATE INDEX tasks_owner_id_idx ON tasks USING btree (owner_id);
|
||||
|
||||
CREATE UNIQUE INDEX tasks_owner_id_name_unique_idx ON tasks USING btree (owner_id, lower(name)) WHERE (deleted_at IS NULL);
|
||||
|
||||
COMMENT ON INDEX tasks_owner_id_name_unique_idx IS 'Index to ensure uniqueness for task owner/name';
|
||||
|
||||
CREATE INDEX tasks_workspace_id_idx ON tasks USING btree (workspace_id);
|
||||
|
||||
CREATE INDEX template_usage_stats_start_time_idx ON template_usage_stats USING btree (start_time DESC);
|
||||
|
||||
Reference in New Issue
Block a user