From 934fb31059da10fa843d96a10c37f181eaa89456 Mon Sep 17 00:00:00 2001
From: Dawid Rycerz <dawid@rycerz.xyz>
Date: Mon, 21 Jul 2025 21:10:22 +0300
Subject: feat: add weather pooler and config

---
 migrations/20240101000400_create_weather_api_data.sql | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 migrations/20240101000400_create_weather_api_data.sql

(limited to 'migrations/20240101000400_create_weather_api_data.sql')

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
-- 
cgit v1.2.3

