From 92c217bd854ea6ed1477727654cb7e437302daa1 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 1 Dec 2022 19:29:05 -0600 Subject: [PATCH] fix: add index on `workspace_agents.auth_token` (#5244) --- coderd/database/dump.sql | 2 ++ .../000084_workspace_agents_auth_token_index.down.sql | 1 + .../migrations/000084_workspace_agents_auth_token_index.up.sql | 1 + 3 files changed, 4 insertions(+) create mode 100644 coderd/database/migrations/000084_workspace_agents_auth_token_index.down.sql create mode 100644 coderd/database/migrations/000084_workspace_agents_auth_token_index.up.sql diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index c598280397..9b87b15661 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -641,6 +641,8 @@ CREATE UNIQUE INDEX users_email_lower_idx ON users USING btree (lower(email)) WH CREATE UNIQUE INDEX users_username_lower_idx ON users USING btree (lower(username)) WHERE (deleted = false); +CREATE INDEX workspace_agents_auth_token_idx ON workspace_agents USING btree (auth_token); + CREATE INDEX workspace_agents_resource_id_idx ON workspace_agents USING btree (resource_id); CREATE INDEX workspace_resources_job_id_idx ON workspace_resources USING btree (job_id); diff --git a/coderd/database/migrations/000084_workspace_agents_auth_token_index.down.sql b/coderd/database/migrations/000084_workspace_agents_auth_token_index.down.sql new file mode 100644 index 0000000000..9d8d5589a6 --- /dev/null +++ b/coderd/database/migrations/000084_workspace_agents_auth_token_index.down.sql @@ -0,0 +1 @@ +DROP INDEX workspace_agents_auth_token_idx; diff --git a/coderd/database/migrations/000084_workspace_agents_auth_token_index.up.sql b/coderd/database/migrations/000084_workspace_agents_auth_token_index.up.sql new file mode 100644 index 0000000000..d0cf61f652 --- /dev/null +++ b/coderd/database/migrations/000084_workspace_agents_auth_token_index.up.sql @@ -0,0 +1 @@ +CREATE INDEX workspace_agents_auth_token_idx ON workspace_agents USING btree (auth_token);