Add city-level tracking to geo stats

- Update update-geo-stats to accept optional city parameter
- Update get-cached-geo to cache and return city along with country
- Update collect-geo-stats-for-mount and collect-geo-stats-from-web-listeners
  to track by country+city
- Revert migration to keep UNIQUE(date, country_code, city) constraint
This commit is contained in:
Glenn Thompson 2025-12-12 19:23:05 +03:00 committed by Brian O'Reilly
parent 009e812f8c
commit 75b27c5424
1 changed files with 1 additions and 1 deletions

View File

@ -72,7 +72,7 @@ CREATE TABLE IF NOT EXISTS listener_geo_stats (
city VARCHAR(100), city VARCHAR(100),
listener_count INTEGER DEFAULT 0, listener_count INTEGER DEFAULT 0,
listen_minutes INTEGER DEFAULT 0, listen_minutes INTEGER DEFAULT 0,
UNIQUE(date, country_code) UNIQUE(date, country_code, city)
); );
CREATE INDEX IF NOT EXISTS idx_geo_stats_date ON listener_geo_stats(date); CREATE INDEX IF NOT EXISTS idx_geo_stats_date ON listener_geo_stats(date);