Files
Sauci/apps/supabase/migrations/20251227173000_update_responses_rls.sql
T
2025-12-27 19:10:11 +00:00

10 lines
352 B
SQL

-- Allow users to view their partner's responses in addition to their own
DROP POLICY IF EXISTS "Users can view own responses" ON public.responses;
CREATE POLICY "Users can view couple responses"
ON public.responses FOR SELECT
USING (
user_id = auth.uid() OR
couple_id IN (SELECT couple_id FROM public.profiles WHERE id = auth.uid())
);