|
| 1 | +DROPVIEW IF EXISTS template_with_names; |
| 2 | +CREATEVIEWtemplate_with_namesAS |
| 3 | +SELECTtemplates.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_usersON ((templates.created_by=visible_users.id))) |
| 38 | +LEFT JOIN organizationsON ((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 | +ALTERTABLE templates DROP COLUMN cors_behavior; |