Skip to content

Commit 94e423b

Browse files
committed
wip
Signed-off-by: Callum Styan <callumstyan@gmail.com>
1 parent 3dcd2ac commit 94e423b

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
templates.use_classic_parameter_flow,
32+
COALESCE(visible_users.avatar_url, ''::text) AS created_by_avatar_url,
33+
COALESCE(visible_users.username, ''::text) AS created_by_username,
34+
COALESCE(visible_users.name, ''::text) AS created_by_name,
35+
COALESCE(organizations.name, ''::text) AS organization_name,
36+
COALESCE(organizations.display_name, ''::text) AS organization_display_name,
37+
COALESCE(organizations.icon, ''::text) AS organization_icon
38+
FROM ((templates
39+
LEFT JOIN visible_users ON ((templates.created_by = visible_users.id)))
40+
LEFT JOIN organizations ON ((templates.organization_id = organizations.id)));
41+
42+
COMMENT ON VIEW template_with_names IS 'Joins in the display name information such as username, avatar, and organization name.';
43+
44+
ALTER TABLE templates DROP COLUMN cors_behavior;
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
CREATE TYPE app_cors_behavior AS ENUM (
2+
'simple',
3+
'passthru'
4+
);
5+
6+
ALTER TABLE templates
7+
ADD COLUMN cors_behavior cors_behavior NOT NULL DEFAULT 'simple'::cors_behavior;
8+
9+
-- Update the template_with_users view by recreating it.
10+
DROP VIEW IF EXISTS template_with_names;
11+
CREATE VIEW template_with_names AS
12+
SELECT templates.id,
13+
templates.created_at,
14+
templates.updated_at,
15+
templates.organization_id,
16+
templates.deleted,
17+
templates.name,
18+
templates.provisioner,
19+
templates.active_version_id,
20+
templates.description,
21+
templates.default_ttl,
22+
templates.created_by,
23+
templates.icon,
24+
templates.user_acl,
25+
templates.group_acl,
26+
templates.display_name,
27+
templates.allow_user_cancel_workspace_jobs,
28+
templates.allow_user_autostart,
29+
templates.allow_user_autostop,
30+
templates.failure_ttl,
31+
templates.time_til_dormant,
32+
templates.time_til_dormant_autodelete,
33+
templates.autostop_requirement_days_of_week,
34+
templates.autostop_requirement_weeks,
35+
templates.autostart_block_days_of_week,
36+
templates.require_active_version,
37+
templates.deprecated,
38+
templates.activity_bump,
39+
templates.max_port_sharing_level,
40+
templates.use_classic_parameter_flow,
41+
templates.cors_behavior, -- <--- adding this column
42+
COALESCE(visible_users.avatar_url, ''::text) AS created_by_avatar_url,
43+
COALESCE(visible_users.username, ''::text) AS created_by_username,
44+
COALESCE(visible_users.name, ''::text) AS created_by_name,
45+
COALESCE(organizations.name, ''::text) AS organization_name,
46+
COALESCE(organizations.display_name, ''::text) AS organization_display_name,
47+
COALESCE(organizations.icon, ''::text) AS organization_icon
48+
FROM ((templates
49+
LEFT JOIN visible_users ON ((templates.created_by = visible_users.id)))
50+
LEFT JOIN organizations ON ((templates.organization_id = organizations.id)));
51+
52+
COMMENT ON VIEW template_with_names IS 'Joins in the display name information such as username, avatar, and organization name.';

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