diff --git a/active-matches-scraper/src/main.rs b/active-matches-scraper/src/main.rs index d21d99a..9d586cc 100644 --- a/active-matches-scraper/src/main.rs +++ b/active-matches-scraper/src/main.rs @@ -145,7 +145,7 @@ async fn compress_temp_file() -> Result, io::Error> { struct ActiveMatch { match_id: u32, #[serde(default = "scraped_at")] - scraped_at: i32, + scraped_at: u32, winning_team: u8, start_time: u32, players: Vec, @@ -171,11 +171,11 @@ struct ActiveMatchPlayer { hero_id: u32, } -fn scraped_at() -> i32 { +fn scraped_at() -> u32 { SystemTime::now() .duration_since(std::time::UNIX_EPOCH) .unwrap() - .as_secs() as i32 + .as_secs() as u32 } async fn fetch_active_matches() -> reqwest::Result> { diff --git a/clickhouse/migrations/03_create_active_matches_table.sql b/clickhouse/migrations/03_create_active_matches_table.sql index 8b455f6..9d10415 100644 --- a/clickhouse/migrations/03_create_active_matches_table.sql +++ b/clickhouse/migrations/03_create_active_matches_table.sql @@ -1,7 +1,7 @@ CREATE TABLE IF NOT EXISTS active_matches ( match_id UInt32, - scraped_at DateTime64, + scraped_at DATETIME, start_time DATETIME, winning_team UInt8, players Nested ( diff --git a/db-ingest/src/models/active_match.rs b/db-ingest/src/models/active_match.rs index d6142d6..8018869 100644 --- a/db-ingest/src/models/active_match.rs +++ b/db-ingest/src/models/active_match.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, Serialize, Clone)] pub struct ActiveMatch { pub match_id: u32, - pub scraped_at: i64, + pub scraped_at: u32, pub winning_team: u8, pub start_time: u32, pub players: Vec, diff --git a/db-ingest/src/models/clickhouse_active_match.rs b/db-ingest/src/models/clickhouse_active_match.rs index 09e0e6f..c195988 100644 --- a/db-ingest/src/models/clickhouse_active_match.rs +++ b/db-ingest/src/models/clickhouse_active_match.rs @@ -6,7 +6,7 @@ use serde::Serialize; #[derive(Row, Serialize, Debug)] pub struct ClickHouseActiveMatch { pub match_id: u32, - pub scraped_at: i64, + pub scraped_at: u32, pub start_time: u32, pub winning_team: u8, #[serde(rename = "players.account_id")]