riseup-squad18/scripts/debug-messages.sql
Seu Nome 04c6de47d5 feat: update Supabase connection details and enhance messaging functionality
- Changed Supabase URL and anon key for the connection.
- Added a cache buster file for page caching management.
- Integrated ChatMessages component into AcompanhamentoPaciente and MensagensMedico pages for improved messaging interface.
- Created new MensagensPaciente page for patient messaging.
- Updated PainelMedico to include messaging functionality with patients.
- Enhanced message service to support conversation retrieval and message sending.
- Added a test HTML file for Supabase connection verification and message table interaction.
2025-11-26 00:06:50 -03:00

34 lines
711 B
SQL

-- Script para debugar mensagens
-- 1. Ver todas as mensagens
SELECT
id,
sender_id,
receiver_id,
content,
read,
created_at
FROM public.messages
ORDER BY created_at DESC
LIMIT 20;
-- 2. Ver IDs únicos de remetentes e destinatários
SELECT 'Remetentes únicos:' as tipo, sender_id as user_id FROM public.messages
UNION
SELECT 'Destinatários únicos:', receiver_id FROM public.messages
ORDER BY tipo, user_id;
-- 3. Contar mensagens por remetente
SELECT
sender_id,
COUNT(*) as total_enviadas
FROM public.messages
GROUP BY sender_id;
-- 4. Contar mensagens por destinatário
SELECT
receiver_id,
COUNT(*) as total_recebidas
FROM public.messages
GROUP BY receiver_id;