mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 11:38:21 +01:00
The managed Supabase Cloud project (ohkueislstxomdjavyhs) is retired; the self-hosted instance at supabase.orangecat.ch on the Hetzner box is the single source of truth. Repoint the image host + setup scripts, rewrite the agent/dev guidance to use the self-host directly (not the Supabase MCP, which only reaches the retired cloud), update active docs, exit retired cloud-Management-API scripts behind a RETIRED guard, env-ify direct-connect scripts, gitignore .env-backups, and add a founder-run DECOMMISSION-CLOUD runbook. No live code path references the managed project anymore. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
54 lines
1.9 KiB
Bash
Executable File
54 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
SERVICE_KEY="${SUPABASE_SERVICE_ROLE_KEY}"
|
|
BASE_URL="${NEXT_PUBLIC_SUPABASE_URL:?NEXT_PUBLIC_SUPABASE_URL is required (self-hosted: https://supabase.orangecat.ch) - managed cloud retired}"
|
|
|
|
echo "=== Applying messaging fixes via SQL ==="
|
|
|
|
# Read the SQL file
|
|
SQL_CONTENT=$(cat /home/g/dev/orangecat/supabase/migrations/20251222_fix_messaging_complete.sql)
|
|
|
|
# Execute SQL via the REST API RPC
|
|
# Note: This requires a custom function or direct database access
|
|
# For now, let's test the individual operations
|
|
|
|
echo "Testing get_user_conversations RPC..."
|
|
curl -s "${BASE_URL}/rest/v1/rpc/get_user_conversations" \
|
|
-H "apikey: ${SERVICE_KEY}" \
|
|
-H "Authorization: Bearer ${SERVICE_KEY}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"p_user_id": "cec88bc9-557f-452b-92f1-e093092fecd6"}' | jq '. | length'
|
|
|
|
echo ""
|
|
echo "Testing get_total_unread_count RPC..."
|
|
curl -s "${BASE_URL}/rest/v1/rpc/get_total_unread_count" \
|
|
-H "apikey: ${SERVICE_KEY}" \
|
|
-H "Authorization: Bearer ${SERVICE_KEY}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"p_user_id": "cec88bc9-557f-452b-92f1-e093092fecd6"}' | jq .
|
|
|
|
echo ""
|
|
echo "Testing message sending..."
|
|
CONV_ID="2ef0fe8f-79ba-497e-8fe2-b66a9e4759a3"
|
|
SENDER_ID="cec88bc9-557f-452b-92f1-e093092fecd6"
|
|
|
|
# Test direct message insertion via REST API
|
|
echo "Testing direct message insertion..."
|
|
curl -s "${BASE_URL}/rest/v1/messages" \
|
|
-H "apikey: ${SERVICE_KEY}" \
|
|
-H "Authorization: Bearer ${SERVICE_KEY}" \
|
|
-H "Content-Type: application/json" \
|
|
-H "Prefer: return=representation" \
|
|
-d "{
|
|
\"conversation_id\": \"${CONV_ID}\",
|
|
\"sender_id\": \"${SENDER_ID}\",
|
|
\"content\": \"Test message from script at $(date -Iseconds)\",
|
|
\"message_type\": \"text\"
|
|
}" | jq .
|
|
|
|
echo ""
|
|
echo "Checking messages in conversation..."
|
|
curl -s "${BASE_URL}/rest/v1/messages?conversation_id=eq.${CONV_ID}&order=created_at.desc&limit=5" \
|
|
-H "apikey: ${SERVICE_KEY}" \
|
|
-H "Authorization: Bearer ${SERVICE_KEY}" | jq '. | length'
|