finalized reminder notification system migrations

This commit is contained in:
2026-03-21 12:58:38 +08:00
parent b2c3202317
commit 7d9096963a
5 changed files with 530 additions and 27 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Fallback notification processor — use if pg_cron + pg_net aren't working.
#
# The edge function handles BOTH enqueue and process internally,
# so this single call is all that's needed.
#
# Setup:
# 1. Set environment variables (or replace inline):
# export SUPABASE_URL="https://YOUR_PROJECT.supabase.co"
# export SUPABASE_SERVICE_ROLE_KEY="your-service-role-key"
#
# 2. Add to crontab (runs every minute):
# */1 * * * * /path/to/supabase/cron_fallback.sh >> /var/log/tasq_notifications.log 2>&1
if [ -z "$SUPABASE_URL" ] || [ -z "$SUPABASE_SERVICE_ROLE_KEY" ]; then
echo "$(date -Iseconds) ERROR: SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY must be set"
exit 1
fi
curl -sS -X POST \
"${SUPABASE_URL}/functions/v1/process_scheduled_notifications" \
-H "Authorization: Bearer ${SUPABASE_SERVICE_ROLE_KEY}" \
-H "Content-Type: application/json" \
-d '{}' \
-o /dev/null -w "$(date -Iseconds) status=%{http_code}\n"