Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitebc769f

Browse files
authored
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 betweeninserting a row into the database and finishing the “plan” provisionerjob when the final value of the field is unknown.
1 parentd6df1f2 commitebc769f

File tree

7 files changed

+27
-10
lines changed

7 files changed

+27
-10
lines changed

‎coderd/database/dump.sql

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTERTABLE template_versions ALTER COLUMN has_ai_taskSET DEFAULT false;
2+
ALTERTABLE template_versions ALTER COLUMN has_ai_taskSETNOT NULL;
3+
ALTERTABLE workspace_builds ALTER COLUMN has_ai_taskSET DEFAULT false;
4+
ALTERTABLE workspace_builds ALTER COLUMN has_ai_taskSETNOT NULL;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- The fields must be nullable because there's a period of time between
2+
-- inserting a row into the database and finishing the "plan" provisioner job
3+
-- when the final value of the field is unknown.
4+
ALTERTABLE template_versions ALTER COLUMN has_ai_task DROP DEFAULT;
5+
ALTERTABLE template_versions ALTER COLUMN has_ai_task DROPNOT NULL;
6+
ALTERTABLE workspace_builds ALTER COLUMN has_ai_task DROP DEFAULT;
7+
ALTERTABLE workspace_builds ALTER COLUMN has_ai_task DROPNOT NULL;

‎coderd/database/models.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries.sql.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/templateversions.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,10 @@ func (api *API) postTemplateVersionsByOrganization(rw http.ResponseWriter, r *ht
17321732
},
17331733
// appease the exhaustruct linter
17341734
// TODO: set this to whether the template version defines a `coder_ai_task` tf resource
1735-
HasAITask:false,
1735+
HasAITask: sql.NullBool{
1736+
Bool:false,
1737+
Valid:false,
1738+
},
17361739
})
17371740
iferr!=nil {
17381741
ifdatabase.IsUniqueViolation(err,database.UniqueTemplateVersionsTemplateIDNameKey) {

‎coderd/wsbuilder/wsbuilder.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,10 @@ func (b *Builder) buildTx(authFunc func(action policy.Action, object rbac.Object
427427
},
428428
// appease the exhaustruct linter
429429
// TODO: set this to whether the build included a `coder_ai_task` tf resource
430-
HasAITask:false,
430+
HasAITask: sql.NullBool{
431+
Bool:false,
432+
Valid:false,
433+
},
431434
})
432435
iferr!=nil {
433436
code:=http.StatusInternalServerError

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp