Files
Warracker/backend/migrations/007_add_notification_preferences.sql
sassanix e045aae208 Vendor, Date Format, Added security
Refer to changelogs
2025-05-04 13:02:51 -03:00

25 lines
808 B
SQL

-- Add notification preferences columns if they don't exist
DO $$
BEGIN
-- Check if notification_frequency column exists
IF NOT EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_name = 'user_preferences'
AND column_name = 'notification_frequency'
) THEN
ALTER TABLE user_preferences
ADD COLUMN notification_frequency VARCHAR(10) NOT NULL DEFAULT 'daily';
END IF;
-- Check if notification_time column exists
IF NOT EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_name = 'user_preferences'
AND column_name = 'notification_time'
) THEN
ALTER TABLE user_preferences
ADD COLUMN notification_time VARCHAR(5) NOT NULL DEFAULT '09:00';
END IF;
END $$;