From 40cd5f8a36f9ba44fae451f2ef1607b948604f71 Mon Sep 17 00:00:00 2001 From: jude Date: Sat, 17 Sep 2022 13:03:52 +0100 Subject: [PATCH] Patch compilation against live schema --- src/main.rs | 2 +- src/models/user_data.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index da6f22b..4cd6a58 100644 --- a/src/main.rs +++ b/src/main.rs @@ -168,7 +168,7 @@ async fn _main(tx: Sender<()>) -> Result<(), Box> { Pool::connect(&env::var("DATABASE_URL").expect("No database URL provided")).await.unwrap(); let popular_timezones = sqlx::query!( - "SELECT timezone FROM users GROUP BY timezone ORDER BY COUNT(timezone) DESC LIMIT 21" + "SELECT timezone FROM users WHERE timezone IS NOT NULL GROUP BY timezone ORDER BY COUNT(timezone) DESC LIMIT 21" ) .fetch_all(&database) .await diff --git a/src/models/user_data.rs b/src/models/user_data.rs index 977c89d..647d95e 100644 --- a/src/models/user_data.rs +++ b/src/models/user_data.rs @@ -22,7 +22,7 @@ impl UserData { match sqlx::query!( " -SELECT timezone FROM users WHERE user = ? +SELECT IFNULL(timezone, 'UTC') AS timezone FROM users WHERE user = ? ", user_id )