mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
* Add workspace preset tables to the database in a migration * Add queries to manipulate workspace presets to the database * Generate db related code for the newly added queries * Implement new methods to satisfy the Querier interface in dbauthz, dbmem, dbmock and querymetrics * Implement the required tests for dbauthz * Update the audit table to track changes to the new column in workspace builds
26 lines
692 B
SQL
26 lines
692 B
SQL
-- Recreate the view to exclude the new column.
|
|
DROP VIEW workspace_build_with_user;
|
|
|
|
ALTER TABLE workspace_builds
|
|
DROP COLUMN template_version_preset_id;
|
|
|
|
DROP TABLE template_version_preset_parameters;
|
|
|
|
DROP TABLE template_version_presets;
|
|
|
|
CREATE VIEW
|
|
workspace_build_with_user
|
|
AS
|
|
SELECT
|
|
workspace_builds.*,
|
|
coalesce(visible_users.avatar_url, '') AS initiator_by_avatar_url,
|
|
coalesce(visible_users.username, '') AS initiator_by_username
|
|
FROM
|
|
workspace_builds
|
|
LEFT JOIN
|
|
visible_users
|
|
ON
|
|
workspace_builds.initiator_id = visible_users.id;
|
|
|
|
COMMENT ON VIEW workspace_build_with_user IS 'Joins in the username + avatar url of the initiated by user.';
|