Skip to content

Commit

Permalink
Merge pull request #935 from helium/andymck/accommodate-updated-colum…
Browse files Browse the repository at this point in the history
…n-defs

cast updated db columns
  • Loading branch information
andymck authored Jan 30, 2025
2 parents 150daae + 0cc084f commit ba4204e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions mobile_config/src/boosted_hex_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,27 +195,27 @@ 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
"#;

// 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
Expand Down Expand Up @@ -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<Self> {
let period_length = Duration::seconds(row.get::<i32, &str>("period_length") as i64);
let period_length = Duration::seconds(row.get::<i64, &str>("period_length"));
let start_ts = to_start_ts(row.get::<i64, &str>("start_ts") as u64);
let multipliers = row
.get::<Vec<u8>, &str>("multipliers")
Expand Down
2 changes: 1 addition & 1 deletion mobile_config/src/carrier_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba4204e

Please sign in to comment.