riseup-squad18/scripts/force-schema-reload.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

39 lines
1.1 KiB
SQL

-- SOLUÇÃO: Atualizar schema cache do Supabase
-- Execute este script no SQL Editor
-- 1. Verificar se a tabela existe
SELECT EXISTS (
SELECT FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = 'messages'
) as tabela_existe;
-- 2. Se retornou "true",force a atualização do cache com NOTIFY
NOTIFY pgrst, 'reload schema';
-- 3. Ou recrie a tabela garantindo que o PostgREST veja
DROP TABLE IF EXISTS public.messages CASCADE;
CREATE TABLE public.messages (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
sender_id UUID NOT NULL,
receiver_id UUID NOT NULL,
content TEXT NOT NULL,
read BOOLEAN DEFAULT false,
created_at TIMESTAMPTZ DEFAULT now()
);
-- 4. Permissões completas
GRANT ALL ON public.messages TO anon, authenticated, service_role;
-- 5. Comentário na tabela (ajuda o PostgREST)
COMMENT ON TABLE public.messages IS 'Tabela de mensagens entre usuários';
-- 6. Desabilitar RLS para testes
ALTER TABLE public.messages DISABLE ROW LEVEL SECURITY;
-- 7. Verificar se foi criada
SELECT table_name, table_schema
FROM information_schema.tables
WHERE table_name = 'messages';