chore: make has_ai_task fields on workspace builds and template versions nullable (#18403)

The fields must be nullable because there’s a period of time between
inserting a row into the database and finishing the “plan” provisioner
job when the final value of the field is unknown.
This commit is contained in:
Hugo Dutka
2025-06-17 16:08:34 +02:00
committed by GitHub
parent d6df1f23a9
commit ebc769f328
7 changed files with 27 additions and 10 deletions

View File

@ -0,0 +1,4 @@
ALTER TABLE template_versions ALTER COLUMN has_ai_task SET DEFAULT false;
ALTER TABLE template_versions ALTER COLUMN has_ai_task SET NOT NULL;
ALTER TABLE workspace_builds ALTER COLUMN has_ai_task SET DEFAULT false;
ALTER TABLE workspace_builds ALTER COLUMN has_ai_task SET NOT NULL;

View File

@ -0,0 +1,7 @@
-- The fields must be nullable because there's a period of time between
-- inserting a row into the database and finishing the "plan" provisioner job
-- when the final value of the field is unknown.
ALTER TABLE template_versions ALTER COLUMN has_ai_task DROP DEFAULT;
ALTER TABLE template_versions ALTER COLUMN has_ai_task DROP NOT NULL;
ALTER TABLE workspace_builds ALTER COLUMN has_ai_task DROP DEFAULT;
ALTER TABLE workspace_builds ALTER COLUMN has_ai_task DROP NOT NULL;