Skip to content

Commit 59ccee1

Browse files
committed
chore: rename ai_tasks_sidebar_app_id to ai_task_sidebar_app_id
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
1 parent 8a17eff commit 59ccee1

File tree

9 files changed

+128
-30
lines changed

9 files changed

+128
-30
lines changed

coderd/database/dump.sql

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/foreign_key_constraint.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
-- Revert ai_task_sidebar_app_id back to ai_tasks_sidebar_app_id in workspace_builds table
2+
ALTER TABLE workspace_builds DROP CONSTRAINT workspace_builds_ai_task_sidebar_app_id_fkey;
3+
4+
ALTER TABLE workspace_builds RENAME COLUMN ai_task_sidebar_app_id TO ai_tasks_sidebar_app_id;
5+
6+
ALTER TABLE workspace_builds ADD CONSTRAINT workspace_builds_ai_tasks_sidebar_app_id_fkey FOREIGN KEY (ai_tasks_sidebar_app_id) REFERENCES workspace_apps(id);
7+
8+
-- Revert the workspace_build_with_user view to use the original column name
9+
DROP VIEW workspace_build_with_user;
10+
11+
CREATE VIEW workspace_build_with_user AS
12+
SELECT
13+
workspace_builds.id,
14+
workspace_builds.created_at,
15+
workspace_builds.updated_at,
16+
workspace_builds.workspace_id,
17+
workspace_builds.template_version_id,
18+
workspace_builds.build_number,
19+
workspace_builds.transition,
20+
workspace_builds.initiator_id,
21+
workspace_builds.provisioner_state,
22+
workspace_builds.job_id,
23+
workspace_builds.deadline,
24+
workspace_builds.reason,
25+
workspace_builds.daily_cost,
26+
workspace_builds.max_deadline,
27+
workspace_builds.template_version_preset_id,
28+
workspace_builds.has_ai_task,
29+
workspace_builds.ai_tasks_sidebar_app_id,
30+
COALESCE(
31+
visible_users.avatar_url,
32+
'' :: text
33+
) AS initiator_by_avatar_url,
34+
COALESCE(
35+
visible_users.username,
36+
'' :: text
37+
) AS initiator_by_username,
38+
COALESCE(visible_users.name, '' :: text) AS initiator_by_name
39+
FROM
40+
(
41+
workspace_builds
42+
LEFT JOIN visible_users ON (
43+
(
44+
workspace_builds.initiator_id = visible_users.id
45+
)
46+
)
47+
);
48+
49+
COMMENT ON VIEW workspace_build_with_user IS 'Joins in the username + avatar url of the initiated by user.';
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
-- Rename ai_tasks_sidebar_app_id to ai_task_sidebar_app_id in workspace_builds table
2+
ALTER TABLE workspace_builds DROP CONSTRAINT workspace_builds_ai_tasks_sidebar_app_id_fkey;
3+
4+
ALTER TABLE workspace_builds RENAME COLUMN ai_tasks_sidebar_app_id TO ai_task_sidebar_app_id;
5+
6+
ALTER TABLE workspace_builds ADD CONSTRAINT workspace_builds_ai_task_sidebar_app_id_fkey FOREIGN KEY (ai_task_sidebar_app_id) REFERENCES workspace_apps(id);
7+
8+
-- Update the workspace_build_with_user view to use the new column name
9+
DROP VIEW workspace_build_with_user;
10+
11+
CREATE VIEW workspace_build_with_user AS
12+
SELECT
13+
workspace_builds.id,
14+
workspace_builds.created_at,
15+
workspace_builds.updated_at,
16+
workspace_builds.workspace_id,
17+
workspace_builds.template_version_id,
18+
workspace_builds.build_number,
19+
workspace_builds.transition,
20+
workspace_builds.initiator_id,
21+
workspace_builds.provisioner_state,
22+
workspace_builds.job_id,
23+
workspace_builds.deadline,
24+
workspace_builds.reason,
25+
workspace_builds.daily_cost,
26+
workspace_builds.max_deadline,
27+
workspace_builds.template_version_preset_id,
28+
workspace_builds.has_ai_task,
29+
workspace_builds.ai_task_sidebar_app_id,
30+
COALESCE(
31+
visible_users.avatar_url,
32+
'' :: text
33+
) AS initiator_by_avatar_url,
34+
COALESCE(
35+
visible_users.username,
36+
'' :: text
37+
) AS initiator_by_username,
38+
COALESCE(visible_users.name, '' :: text) AS initiator_by_name
39+
FROM
40+
(
41+
workspace_builds
42+
LEFT JOIN visible_users ON (
43+
(
44+
workspace_builds.initiator_id = visible_users.id
45+
)
46+
)
47+
);
48+
49+
COMMENT ON VIEW workspace_build_with_user IS 'Joins in the username + avatar url of the initiated by user.';

coderd/database/models.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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