Skip to content

Commit 5abf555

Browse files
committed
Generate database changes
1 parent 40e9c87 commit 5abf555

File tree

9 files changed

+144
-7
lines changed

9 files changed

+144
-7
lines changed

coderd/database/databasefake/databasefake.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4294,3 +4294,16 @@ func (q *fakeQuerier) GetQuotaConsumedForUser(_ context.Context, userID uuid.UUI
42944294
}
42954295
return sum, nil
42964296
}
4297+
4298+
func (q *fakeQuerier) UpdateWorkspaceAgentStateByID(_ context.Context, id uuid.UUID, state database.AgentState) error {
4299+
q.mutex.Lock()
4300+
defer q.mutex.Unlock()
4301+
for i, agent := range q.workspaceAgents {
4302+
if agent.ID == id {
4303+
agent.State = state
4304+
q.workspaceAgents[i] = agent
4305+
return nil
4306+
}
4307+
}
4308+
return sql.ErrNoRows
4309+
}

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: 66 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
@@ -918,6 +918,7 @@ export interface WorkspaceAgent {
918918
readonly last_connected_at?: string
919919
readonly disconnected_at?: string
920920
readonly status: WorkspaceAgentStatus
921+
readonly state: WorkspaceAgentState
921922
readonly name: string
922923
readonly resource_id: string
923924
readonly instance_id?: string
@@ -1225,6 +1226,19 @@ export const TemplateRoles: TemplateRole[] = ["", "admin", "use"]
12251226
export type UserStatus = "active" | "suspended"
12261227
export const UserStatuses: UserStatus[] = ["active", "suspended"]
12271228

1229+
// From codersdk/workspaceagents.go
1230+
export type WorkspaceAgentState =
1231+
| "ready"
1232+
| "start_error"
1233+
| "start_timeout"
1234+
| "starting"
1235+
export const WorkspaceAgentStates: WorkspaceAgentState[] = [
1236+
"ready",
1237+
"start_error",
1238+
"start_timeout",
1239+
"starting",
1240+
]
1241+
12281242
// From codersdk/workspaceagents.go
12291243
export type WorkspaceAgentStatus =
12301244
| "connected"

0 commit comments

Comments
 (0)