Skip to content

Commit

Permalink
Try (and fail) to resolve CTE type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zephraph committed Dec 6, 2023
1 parent a4002ff commit 76c722f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::<quotas::dsl::memory>(
dsl::memory_bytes,
),
ExpressionAlias::new::<quotas::dsl::storage>(
dsl::storage_bytes,
),
)),
),
}
}
Expand All @@ -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,
)),
),
}
}
Expand Down

0 comments on commit 76c722f

Please sign in to comment.