Skip to content

Commit 86f68b2

Browse files
feat: add 'display_name' column to 'workspace_agent_scripts' (#14747)
* feat: add 'display_name' column to 'workspace_agent_scripts' * fix: backfill from workspace_agent_log_sources * fix: run 'make gen'
1 parent db7b411 commit 86f68b2

22 files changed

+419
-348
lines changed

agent/proto/agent.pb.go

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

agent/proto/agent.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ message WorkspaceAgentScript {
5353
bool run_on_stop = 6;
5454
bool start_blocks_login = 7;
5555
google.protobuf.Duration timeout = 8;
56+
string display_name = 9;
5657
}
5758

5859
message WorkspaceAgentMetadata {

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/database/dump.sql

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE workspace_agent_scripts DROP COLUMN display_name;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ALTER TABLE workspace_agent_scripts ADD COLUMN display_name text;
2+
3+
UPDATE workspace_agent_scripts
4+
SET display_name = workspace_agent_log_sources.display_name
5+
FROM workspace_agent_log_sources
6+
WHERE workspace_agent_scripts.log_source_id = workspace_agent_log_sources.id;
7+
8+
ALTER TABLE workspace_agent_scripts ALTER COLUMN display_name SET NOT NULL;

coderd/database/models.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: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspacescripts.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- name: InsertWorkspaceAgentScripts :many
22
INSERT INTO
3-
workspace_agent_scripts (workspace_agent_id, created_at, log_source_id, log_path, script, cron, start_blocks_login, run_on_start, run_on_stop, timeout_seconds)
3+
workspace_agent_scripts (workspace_agent_id, created_at, log_source_id, log_path, script, cron, start_blocks_login, run_on_start, run_on_stop, timeout_seconds, display_name)
44
SELECT
55
@workspace_agent_id :: uuid AS workspace_agent_id,
66
@created_at :: timestamptz AS created_at,
@@ -11,7 +11,8 @@ SELECT
1111
unnest(@start_blocks_login :: boolean [ ]) AS start_blocks_login,
1212
unnest(@run_on_start :: boolean [ ]) AS run_on_start,
1313
unnest(@run_on_stop :: boolean [ ]) AS run_on_stop,
14-
unnest(@timeout_seconds :: integer [ ]) AS timeout_seconds
14+
unnest(@timeout_seconds :: integer [ ]) AS timeout_seconds,
15+
unnest(@display_name :: text [ ]) AS display_name
1516
RETURNING workspace_agent_scripts.*;
1617

1718
-- name: GetWorkspaceAgentScriptsByAgentIDs :many

0 commit comments

Comments
 (0)