Skip to content

Commit 58f348a

Browse files
committed
update migrations
1 parent 08bc4a8 commit 58f348a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

supabase/migrations/20250101000000_create_profiles.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ ALTER TABLE "profiles" ADD CONSTRAINT "profiles_id_users_id_fk" FOREIGN KEY ("id
99

1010
CREATE INDEX "profiles_stripe_customer_id_idx" ON "profiles" ("stripe_customer_id");
1111

12-
CREATE POLICY "profiles_select_owner" ON "profiles" AS PERMISSIVE FOR SELECT TO "authenticated" USING ("profiles"."id" = auth.uid());
12+
CREATE POLICY "profiles_select_owner" ON "profiles" AS PERMISSIVE FOR SELECT TO "authenticated" USING ((select auth.uid()) = id);
1313

14-
CREATE POLICY "profiles_insert_owner" ON "profiles" AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ("profiles"."id" = auth.uid());
14+
CREATE POLICY "profiles_insert_owner" ON "profiles" AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ((select auth.uid()) = id);
1515

16-
CREATE POLICY "profiles_update_owner" ON "profiles" AS PERMISSIVE FOR UPDATE TO "authenticated" USING ("profiles"."id" = auth.uid()) WITH CHECK ("profiles"."id" = auth.uid());
16+
CREATE POLICY "profiles_update_owner" ON "profiles" AS PERMISSIVE FOR UPDATE TO "authenticated" USING ((select auth.uid()) = id) WITH CHECK ((select auth.uid()) = id);
1717

18-
CREATE POLICY "profiles_delete_owner" ON "profiles" AS PERMISSIVE FOR DELETE TO "authenticated" USING ("profiles"."id" = auth.uid());
18+
CREATE POLICY "profiles_delete_owner" ON "profiles" AS PERMISSIVE FOR DELETE TO "authenticated" USING ((select auth.uid()) = id);
1919

2020
CREATE POLICY "profiles_service_all" ON "profiles" AS PERMISSIVE FOR ALL TO "service_role" USING (true) WITH CHECK (true);
2121

supabase/migrations/20250101000003_create_audio_storage.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
INSERT INTO storage.buckets (id, name, public)
2-
VALUES ('audio-files', 'audio-files', false);
2+
VALUES ('audio-files', 'audio-files', false)
3+
ON CONFLICT (id) DO NOTHING;
34

45
CREATE POLICY "audio_files_select_owner" ON storage.objects FOR SELECT TO authenticated USING (bucket_id = 'audio-files' AND (SELECT auth.uid())::text = (storage.foldername(name))[1]);
56

0 commit comments

Comments
 (0)