- Implemented user notification preferences table for managing default notification settings. - Created sag_reminders table to define reminder rules with various trigger types and recipient configurations. - Developed sag_reminder_queue for processing reminder events triggered by status changes or scheduled times. - Added sag_reminder_logs to track reminder notifications and user interactions. - Introduced frontend notification system using Bootstrap 5 Toast for displaying reminders. - Created email template for sending reminders with case details and action links. - Implemented rate limiting for user notifications to prevent spamming. - Added triggers and functions for automatic updates and reminder processing.
17 lines
474 B
SQL
17 lines
474 B
SQL
-- Migration 091: Sag contacts primary flag
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF NOT EXISTS (
|
|
SELECT 1 FROM information_schema.columns
|
|
WHERE table_name = 'sag_kontakter' AND column_name = 'is_primary'
|
|
) THEN
|
|
ALTER TABLE sag_kontakter ADD COLUMN is_primary BOOLEAN DEFAULT FALSE;
|
|
END IF;
|
|
END $$;
|
|
|
|
-- Ensure only one primary contact per case
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_sag_kontakter_primary
|
|
ON sag_kontakter (sag_id)
|
|
WHERE is_primary = TRUE;
|