fix(coderd/database): add fk index for `workspace_agent_scripts` (#12791)

This commit is contained in:
Mathias Fredriksson 2024-03-28 14:31:58 +02:00 committed by GitHub
parent d734f3fb74
commit d50c20c453
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 0 deletions

View File

@ -1648,6 +1648,10 @@ 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_agent_scripts_workspace_agent_id_idx ON workspace_agent_scripts USING btree (workspace_agent_id);
COMMENT ON INDEX workspace_agent_scripts_workspace_agent_id_idx IS 'Foreign key support index for faster lookups';
CREATE INDEX workspace_agent_startup_logs_id_agent_id_idx ON workspace_agent_logs USING btree (agent_id, id);
CREATE INDEX workspace_agent_stats_template_id_created_at_user_id_idx ON workspace_agent_stats USING btree (template_id, created_at, user_id) INCLUDE (session_count_vscode, session_count_jetbrains, session_count_reconnecting_pty, session_count_ssh, connection_median_latency_ms) WHERE (connection_count > 0);

View File

@ -0,0 +1 @@
DROP INDEX workspace_agent_scripts_workspace_agent_id_idx;

View File

@ -0,0 +1,3 @@
CREATE INDEX workspace_agent_scripts_workspace_agent_id_idx ON workspace_agent_scripts (workspace_agent_id);
COMMENT ON INDEX workspace_agent_scripts_workspace_agent_id_idx IS 'Foreign key support index for faster lookups';