-- Vion Training — scheduled email jobs (run in the Supabase SQL Editor). -- Uses pg_cron (scheduler) + pg_net (outbound HTTP) to call the deployed -- backend's /cron endpoints on a timer. Both extensions are available on the -- Supabase free tier. create extension if not exists pg_cron; create extension if not exists pg_net; -- Weekly summary / encouragement — every Monday at 07:00 UTC. select cron.schedule( 'vion-weekly', '0 7 * * 1', $$ select net.http_post( url := 'https://monicacarter-vion-training-v2.hf.space/cron/weekly', headers := jsonb_build_object( 'Content-Type', 'application/json', 'X-Cron-Secret', 'uIfqNB0nq5njAgFWdYLK6lzIR_YcX_j7zDhAD--XCqA' ), body := '{}'::jsonb ); $$ ); -- 5-hour-before reminders — every 15 minutes. select cron.schedule( 'vion-reminders', '*/15 * * * *', $$ select net.http_post( url := 'https://monicacarter-vion-training-v2.hf.space/cron/reminders', headers := jsonb_build_object( 'Content-Type', 'application/json', 'X-Cron-Secret', 'uIfqNB0nq5njAgFWdYLK6lzIR_YcX_j7zDhAD--XCqA' ), body := '{}'::jsonb ); $$ ); -- To inspect / remove later: -- select * from cron.job; -- select cron.unschedule('vion-weekly'); -- select cron.unschedule('vion-reminders');