Change Row Level Security (#257)

Change all defined row level security policies, to apply the new
performance recommendations by Supabase.

See https://supabase.com/docs/guides/database/database-advisors?queryGroups=lint&lint=0003_auth_rls_initplan
This commit is contained in:
Rico Berger
2025-05-02 17:25:34 +02:00
committed by GitHub
parent eb331f1540
commit 9ef3ce60ca

View File

@@ -0,0 +1,20 @@
------------------------------------------------------------------------------------------------------------------------
-- Update all RLSs, to apply the new performance recommendations from Supabase.
------------------------------------------------------------------------------------------------------------------------
ALTER POLICY "User can insert own decks" ON "decks" TO authenticated WITH CHECK ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can update own decks" ON "decks" TO authenticated USING ((SELECT auth.uid()) = "userId") WITH CHECK ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can delete own decks" ON "decks" TO authenticated USING ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can select own decks" ON "decks" TO authenticated USING ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can insert own columns" ON "columns" TO authenticated WITH CHECK ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can update own columns" ON "columns" TO authenticated USING ((SELECT auth.uid()) = "userId") WITH CHECK ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can delete own columns" ON "columns" TO authenticated USING ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can select own columns" ON "columns" TO authenticated USING ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can update own sources" ON "sources" TO authenticated USING ((SELECT auth.uid()) = "userId") WITH CHECK ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can delete own sources" ON "sources" TO authenticated USING ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can select own sources" ON "sources" TO authenticated USING ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can update own items" ON "items" TO authenticated USING ((SELECT auth.uid()) = "userId") WITH CHECK ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can delete own items" ON "items" TO authenticated USING ((SELECT auth.uid()) = "userId");
ALTER POLICY "User can select own items" ON "items" TO authenticated USING ((SELECT auth.uid()) = "userId");