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
1 line
No EOL
491 B
SQL
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()
|
|
|
|
)
|
|
|
|
);
|
|
|