Fix notification view security

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 00:25:17 +00:00
parent a3b52b777c
commit 036df6f5b7

View File

@@ -0,0 +1,20 @@
-- Fix: Remove SECURITY DEFINER from notification_health_dashboard view
-- Drop and recreate view without SECURITY DEFINER
DROP VIEW IF EXISTS public.notification_health_dashboard;
CREATE VIEW public.notification_health_dashboard
WITH (security_invoker = true) AS
SELECT
date,
total_attempts,
duplicates_prevented,
prevention_rate,
CASE
WHEN prevention_rate > 10 THEN 'critical'
WHEN prevention_rate > 5 THEN 'warning'
ELSE 'healthy'
END as health_status
FROM public.notification_duplicate_stats
ORDER BY date DESC
LIMIT 30;