summaryrefslogtreecommitdiff
path: root/migrations/20240101000300_create_user_notification_settings.sql
diff options
context:
space:
mode:
Diffstat (limited to 'migrations/20240101000300_create_user_notification_settings.sql')
-rw-r--r--migrations/20240101000300_create_user_notification_settings.sql32
1 files changed, 32 insertions, 0 deletions
diff --git a/migrations/20240101000300_create_user_notification_settings.sql b/migrations/20240101000300_create_user_notification_settings.sql
new file mode 100644
index 0000000..13d45cd
--- /dev/null
+++ b/migrations/20240101000300_create_user_notification_settings.sql
@@ -0,0 +1,32 @@
+-- Migration: Create user_ntfy_settings table
+CREATE TABLE IF NOT EXISTS user_ntfy_settings (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ user_id INTEGER NOT NULL,
+ enabled BOOLEAN NOT NULL DEFAULT 0,
+ topic TEXT NOT NULL,
+ server_url TEXT NOT NULL,
+ priority INTEGER NOT NULL DEFAULT 5,
+ title_template TEXT,
+ message_template TEXT,
+ FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
+);
+CREATE UNIQUE INDEX IF NOT EXISTS idx_user_ntfy_settings_user_id ON user_ntfy_settings(user_id);
+
+-- Migration: Create user_smtp_settings table
+CREATE TABLE IF NOT EXISTS user_smtp_settings (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ user_id INTEGER NOT NULL,
+ enabled BOOLEAN NOT NULL DEFAULT 0,
+ email TEXT NOT NULL,
+ smtp_server TEXT NOT NULL,
+ smtp_port INTEGER NOT NULL,
+ username TEXT,
+ password TEXT,
+ use_tls BOOLEAN NOT NULL DEFAULT 1,
+ from_email TEXT,
+ from_name TEXT DEFAULT 'Silmätaivas Alerts',
+ subject_template TEXT,
+ body_template TEXT,
+ FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
+);
+CREATE UNIQUE INDEX IF NOT EXISTS idx_user_smtp_settings_user_id ON user_smtp_settings(user_id); \ No newline at end of file