diff --git a/services/api/src/endpoints/project/perf/mod.rs b/services/api/src/endpoints/project/perf/mod.rs index 3102b5d6b..b9082eb3b 100644 --- a/services/api/src/endpoints/project/perf/mod.rs +++ b/services/api/src/endpoints/project/perf/mod.rs @@ -332,10 +332,12 @@ fn perf_query( .filter(schema::branch_version::branch_id.eq(branch_id)) .filter(schema::report::testbed_id.eq(testbed_id)) .filter(schema::perf::benchmark_id.eq(benchmark_id)) + // There may or may not be a boundary for any given metric .left_join( schema::boundary::table .inner_join(schema::threshold::table) .inner_join(schema::statistic::table) + // There may or may not be an alert for any given boundary .left_join(schema::alert::table), ) .into_boxed(); diff --git a/services/api/src/model/project/benchmark.rs b/services/api/src/model/project/benchmark.rs index 015306b30..45b9c333f 100644 --- a/services/api/src/model/project/benchmark.rs +++ b/services/api/src/model/project/benchmark.rs @@ -146,6 +146,7 @@ impl QueryBenchmark { let (query_benchmark, query_metric, query_boundary) = schema::metric::table .filter(schema::metric::id.eq(metric_id)) .inner_join(schema::perf::table.inner_join(schema::benchmark::table)) + // There may or may not be a boundary for any given metric .left_join(schema::boundary::table) .select(( ( diff --git a/services/api/src/model/project/mod.rs b/services/api/src/model/project/mod.rs index 0643ee1ee..5bc04d2c7 100644 --- a/services/api/src/model/project/mod.rs +++ b/services/api/src/model/project/mod.rs @@ -162,7 +162,7 @@ impl QueryProject { id: ProjectId, ) -> Result, ApiError> { let subscription: Option = schema::organization::table - .left_join(schema::project::table) + .inner_join(schema::project::table) .filter(schema::project::id.eq(id)) .select(schema::organization::subscription) .first(conn) @@ -181,7 +181,7 @@ impl QueryProject { id: ProjectId, ) -> Result, ApiError> { let (uuid, license): (String, Option) = schema::organization::table - .left_join(schema::project::table) + .inner_join(schema::project::table) .filter(schema::project::id.eq(id)) .select((schema::organization::uuid, schema::organization::license)) .first(conn) diff --git a/services/api/src/model/project/report/mod.rs b/services/api/src/model/project/report/mod.rs index 59b89d6ef..2b1fb77c3 100644 --- a/services/api/src/model/project/report/mod.rs +++ b/services/api/src/model/project/report/mod.rs @@ -124,6 +124,7 @@ fn get_report_results( .inner_join(schema::benchmark::table) .inner_join(schema::metric::table .inner_join(schema::metric_kind::table) + // There may or may not be a boundary for any given metric .left_join(schema::boundary::table .inner_join(schema::threshold::table) .inner_join(schema::statistic::table) diff --git a/services/api/src/model/project/report/results/detector/data.rs b/services/api/src/model/project/report/results/detector/data.rs index 5a47547d5..20cd5a63c 100644 --- a/services/api/src/model/project/report/results/detector/data.rs +++ b/services/api/src/model/project/report/results/detector/data.rs @@ -28,14 +28,14 @@ impl MetricsData { .filter(schema::metric::metric_kind_id.eq(metric_kind_id)) .inner_join( schema::perf::table - .left_join( + .inner_join( schema::report::table - .left_join(schema::version::table.left_join( - schema::branch_version::table.left_join(schema::branch::table), + .inner_join(schema::version::table.inner_join( + schema::branch_version::table.inner_join(schema::branch::table), )) - .left_join(schema::testbed::table), + .inner_join(schema::testbed::table), ) - .left_join(schema::benchmark::table), + .inner_join(schema::benchmark::table), ) .filter(schema::branch::id.eq(branch_id)) .filter(schema::testbed::id.eq(testbed_id)) diff --git a/services/api/src/model/project/threshold/alert.rs b/services/api/src/model/project/threshold/alert.rs index 4a08d99e6..dc7893f9d 100644 --- a/services/api/src/model/project/threshold/alert.rs +++ b/services/api/src/model/project/threshold/alert.rs @@ -57,10 +57,10 @@ impl QueryAlert { ) -> Result { schema::alert::table .filter(schema::alert::uuid.eq(uuid.to_string())) - .left_join( - schema::boundary::table.left_join( + .inner_join( + schema::boundary::table.inner_join( schema::metric::table - .left_join(schema::perf::table.left_join(schema::benchmark::table)), + .inner_join(schema::perf::table.inner_join(schema::benchmark::table)), ), ) .filter(schema::benchmark::project_id.eq(project_id)) diff --git a/services/api/src/model/project/version.rs b/services/api/src/model/project/version.rs index d56966723..538e6ccc3 100644 --- a/services/api/src/model/project/version.rs +++ b/services/api/src/model/project/version.rs @@ -50,7 +50,7 @@ impl QueryVersion { ) -> Result { if let Some(hash) = hash { if let Ok(version_id) = schema::version::table - .left_join(schema::branch_version::table) + .inner_join(schema::branch_version::table) .filter(schema::branch_version::branch_id.eq(branch_id)) .filter(schema::version::hash.eq(hash.as_ref())) .order(schema::version::number.desc()) @@ -86,7 +86,7 @@ impl InsertVersion { // Get the most recent code version number for this branch and increment it. // Otherwise, start a new branch code version number count from zero. let number = if let Ok(number) = schema::version::table - .left_join(schema::branch_version::table) + .inner_join(schema::branch_version::table) .filter(schema::branch_version::branch_id.eq(branch_id)) .select(schema::version::number) .order(schema::version::number.desc())