Skip to content

Commit 58e55a2

Browse files
committed
Add migrations
1 parent f670895 commit 58e55a2

File tree

8 files changed

+104
-0
lines changed

8 files changed

+104
-0
lines changed

coderd/database/dump.sql

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- this is a no-op
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CREATE TABLE agent_stats (
2+
id text NOT NULL,
3+
created_at timestamptz NOT NULL,
4+
user_id uuid NOT NULL,
5+
agent_id uuid NOT NULL,
6+
workspace_id uuid NOT NULL,
7+
payload jsonb NOT NULL
8+
);
9+
10+
-- We use created_at for DAU analysis and pruning.
11+
CREATE INDEX idx_agent_stats_created_at ON agent_stats USING btree (created_at);
12+
13+
-- We perform user grouping to analyze DAUs.
14+
CREATE INDEX idx_agent_stats_user_id ON agent_stats USING btree (user_id);

coderd/database/models.go

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

coderd/database/querier.go

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

coderd/database/queries.sql.go

+44
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- name: InsertAgentStat :one
2+
INSERT INTO
3+
agent_stats (
4+
id,
5+
created_at,
6+
user_id,
7+
workspace_id,
8+
agent_id,
9+
payload
10+
)
11+
VALUES
12+
($1, $2, $3, $4, $5, $6) RETURNING *;

site/src/api/typesGenerated.ts

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ export interface AgentGitSSHKey {
2929
readonly private_key: string
3030
}
3131

32+
// From codersdk/workspaceagents.go
33+
export interface AgentStatsReportRequest {}
34+
35+
// From codersdk/workspaceagents.go
36+
export interface AgentStatsReportResponse {
37+
// Named type "github.com/coder/coder/agent.ConnStats" unknown, using "any"
38+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
39+
readonly conns?: any[]
40+
}
41+
3242
// From codersdk/roles.go
3343
export interface AssignableRoles extends Role {
3444
readonly assignable: boolean

0 commit comments

Comments
 (0)