carlomigueldy.eth
08/03/2021, 7:40 AMsql
ALTER TABLE conversations ENABLE ROW LEVEL SECURITY;
DROP POLICY IF EXISTS "Allow read access only to involved participants" ON public.conversations;
CREATE POLICY "Allow read access only to involved participants"
ON public.conversations
FOR SELECT USING (
auth.uid() IN (
SELECT user_id
FROM conversation_participants
WHERE conversation_id = id
)
);
DROP POLICY IF EXISTS "Allow create access to conversations" ON public.conversations;
CREATE POLICY "Allow create access to conversations"
ON public.conversations
FOR INSERT WITH CHECK ( true );
DROP POLICY IF EXISTS "Allow update access to conversations" ON public.conversations;
CREATE POLICY "Allow update access to conversations"
ON public.conversations
FOR UPDATE WITH CHECK ( true );
DROP POLICY IF EXISTS "Allow delete access to conversations" ON public.conversations;
CREATE POLICY "Allow delete access to conversations"
ON public.conversations
FOR DELETE USING ( true );
silentworks
08/03/2021, 9:11 AMsql
SELECT user_id
FROM conversation_participants
WHERE conversation_id = id
carlomigueldy.eth
08/03/2021, 9:23 AMcarlomigueldy.eth
08/03/2021, 9:40 AMsilentworks
08/03/2021, 9:41 AMcarlomigueldy.eth
08/03/2021, 9:42 AMsilentworks
08/03/2021, 9:42 AMcarlomigueldy.eth
08/03/2021, 9:43 AMcarlomigueldy.eth
08/03/2021, 9:43 AMsilentworks
08/03/2021, 9:44 AMBy default, every time you run insert(), the client library will make a select to return the full record. This is convenient, but it can also cause problems if your Policies are not configured to allow the select operation. If you are using Row Level Security and you are encountering problems, try setting the returning param to minimal.
carlomigueldy.eth
08/03/2021, 9:45 AM