summaryrefslogtreecommitdiff
path: root/src/sql.rs
diff options
context:
space:
mode:
authoriximeow <git@iximeow.net>2022-12-29 19:08:01 +0000
committeriximeow <git@iximeow.net>2022-12-29 19:08:01 +0000
commit0832c96c116f4c3a28bd22a0cdd287a3b0764c7b (patch)
tree9b58beaf733a7ded11eb8519d37d41653f1e77fe /src/sql.rs
parente28b277980763b88d2828812bff2c0b9546d3d25 (diff)
record and present metrics
Diffstat (limited to 'src/sql.rs')
-rw-r--r--src/sql.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sql.rs b/src/sql.rs
index 21572da..7bd33fd 100644
--- a/src/sql.rs
+++ b/src/sql.rs
@@ -50,6 +50,14 @@ pub const CREATE_JOBS_TABLE: &'static str = "\
build_result INTEGER,
final_status TEXT);";
+pub const CREATE_METRICS_TABLE: &'static str = "\
+ CREATE TABLE IF NOT EXISTS metrics (id INTEGER PRIMARY KEY AUTOINCREMENT,
+ job_id INTEGER,
+ name TEXT,
+ value TEXT,
+ UNIQUE(job_id, name)
+ );";
+
pub const CREATE_COMMITS_TABLE: &'static str = "\
CREATE TABLE IF NOT EXISTS commits (id INTEGER PRIMARY KEY AUTOINCREMENT, sha TEXT UNIQUE);";
@@ -90,6 +98,9 @@ pub const PENDING_JOBS: &'static str = "\
pub const LAST_ARTIFACTS_FOR_JOB: &'static str = "\
select * from artifacts where job_id=?1 and (name like \"%(stderr)%\" or name like \"%(stdout)%\") order by id desc limit 2;";
+pub const METRICS_FOR_JOB: &'static str = "\
+ select * from metrics where job_id=?1 order by id asc;";
+
pub const COMMIT_TO_ID: &'static str = "\
select id from commits where sha=?1;";