From 76c722f9cbf8b15430ef785768e6a4c2e56f3b03 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Tue, 5 Dec 2023 22:42:49 -0500 Subject: [PATCH] Try (and fail) to resolve CTE type issues --- .../virtual_provisioning_collection_update.rs | 2 ++ .../virtual_provisioning_collection_update.rs | 20 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/nexus/db-model/src/queries/virtual_provisioning_collection_update.rs b/nexus/db-model/src/queries/virtual_provisioning_collection_update.rs index c774466fdb..124ffe4db6 100644 --- a/nexus/db-model/src/queries/virtual_provisioning_collection_update.rs +++ b/nexus/db-model/src/queries/virtual_provisioning_collection_update.rs @@ -8,6 +8,7 @@ //! for the construction of this query. use crate::schema::silo; +use crate::schema::silo_quotas; use crate::schema::virtual_provisioning_collection; table! { @@ -50,6 +51,7 @@ diesel::allow_tables_to_appear_in_same_query!(silo, parent_silo,); diesel::allow_tables_to_appear_in_same_query!( virtual_provisioning_collection, + silo_quotas, parent_silo, all_collections, do_update, diff --git a/nexus/db-queries/src/db/queries/virtual_provisioning_collection_update.rs b/nexus/db-queries/src/db/queries/virtual_provisioning_collection_update.rs index ef02c1e23a..9e6ef3e804 100644 --- a/nexus/db-queries/src/db/queries/virtual_provisioning_collection_update.rs +++ b/nexus/db-queries/src/db/queries/virtual_provisioning_collection_update.rs @@ -250,7 +250,18 @@ impl Quotas { use crate::db::schema::silo_quotas::dsl; Self { query: Box::new( - dsl::silo_quotas.filter(dsl::silo_id.eq(parent_silo::id)), + dsl::silo_quotas + .filter(dsl::silo_id.eq(parent_silo::id)) + .select(( + dsl::silo_id, + dsl::cpus, + ExpressionAlias::new::( + dsl::memory_bytes, + ), + ExpressionAlias::new::( + dsl::storage_bytes, + ), + )), ), } } @@ -269,7 +280,12 @@ impl SiloProvisioned { query: Box::new( dsl::virtual_provisioning_collection .filter(dsl::id.eq(parent_silo::id)) - .select(silo_provisioned::all_columns), + .select(( + dsl::id, + dsl::cpus_provisioned, + dsl::ram_provisioned, + dsl::virtual_disk_bytes_provisioned, + )), ), } }