File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
coderd/database/migrations Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ DROP INDEX idx_template_versions_has_ai_task;
2
+
3
+ ALTER TABLE
4
+ template_versions DROP COLUMN has_ai_task;
5
+
6
+ ALTER TABLE
7
+ workspace_builds DROP CONSTRAINT workspace_builds_ai_tasks_sidebar_app_id_fkey;
8
+
9
+ ALTER TABLE
10
+ workspace_builds DROP COLUMN ai_tasks_sidebar_app_id;
11
+
12
+ ALTER TABLE
13
+ workspace_builds DROP COLUMN has_ai_task;
Original file line number Diff line number Diff line change
1
+ -- Determines if a coder_ai_task resource was included in a
2
+ -- workspace build.
3
+ ALTER TABLE
4
+ workspace_builds
5
+ ADD
6
+ COLUMN has_ai_task BOOLEAN NOT NULL DEFAULT FALSE;
7
+
8
+ -- The app that is displayed in the ai tasks sidebar.
9
+ ALTER TABLE
10
+ workspace_builds
11
+ ADD
12
+ COLUMN ai_tasks_sidebar_app_id UUID DEFAULT NULL ;
13
+
14
+ ALTER TABLE
15
+ workspace_builds
16
+ ADD
17
+ CONSTRAINT workspace_builds_ai_tasks_sidebar_app_id_fkey FOREIGN KEY (ai_tasks_sidebar_app_id) REFERENCES workspace_apps(id);
18
+
19
+ -- Determines if a coder_ai_task resource is defined in a template version.
20
+ ALTER TABLE
21
+ template_versions
22
+ ADD
23
+ COLUMN has_ai_task BOOLEAN NOT NULL DEFAULT FALSE;
24
+
25
+ -- The Tasks tab will be rendered in the UI only if there's at least one template version with has_ai_task set to true.
26
+ -- The query to determine this will be run on every UI render, and this index speeds it up.
27
+ -- SELECT EXISTS (SELECT 1 FROM template_versions WHERE has_ai_task = TRUE);
28
+ CREATE INDEX idx_template_versions_has_ai_task ON template_versions USING btree (has_ai_task);
You can’t perform that action at this time.
0 commit comments