Group migrations
This commit is contained in:
parent
2714280567
commit
82e2385f59
12 changed files with 105 additions and 103 deletions
|
|
@ -68,12 +68,12 @@ async fn save_work(
|
|||
.execute(&mut *conn)
|
||||
.await?;
|
||||
|
||||
for (name, measurement) in run.measurements {
|
||||
for (metric, measurement) in run.measurements {
|
||||
sqlx::query!(
|
||||
"\
|
||||
INSERT INTO run_measurements ( \
|
||||
id, \
|
||||
name, \
|
||||
metric, \
|
||||
value, \
|
||||
stddev, \
|
||||
unit, \
|
||||
|
|
@ -82,7 +82,7 @@ async fn save_work(
|
|||
VALUES (?, ?, ?, ?, ?, ?) \
|
||||
",
|
||||
run.id,
|
||||
name,
|
||||
metric,
|
||||
measurement.value,
|
||||
measurement.stddev,
|
||||
measurement.unit,
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ pub async fn get_graph_data(
|
|||
// The SQL queries that return one result per commit *must* return the same
|
||||
// amount of rows in the same order!
|
||||
|
||||
// TODO Order queries by hash only
|
||||
// TODO After topo sort, do a stable sort by committer date
|
||||
|
||||
let unsorted_hashes = sqlx::query_scalar!(
|
||||
"\
|
||||
SELECT hash FROM commits \
|
||||
|
|
@ -140,7 +143,7 @@ pub async fn get_graph_data(
|
|||
SELECT hash, value, MAX(start) \
|
||||
FROM runs \
|
||||
JOIN run_measurements USING (id) \
|
||||
WHERE name = ? \
|
||||
WHERE metric = ? \
|
||||
GROUP BY hash \
|
||||
) \
|
||||
SELECT value \
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use crate::{
|
|||
};
|
||||
|
||||
struct Measurement {
|
||||
name: String,
|
||||
metric: String,
|
||||
value: String,
|
||||
stddev: String,
|
||||
unit: String,
|
||||
|
|
@ -81,20 +81,20 @@ async fn from_finished_run(
|
|||
let measurements = sqlx::query!(
|
||||
"\
|
||||
SELECT \
|
||||
name, \
|
||||
metric, \
|
||||
value, \
|
||||
stddev, \
|
||||
unit, \
|
||||
direction \
|
||||
FROM run_measurements \
|
||||
WHERE id = ? \
|
||||
ORDER BY name ASC \
|
||||
ORDER BY metric ASC \
|
||||
",
|
||||
id,
|
||||
)
|
||||
.fetch(db)
|
||||
.map_ok(|r| Measurement {
|
||||
name: r.name,
|
||||
metric: r.metric,
|
||||
value: util::format_value(r.value),
|
||||
stddev: r.stddev.map(util::format_value).unwrap_or_default(),
|
||||
unit: r.unit.unwrap_or_default(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue