|
| 1 | +CREATETYPEapp_cors_behaviorAS ENUM ( |
| 2 | +'simple', |
| 3 | +'passthru' |
| 4 | +); |
| 5 | + |
| 6 | +ALTERTABLE templates |
| 7 | +ADD COLUMN cors_behavior cors_behaviorNOT NULL DEFAULT'simple'::cors_behavior; |
| 8 | + |
| 9 | +-- Update the template_with_users view by recreating it. |
| 10 | +DROPVIEW IF EXISTS template_with_names; |
| 11 | +CREATEVIEWtemplate_with_namesAS |
| 12 | +SELECTtemplates.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_usersON ((templates.created_by=visible_users.id))) |
| 50 | +LEFT JOIN organizationsON ((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.'; |