summaryrefslogtreecommitdiff
path: root/migrations/20240101000200_create_weather_thresholds.sql
blob: d6ebf0dc1912422f35a1b52b730cb3f859550f18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
-- Migration: Create weather_thresholds table
CREATE TABLE IF NOT EXISTS weather_thresholds (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id INTEGER NOT NULL,
    condition_type TEXT NOT NULL,
    threshold_value REAL NOT NULL,
    operator TEXT NOT NULL,
    enabled BOOLEAN NOT NULL DEFAULT 1,
    description TEXT,
    FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_weather_thresholds_user_id ON weather_thresholds(user_id);
CREATE INDEX IF NOT EXISTS idx_weather_thresholds_condition_type ON weather_thresholds(condition_type);