feat: add migrations and queries to support prebuilds (#16891)

Depends on https://github.com/coder/coder/pull/16916 _(change base to
`main` once it is merged)_

Closes https://github.com/coder/internal/issues/514

_This is one of several PRs to decompose the `dk/prebuilds` feature
branch into separate PRs to merge into `main`._

---------

Signed-off-by: Danny Kopping <dannykopping@gmail.com>
Co-authored-by: Danny Kopping <dannykopping@gmail.com>
Co-authored-by: evgeniy-scherbina <evgeniy.shcherbina.es@gmail.com>
This commit is contained in:
Sas Swart
2025-04-03 10:58:30 +02:00
committed by GitHub
co-authored by Danny Kopping evgeniy-scherbina
parent 4aa45a5c43
commit 99c6f235eb
22 changed files with 2110 additions and 59 deletions
@@ -7,4 +7,26 @@ INSERT INTO public.template_versions (id, template_id, organization_id, created_
INSERT INTO public.template_version_presets (id, template_version_id, name, created_at) VALUES ('28b42cc0-c4fe-4907-a0fe-e4d20f1e9bfe', 'af58bd62-428c-4c33-849b-d43a3be07d93', 'test', '0001-01-01 00:00:00.000000 +00:00');
-- Add presets with the same template version ID and name
-- to ensure they're correctly handled by the 00031*_preset_prebuilds migration.
INSERT INTO public.template_version_presets (
id, template_version_id, name, created_at
)
VALUES (
'c9dd1a63-f0cf-446e-8d6f-2d29d7c8e38b',
'af58bd62-428c-4c33-849b-d43a3be07d93',
'duplicate_name',
'0001-01-01 00:00:00.000000 +00:00'
);
INSERT INTO public.template_version_presets (
id, template_version_id, name, created_at
)
VALUES (
'80f93d57-3948-487a-8990-bb011fb80a18',
'af58bd62-428c-4c33-849b-d43a3be07d93',
'duplicate_name',
'0001-01-01 00:00:00.000000 +00:00'
);
INSERT INTO public.template_version_preset_parameters (id, template_version_preset_id, name, value) VALUES ('ea90ccd2-5024-459e-87e4-879afd24de0f', '28b42cc0-c4fe-4907-a0fe-e4d20f1e9bfe', 'test', 'test');
@@ -0,0 +1,3 @@
UPDATE template_version_presets
SET desired_instances = 1
WHERE id = '28b42cc0-c4fe-4907-a0fe-e4d20f1e9bfe';