From 0cc084fce22325cac2e543707e4a76c5bdff4754 Mon Sep 17 00:00:00 2001 From: Andrew McKenzie Date: Thu, 30 Jan 2025 02:00:03 +0000 Subject: [PATCH] cast updated db columns --- mobile_config/src/boosted_hex_info.rs | 18 +++++++++--------- mobile_config/src/carrier_service.rs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mobile_config/src/boosted_hex_info.rs b/mobile_config/src/boosted_hex_info.rs index cedb34fd9..00546434e 100644 --- a/mobile_config/src/boosted_hex_info.rs +++ b/mobile_config/src/boosted_hex_info.rs @@ -195,13 +195,13 @@ pub(crate) mod db { const GET_BOOSTED_HEX_INFO_SQL: &str = r#" select - CAST(hexes.location as bigint), - CAST(hexes.start_ts as bigint), - config.period_length, + CAST(hexes.location AS bigint), + CAST(hexes.start_ts AS bigint), + CAST(config.period_length AS bigint), hexes.boosts_by_period as multipliers, hexes.address as boosted_hex_pubkey, config.address as boost_config_pubkey, - hexes.version + CAST(hexes.version AS integer) from boosted_hexes hexes join boost_configs config on hexes.boost_config = config.address "#; @@ -209,13 +209,13 @@ pub(crate) mod db { // TODO: reuse with string above const GET_MODIFIED_BOOSTED_HEX_INFO_SQL: &str = r#" select - CAST(hexes.location as bigint), - CAST(hexes.start_ts as bigint), - config.period_length, + CAST(hexes.location AS bigint), + CAST(hexes.start_ts AS bigint), + CAST(config.period_length AS bigint), hexes.boosts_by_period as multipliers, hexes.address as boosted_hex_pubkey, config.address as boost_config_pubkey, - hexes.version + CAST(hexes.version AS integer) from boosted_hexes hexes join boost_configs config on hexes.boost_config = config.address where hexes.refreshed_at > $1 @@ -243,7 +243,7 @@ pub(crate) mod db { impl sqlx::FromRow<'_, sqlx::postgres::PgRow> for BoostedHexInfo { fn from_row(row: &sqlx::postgres::PgRow) -> sqlx::Result { - let period_length = Duration::seconds(row.get::("period_length") as i64); + let period_length = Duration::seconds(row.get::("period_length")); let start_ts = to_start_ts(row.get::("start_ts") as u64); let multipliers = row .get::, &str>("multipliers") diff --git a/mobile_config/src/carrier_service.rs b/mobile_config/src/carrier_service.rs index 4ffd9b6a7..d131f9aee 100644 --- a/mobile_config/src/carrier_service.rs +++ b/mobile_config/src/carrier_service.rs @@ -83,7 +83,7 @@ impl CarrierService { r#" SELECT c.name as carrier_name, c.incentive_escrow_fund_bps, - iep.carrier, iep.start_ts::bigint, iep.stop_ts::bigint, iep.shares, iep.name as promo_name + iep.carrier, iep.start_ts::bigint, iep.stop_ts::bigint, CAST(iep.shares AS integer), iep.name as promo_name FROM carriers c JOIN incentive_escrow_programs iep on c.address = iep.carrier