mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
adds support for workspace presets to the coderd database. Support in the API and web frontend will be added in subsequent pull requests. This is the smallest meaningful contribution that I could get passing tests for.
* 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
This commit is contained in:
33
coderd/database/migrations/testdata/fixtures/000288_workspace_parameter_presets.up.sql
vendored
Normal file
33
coderd/database/migrations/testdata/fixtures/000288_workspace_parameter_presets.up.sql
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
-- Organization
|
||||
INSERT INTO organizations (id, name, description, display_name, created_at, updated_at)
|
||||
VALUES ('d3fd38d2-ffc3-4ec2-8cfc-9c8dab6d9a74', 'Test Org', 'Test Organization', 'Test Org', now(), now());
|
||||
|
||||
-- User
|
||||
INSERT INTO users (id, email, username, created_at, updated_at, status, rbac_roles, login_type, hashed_password)
|
||||
VALUES ('1f573504-f7a0-4498-8b81-2e1939f3c4a2', 'test@coder.com', 'testuser', now(), now(), 'active', '{}', 'password', 'password');
|
||||
|
||||
-- Template
|
||||
INSERT INTO templates (id, created_by, organization_id, created_at, updated_at, deleted, name, provisioner, active_version_id, description)
|
||||
VALUES ('0bd0713b-176a-4864-a58b-546a1b021025', '1f573504-f7a0-4498-8b81-2e1939f3c4a2', 'd3fd38d2-ffc3-4ec2-8cfc-9c8dab6d9a74', now(), now(), false, 'test-template', 'terraform', null, 'Test template');
|
||||
|
||||
-- Template Version
|
||||
INSERT INTO template_versions (id, template_id, organization_id, created_by, created_at, updated_at, name, job_id, readme, message)
|
||||
VALUES ('f1276e15-01cd-406d-8ea5-64f113a79601', '0bd0713b-176a-4864-a58b-546a1b021025', 'd3fd38d2-ffc3-4ec2-8cfc-9c8dab6d9a74', '1f573504-f7a0-4498-8b81-2e1939f3c4a2', now(), now(), 'test-version', null, '', '');
|
||||
|
||||
-- Workspace
|
||||
INSERT INTO workspaces (id, organization_id, owner_id, template_id, created_at, updated_at, name, deleted, automatic_updates)
|
||||
VALUES ('8cb0b7c4-47b5-4bfc-ad92-88ccc61f3c12', 'd3fd38d2-ffc3-4ec2-8cfc-9c8dab6d9a74', '1f573504-f7a0-4498-8b81-2e1939f3c4a2', '0bd0713b-176a-4864-a58b-546a1b021025', now(), now(), 'test-workspace', false, 'never');
|
||||
|
||||
-- Provisioner Job
|
||||
INSERT INTO provisioner_jobs (id, organization_id, created_at, updated_at, status, worker_id, error, started_at)
|
||||
VALUES ('50ebe702-82e5-4053-859d-c24a3b742b57', 'd3fd38d2-ffc3-4ec2-8cfc-9c8dab6d9a74', now(), now(), 'pending', null, null, null);
|
||||
|
||||
-- Workspace Build
|
||||
INSERT INTO workspace_builds (id, workspace_id, template_version_id, initiator_id, job_id, created_at, updated_at, transition, reason)
|
||||
VALUES ('83b28647-743c-4649-b226-f2be697ca06c', '8cb0b7c4-47b5-4bfc-ad92-88ccc61f3c12', 'f1276e15-01cd-406d-8ea5-64f113a79601', '1f573504-f7a0-4498-8b81-2e1939f3c4a2', '50ebe702-82e5-4053-859d-c24a3b742b57', now(), now(), 'start', 'initiator');
|
||||
|
||||
-- Template Version Presets
|
||||
INSERT INTO template_version_presets (id, template_version_id, name, created_at, updated_at, description)
|
||||
VALUES
|
||||
('575a0fbb-cc3e-4709-ae9f-d1a3f365909c', 'f1276e15-01cd-406d-8ea5-64f113a79601', 'test', now(), now(), 'Test preset'),
|
||||
('2c76596d-436d-42eb-a38c-8d5a70497030', 'f1276e15-01cd-406d-8ea5-64f113a79601', 'test', now(), now(), 'Test preset');
|
Reference in New Issue
Block a user