mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 06:51:12 -05:00
20 lines
552 B
SQL
20 lines
552 B
SQL
-- 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; |