-- Grant INSERT permission on realtime.messages for broadcast functionality
-- This allows SECURITY DEFINER trigger functions to insert broadcast messages

GRANT INSERT ON realtime.messages TO postgres;
GRANT INSERT ON realtime.messages TO service_role;

-- Also ensure SELECT is granted for completeness
GRANT SELECT ON realtime.messages TO postgres;
GRANT SELECT ON realtime.messages TO service_role;