Skip to content

Commit 44f8557

Browse files
committed
Create new table for collector_config, configuration for the collectors
1 parent 39fab1a commit 44f8557

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

database/schema.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,15 @@ aid benchmark error
258258
---------- --- -----
259259
1 syn-1.0.89 Failed to compile...
260260
```
261+
262+
### collector_config
263+
264+
Information about the collector; it's target architecture, when it was added, whether it is active and when it last had activity denoted by `last_heartbeat_at`.
265+
266+
```
267+
sqlite> SELECT * FROM collector_config;
268+
269+
id target date_added last_heartbeat_at benchmark_set is_active
270+
--------- ------------------------- ------------- ---------------- --------- -------
271+
ea1f4e... aarch64-unknown-linux-gnu 2025-06-11... 2025-06-12 17... cea1bc... 0
272+
```

database/src/pool/postgres.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,17 @@ static MIGRATIONS: &[&str] = &[
301301
);
302302
CREATE INDEX IF NOT EXISTS benchmark_request_status_idx on benchmark_request (status) WHERE status != 'completed';
303303
"#,
304+
r#"CREATE EXTENSION IF NOT EXISTS "uuid-ossp";"#,
305+
r#"
306+
CREATE TABLE IF NOT EXISTS collector_config (
307+
id UUID PRIMARY KEY,
308+
target TEXT NOT NULL,
309+
date_added TIMESTAMPTZ DEFAULT NOW() NOT NULL,
310+
last_heartbeat_at TIMESTAMPTZ,
311+
benchmark_set UUID NOT NULL,
312+
is_active BOOLEAN DEFAULT FALSE NOT NULL
313+
);
314+
"#,
304315
];
305316

306317
#[async_trait::async_trait]

database/src/pool/sqlite.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,18 @@ static MIGRATIONS: &[Migration] = &[
404404
alter table pstat_series_with_target rename to pstat_series;
405405
"#,
406406
),
407+
Migration::without_foreign_key_constraints(
408+
r#"
409+
CREATE TABLE IF NOT EXISTS collector_config (
410+
id TEXT PRIMARY KEY,
411+
target TEXT NOT NULL,
412+
date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
413+
last_heartbeat_at TIMESTAMP,
414+
benchmark_set TEXT NOT NULL,
415+
is_active BOOLEAN DEFAULT FALSE NOT NULL
416+
);
417+
"#,
418+
),
407419
];
408420

409421
#[async_trait::async_trait]

0 commit comments

Comments
 (0)