Files
coder/coderd/database/migrations/000368_add_custom_notifications.down.sql
T
Susana Ferreira eec6c8c120 feat: support custom notifications (#19751)
## Description

Adds support for sending an ad‑hoc custom notification to the
authenticated user via API and CLI. This is useful for surfacing the
result of scripts or long‑running tasks. Notifications are delivered
through the configured method and the dashboard Inbox, respecting
existing preferences and delivery settings.

## Changes

* New notification template: “Custom Notification” with a label for a
custom title and a custom message.
* New API endpoint: `POST /api/v2/notifications/custom` to send a custom
notification to the requesting user.
* New API endpoint: `GET /notifications/templates/custom` to get custom
notification template.
* New CLI subcommand: `coder notifications custom <title> <message>` to
send a custom notification to the requesting user.
* Documentation updates: Add a “Custom notifications” section under
Administration > Monitoring > Notifications, including instructions on
sending custom notifications and examples of when to use them.

Closes: https://github.com/coder/coder/issues/19611
2025-09-11 15:08:57 +02:00

16 lines
709 B
SQL

-- Remove Custom Notification template
DELETE FROM notification_templates WHERE id = '39b1e189-c857-4b0c-877a-511144c18516';
-- Recreate the old enum without 'custom'
CREATE TYPE old_notification_template_kind AS ENUM ('system');
-- Update notification_templates to use the old enum
ALTER TABLE notification_templates
ALTER COLUMN kind DROP DEFAULT,
ALTER COLUMN kind TYPE old_notification_template_kind USING (kind::text::old_notification_template_kind),
ALTER COLUMN kind SET DEFAULT 'system'::old_notification_template_kind;
-- Drop the current enum and restore the original name
DROP TYPE notification_template_kind;
ALTER TYPE old_notification_template_kind RENAME TO notification_template_kind;