summaryrefslogtreecommitdiff
path: root/src/sql.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-07-04 14:21:58 -0700
committeriximeow <me@iximeow.net>2023-07-04 14:21:58 -0700
commitd0e845d3ac4530cf281e90d8a3634355d153c8be (patch)
tree6d679b58170adf6b9c8bdc2e53e836413c6458ed /src/sql.rs
parent0f97747c2e3e6f3178e414adc5b6022ead275601 (diff)
adjust metrics to show multi-host summaries?
Diffstat (limited to 'src/sql.rs')
-rw-r--r--src/sql.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sql.rs b/src/sql.rs
index 89dc381..34bc8aa 100644
--- a/src/sql.rs
+++ b/src/sql.rs
@@ -176,6 +176,12 @@ pub const JOB_BY_ID: &'static str = "\
pub const METRICS_FOR_RUN: &'static str = "\
select * from metrics where run_id=?1 order by id asc;";
+pub const METRICS_FOR_JOB: &'static str = "\
+ select metrics.id, metrics.run_id, metrics.name, metrics.value from metrics \
+ join runs on runs.id=metrics.run_id \
+ where runs.job_id=?1 \
+ order by metrics.run_id desc, metrics.id desc;";
+
pub const COMMIT_TO_ID: &'static str = "\
select id from commits where sha=?1;";
@@ -202,6 +208,20 @@ pub const LAST_RUN_FOR_JOB: &'static str = "\
build_result,
final_status from runs where job_id=?1 order by started_time desc limit 1;";
+pub const RUNS_FOR_JOB: &'static str = "\
+ select id,
+ job_id,
+ artifacts_path,
+ state,
+ host_id,
+ build_token,
+ created_time,
+ started_time,
+ complete_time,
+ run_timeout,
+ build_result,
+ final_status from runs where job_id=?1 group by host_id order by started_time desc, state asc;";
+
pub const SELECT_ALL_RUNS_WITH_JOB_INFO: &'static str = "\
select jobs.id as job_id, runs.id as run_id, runs.state, runs.created_time, jobs.commit_id, jobs.run_preferences
from jobs join runs on jobs.id=runs.job_id