sipher/supabase/sql_snippets/Enable Replication 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
573 B
SQL

-- This snippet checks if the messages table is already part of the publication before attempting to add it.
-- Enable replication for the messages table
ALTER TABLE public.messages REPLICA IDENTITY FULL;
-- Check if the messages table is already part of the publication
DO
$$
BEGIN
IF
NOT EXISTS (
SELECT 1
FROM pg_publication_tables
WHERE pubname = 'supabase_realtime' AND schemaname = 'public' AND tablename = 'messages'
) THEN
ALTER
PUBLICATION supabase_realtime
ADD TABLE public.messages;
END IF;
END $$;