Skip to content

Commit b572f87

Browse files
committed
Generate database changes
1 parent 9a21e7a commit b572f87

File tree

7 files changed

+101
-7
lines changed

7 files changed

+101
-7
lines changed

coderd/database/databasefake/databasefake.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3870,3 +3870,16 @@ func (q *fakeQuerier) GetQuotaConsumedForUser(_ context.Context, userID uuid.UUI
38703870
}
38713871
return sum, nil
38723872
}
3873+
3874+
func (q *fakeQuerier) UpdateWorkspaceAgentStateByID(_ context.Context, id uuid.UUID, state database.AgentState) error {
3875+
q.mutex.Lock()
3876+
defer q.mutex.Unlock()
3877+
for i, agent := range q.workspaceAgents {
3878+
if agent.ID == id {
3879+
agent.State = state
3880+
q.workspaceAgents[i] = agent
3881+
return nil
3882+
}
3883+
}
3884+
return sql.ErrNoRows
3885+
}

coderd/database/dump.sql

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/models.go

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/querier.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 31 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaceagents.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,11 @@ SET
8080
version = $2
8181
WHERE
8282
id = $1;
83+
84+
-- name: UpdateWorkspaceAgentStateByID :exec
85+
UPDATE
86+
workspace_agents
87+
SET
88+
state = $2
89+
WHERE
90+
id = $1;

site/src/api/typesGenerated.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ export interface WorkspaceAgent {
906906
readonly last_connected_at?: string
907907
readonly disconnected_at?: string
908908
readonly status: WorkspaceAgentStatus
909+
readonly state: WorkspaceAgentState
909910
readonly name: string
910911
readonly resource_id: string
911912
readonly instance_id?: string
@@ -1209,6 +1210,19 @@ export const TemplateRoles: TemplateRole[] = ["", "admin", "use"]
12091210
export type UserStatus = "active" | "suspended"
12101211
export const UserStatuses: UserStatus[] = ["active", "suspended"]
12111212

1213+
// From codersdk/workspaceagents.go
1214+
export type WorkspaceAgentState =
1215+
| "ready"
1216+
| "start_error"
1217+
| "start_timeout"
1218+
| "starting"
1219+
export const WorkspaceAgentStates: WorkspaceAgentState[] = [
1220+
"ready",
1221+
"start_error",
1222+
"start_timeout",
1223+
"starting",
1224+
]
1225+
12121226
// From codersdk/workspaceagents.go
12131227
export type WorkspaceAgentStatus =
12141228
| "connected"

0 commit comments

Comments
 (0)