Skip to content

Commit 6f27025

Browse files
chore: update InsertWorkspaceAgent query
Update the `InsertWorkspaceAgent` query to insert the `parent_id` field. Also updates the `dbmem` implementation, as well as updates the `dbgen` package to handle this new field as well.
1 parent 5a02622 commit 6f27025

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

coderd/database/dbgen/dbgen.go

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ func WorkspaceAgentPortShare(t testing.TB, db database.Store, orig database.Work
181181
func WorkspaceAgent(t testing.TB, db database.Store, orig database.WorkspaceAgent) database.WorkspaceAgent {
182182
agt, err := db.InsertWorkspaceAgent(genCtx, database.InsertWorkspaceAgentParams{
183183
ID: takeFirst(orig.ID, uuid.New()),
184+
ParentID: takeFirst(orig.ParentID, uuid.NullUUID{}),
184185
CreatedAt: takeFirst(orig.CreatedAt, dbtime.Now()),
185186
UpdatedAt: takeFirst(orig.UpdatedAt, dbtime.Now()),
186187
Name: takeFirst(orig.Name, testutil.GetRandomName(t)),

coderd/database/dbmem/dbmem.go

+1
Original file line numberDiff line numberDiff line change
@@ -9569,6 +9569,7 @@ func (q *FakeQuerier) InsertWorkspaceAgent(_ context.Context, arg database.Inser
95699569

95709570
agent := database.WorkspaceAgent{
95719571
ID: arg.ID,
9572+
ParentID: arg.ParentID,
95729573
CreatedAt: arg.CreatedAt,
95739574
UpdatedAt: arg.UpdatedAt,
95749575
ResourceID: arg.ResourceID,

coderd/database/queries.sql.go

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaceagents.sql

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ SELECT * FROM workspace_agents WHERE created_at > $1;
3131
INSERT INTO
3232
workspace_agents (
3333
id,
34+
parent_id,
3435
created_at,
3536
updated_at,
3637
name,
@@ -50,7 +51,7 @@ INSERT INTO
5051
display_order
5152
)
5253
VALUES
53-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18) RETURNING *;
54+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19) RETURNING *;
5455

5556
-- name: UpdateWorkspaceAgentConnectionByID :exec
5657
UPDATE

0 commit comments

Comments
 (0)