|
| 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; |
0 commit comments