From 21eeda71278c1a4d9c6860fb058dd7c9c3ba40d5 Mon Sep 17 00:00:00 2001 From: Hosteroid Date: Tue, 21 Oct 2025 13:33:01 +0300 Subject: [PATCH] Add webhook channel type to notification channels Introduces 'webhook' as a new channel_type option in the notification_channels table to support custom webhook integrations. Updates migration logic and adds a new migration script for this schema change. --- app/Controllers/InstallerController.php | 5 ++++- database/migrations/000_initial_schema_v1.1.0.sql | 2 +- database/migrations/019_add_webhook_channel_type.sql | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 database/migrations/019_add_webhook_channel_type.sql diff --git a/app/Controllers/InstallerController.php b/app/Controllers/InstallerController.php index 05c2c2c..f954c18 100644 --- a/app/Controllers/InstallerController.php +++ b/app/Controllers/InstallerController.php @@ -49,6 +49,7 @@ class InstallerController extends Controller '016_add_tags_to_domains.sql', '017_add_two_factor_authentication.sql', '018_add_user_isolation.sql', + '019_add_webhook_channel_type.sql', ]; try { @@ -183,7 +184,8 @@ class InstallerController extends Controller '015_create_error_logs_table.sql', '016_add_tags_to_domains.sql', '017_add_two_factor_authentication.sql', - '018_add_user_isolation.sql' + '018_add_user_isolation.sql', + '019_add_webhook_channel_type.sql' ]; } @@ -364,6 +366,7 @@ class InstallerController extends Controller '016_add_tags_to_domains.sql', '017_add_two_factor_authentication.sql', '018_add_user_isolation.sql', + '019_add_webhook_channel_type.sql', ]; $stmt = $pdo->prepare("INSERT INTO migrations (migration) VALUES (?) ON DUPLICATE KEY UPDATE migration=migration"); diff --git a/database/migrations/000_initial_schema_v1.1.0.sql b/database/migrations/000_initial_schema_v1.1.0.sql index bdfe997..1fa5573 100644 --- a/database/migrations/000_initial_schema_v1.1.0.sql +++ b/database/migrations/000_initial_schema_v1.1.0.sql @@ -182,7 +182,7 @@ CREATE TABLE IF NOT EXISTS user_notifications ( CREATE TABLE IF NOT EXISTS notification_channels ( id INT AUTO_INCREMENT PRIMARY KEY, notification_group_id INT NOT NULL, - channel_type ENUM('email', 'telegram', 'discord', 'slack') NOT NULL, + channel_type ENUM('email', 'telegram', 'discord', 'slack', 'webhook') NOT NULL, channel_config JSON NOT NULL, is_active BOOLEAN DEFAULT TRUE, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, diff --git a/database/migrations/019_add_webhook_channel_type.sql b/database/migrations/019_add_webhook_channel_type.sql new file mode 100644 index 0000000..9482969 --- /dev/null +++ b/database/migrations/019_add_webhook_channel_type.sql @@ -0,0 +1,5 @@ +-- Add 'webhook' to the channel_type ENUM in notification_channels table +-- This allows custom webhook integrations like Mattermost + +ALTER TABLE notification_channels +MODIFY COLUMN channel_type ENUM('email', 'telegram', 'discord', 'slack', 'webhook') NOT NULL;