summaryrefslogtreecommitdiff
path: root/src/sql.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-07-02 16:14:23 -0700
committeriximeow <me@iximeow.net>2023-07-02 16:14:23 -0700
commita876e5dfec331c1b6a921c9dd1b79d9d6917ebbd (patch)
treec75f66a4dd0c5a7d256705cb2278c9ac3ef82ac6 /src/sql.rs
parent13828668b0fc83234b3252d4c1a7e7e7ee1ca51d (diff)
add host identifiers?
Diffstat (limited to 'src/sql.rs')
-rw-r--r--src/sql.rs27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/sql.rs b/src/sql.rs
index 9d8613a..1ed9205 100644
--- a/src/sql.rs
+++ b/src/sql.rs
@@ -36,14 +36,14 @@ impl TryFrom<u8> for RunState {
}
pub(crate) fn row2run(row: &rusqlite::Row) -> Run {
- let (id, job_id, artifacts_path, state, run_host, build_token, create_time, start_time, complete_time, run_timeout, build_result, final_text) = row.try_into().unwrap();
+ let (id, job_id, artifacts_path, state, host_id, build_token, create_time, start_time, complete_time, run_timeout, build_result, final_text) = row.try_into().unwrap();
let state: u8 = state;
Run {
id,
job_id,
artifacts_path,
state: state.try_into().unwrap(),
- run_host,
+ host_id,
create_time,
start_time,
complete_time,
@@ -101,12 +101,12 @@ pub const CREATE_ARTIFACTS_TABLE: &'static str = "\
created_time INTEGER,
completed_time INTEGER);";
-pub const CREATE_RUN_TABLE: &'static str = "\
+pub const CREATE_RUNS_TABLE: &'static str = "\
CREATE TABLE IF NOT EXISTS runs (id INTEGER PRIMARY KEY AUTOINCREMENT,
job_id INTEGER,
artifacts_path TEXT,
state INTEGER NOT NULL,
- run_host TEXT,
+ host_id INTEGER,
build_token TEXT,
created_time INTEGER,
started_time INTEGER,
@@ -115,6 +115,21 @@ pub const CREATE_RUN_TABLE: &'static str = "\
build_result INTEGER,
final_status TEXT);";
+pub const CREATE_HOSTS_TABLE: &'static str = "\
+ CREATE TABLE IF NOT EXISTS hosts (id INTEGER PRIMARY KEY AUTOINCREMENT,
+ hostname TEXT,
+ cpu_vendor TEXT,
+ cpu_model_name TEXT,
+ cpu_family TEXT,
+ cpu_model TEXT,
+ cpu_microcode TEXT,
+ cpu_cores INTEGER,
+ mem_total TEXT,
+ arch TEXT,
+ family TEXT,
+ os TEXT,
+ UNIQUE(hostname, cpu_vendor, cpu_model_name, cpu_family, cpu_model, cpu_microcode, cpu_cores, mem_total, arch, family, os));";
+
pub const CREATE_REMOTES_INDEX: &'static str = "\
CREATE INDEX IF NOT EXISTS 'repo_to_remote' ON remotes(repo_id);";
@@ -129,7 +144,7 @@ pub const ACTIVE_RUNS: &'static str = "\
job_id,
artifacts_path,
state,
- run_host,
+ host_id,
build_token,
created_time,
started_time,
@@ -170,7 +185,7 @@ pub const LAST_RUN_FOR_JOB: &'static str = "\
job_id,
artifacts_path,
state,
- run_host,
+ host_id,
build_token,
created_time,
started_time,