sipher/supabase/sql_snippets/Check and Set Replica Identity for Messages Table.sql
Nixyi 8b27c6b140 Stable Release (I think)
Added all SQL scripts by using a python script to fetch them.

Also added a "About" page and a skeleton to the chat page.

Fixed the register function that was not setting the public_key on the database
2024-12-18 16:08:06 -03:00

1 line
No EOL
491 B
SQL

ALTER TABLE public.messages REPLICA IDENTITY FULL;
-- 2. Drop existing policies
DROP
POLICY IF EXISTS "messages_access" ON public.messages;
-- 3. Create one simple policy for messages
CREATE
POLICY "messages_realtime" ON public.messages
FOR ALL
USING (
sender_uuid = auth.uid() OR -- Either you sent it
thread_id IN ( -- Or you're in the thread
SELECT thread_id
FROM thread_participants
WHERE user_uuid = auth.uid()
)
);