From 5bdab4221178758a2847d21c727d3a3db3bd26a1 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 12:06:15 +0000 Subject: [PATCH] Refactor: Update ban expiration logic --- ...20603_9b7fc4c2-9320-49a9-9a26-f158e6085614.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 supabase/migrations/20251030120603_9b7fc4c2-9320-49a9-9a26-f158e6085614.sql diff --git a/supabase/migrations/20251030120603_9b7fc4c2-9320-49a9-9a26-f158e6085614.sql b/supabase/migrations/20251030120603_9b7fc4c2-9320-49a9-9a26-f158e6085614.sql new file mode 100644 index 00000000..ea19f119 --- /dev/null +++ b/supabase/migrations/20251030120603_9b7fc4c2-9320-49a9-9a26-f158e6085614.sql @@ -0,0 +1,15 @@ +-- Enable pg_cron extension if not already enabled +CREATE EXTENSION IF NOT EXISTS pg_cron; + +-- Schedule the process-expired-bans function to run every hour +SELECT cron.schedule( + 'process-expired-bans', + '0 * * * *', -- Every hour at minute 0 + $$ + SELECT net.http_post( + url := 'https://ydvtmnrszybqnbcqbdcy.supabase.co/functions/v1/process-expired-bans', + headers := '{"Content-Type": "application/json", "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlkdnRtbnJzenlicW5iY3FiZGN5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTgzMjYzNTYsImV4cCI6MjA3MzkwMjM1Nn0.DM3oyapd_omP5ZzIlrT0H9qBsiQBxBRgw2tYuqgXKX4"}'::jsonb, + body := '{}'::jsonb + ) as request_id; + $$ +); \ No newline at end of file