Skip to content

Commit 101e894

Browse files
committed
add ai tasks migrations
1 parent 949ab4b commit 101e894

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy