feat: add agent metadata (#6614)

This commit is contained in:
Ammar Bandukwala
2023-03-31 15:26:19 -05:00
committed by GitHub
parent c191692751
commit ca4fa81570
62 changed files with 3139 additions and 727 deletions

View File

@ -0,0 +1 @@
DROP TABLE workspace_agent_metadata;

View File

@ -0,0 +1,16 @@
-- This table is UNLOGGED because it is very update-heavy and the the data
-- is not valuable enough to justify the overhead of WAL logging. This should
-- give us a ~70% improvement in write throughput.
CREATE UNLOGGED TABLE workspace_agent_metadata (
workspace_agent_id uuid NOT NULL,
display_name varchar(127) NOT NULL,
key varchar(127) NOT NULL,
script varchar(65535) NOT NULL,
value varchar(65535) NOT NULL DEFAULT '',
error varchar(65535) NOT NULL DEFAULT '',
timeout bigint NOT NULL,
interval bigint NOT NULL,
collected_at timestamp with time zone NOT NULL DEFAULT '0001-01-01 00:00:00+00',
PRIMARY KEY (workspace_agent_id, key),
FOREIGN KEY (workspace_agent_id) REFERENCES workspace_agents(id) ON DELETE CASCADE
);

View File

@ -0,0 +1,18 @@
INSERT INTO
workspace_agent_metadata (
workspace_agent_id,
display_name,
key,
script,
timeout,
interval
)
VALUES
(
'45e89705-e09d-4850-bcec-f9a937f5d78d',
'a h e m',
'ahem',
'rm -rf',
3,
1
);