diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-21 21:10:22 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-21 21:10:22 +0300 |
| commit | 934fb31059da10fa843d96a10c37f181eaa89456 (patch) | |
| tree | 452b36bdd1e286e68381607f15742695afec0f60 /migrations/20240101000400_create_weather_api_data.sql | |
| parent | 30f50e5b31294abd75c4b629970ad4865108738d (diff) | |
feat: add weather pooler and config
Diffstat (limited to 'migrations/20240101000400_create_weather_api_data.sql')
| -rw-r--r-- | migrations/20240101000400_create_weather_api_data.sql | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/migrations/20240101000400_create_weather_api_data.sql b/migrations/20240101000400_create_weather_api_data.sql new file mode 100644 index 0000000..16fdf35 --- /dev/null +++ b/migrations/20240101000400_create_weather_api_data.sql @@ -0,0 +1,15 @@ +-- Migration: Create weather_api_data table +CREATE TABLE IF NOT EXISTS weather_api_data ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + location_id INTEGER NOT NULL, + api_type TEXT NOT NULL DEFAULT 'openweathermap', + data TEXT NOT NULL, -- JSON data from the API + fetched_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE, + FOREIGN KEY(location_id) REFERENCES locations(id) ON DELETE CASCADE +); +CREATE INDEX IF NOT EXISTS idx_weather_api_data_user_id ON weather_api_data(user_id); +CREATE INDEX IF NOT EXISTS idx_weather_api_data_location_id ON weather_api_data(location_id); +CREATE INDEX IF NOT EXISTS idx_weather_api_data_fetched_at ON weather_api_data(fetched_at); +CREATE INDEX IF NOT EXISTS idx_weather_api_data_api_type ON weather_api_data(api_type);
\ No newline at end of file |
