To start sending live messages, run this SQL script in your Supabase SQL Editor to create the messages table and enable Realtime sync:
-- 1. Create messages table
create table if not exists public.messages (
id uuid primary key default gen_random_uuid(),
sender_name text not null,
content text not null,
created_at timestamp with time zone default now()
);
-- 2. Enable Realtime subscriptions on messages table
alter publication supabase_realtime add table public.messages;
-- 3. Setup Row Level Security (RLS) policies for anonymous access
alter table public.messages enable row level security;
create policy "Allow public select"
on public.messages for select
using (true);
create policy "Allow public insert"
on public.messages for insert
with check (true);