Skip to content

Commit c074238

Browse files
committed
Minor fixups
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent 520a1ca commit c074238

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
DROP VIEW IF EXISTS template_with_names;
2+
CREATE VIEW template_with_names AS
3+
SELECT templates.id,
4+
templates.created_at,
5+
templates.updated_at,
6+
templates.organization_id,
7+
templates.deleted,
8+
templates.name,
9+
templates.provisioner,
10+
templates.active_version_id,
11+
templates.description,
12+
templates.default_ttl,
13+
templates.created_by,
14+
templates.icon,
15+
templates.user_acl,
16+
templates.group_acl,
17+
templates.display_name,
18+
templates.allow_user_cancel_workspace_jobs,
19+
templates.allow_user_autostart,
20+
templates.allow_user_autostop,
21+
templates.failure_ttl,
22+
templates.time_til_dormant,
23+
templates.time_til_dormant_autodelete,
24+
templates.autostop_requirement_days_of_week,
25+
templates.autostop_requirement_weeks,
26+
templates.autostart_block_days_of_week,
27+
templates.require_active_version,
28+
templates.deprecated,
29+
templates.activity_bump,
30+
templates.max_port_sharing_level,
31+
COALESCE(visible_users.avatar_url, ''::text) AS created_by_avatar_url,
32+
COALESCE(visible_users.username, ''::text) AS created_by_username,
33+
COALESCE(organizations.name, ''::text) AS organization_name,
34+
COALESCE(organizations.display_name, ''::text) AS organization_display_name,
35+
COALESCE(organizations.icon, ''::text) AS organization_icon
36+
FROM ((templates
37+
LEFT JOIN visible_users ON ((templates.created_by = visible_users.id)))
38+
LEFT JOIN organizations ON ((templates.organization_id = organizations.id)));
39+
40+
COMMENT ON VIEW template_with_names IS 'Joins in the display name information such as username, avatar, and organization name.';
41+
42+
ALTER TABLE templates DROP COLUMN cors_behavior;

coderd/database/migrations/000279_template_level_cors.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ CREATE VIEW template_with_names AS
3232
templates.deprecated,
3333
templates.activity_bump,
3434
templates.max_port_sharing_level,
35-
templates.cors_behavior,
35+
templates.cors_behavior, -- <--- adding this column
3636
COALESCE(visible_users.avatar_url, ''::text) AS created_by_avatar_url,
3737
COALESCE(visible_users.username, ''::text) AS created_by_username,
3838
COALESCE(organizations.name, ''::text) AS organization_name,

0 commit comments

Comments
 (0)