-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
163 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,149 +1,149 @@ | ||
-- -- Create buckets | ||
-- INSERT INTO STORAGE.buckets (id, name) | ||
-- VALUES ('project-assets', 'project-assets') ON CONFLICT DO NOTHING; | ||
|
||
-- INSERT INTO STORAGE.buckets (id, name) | ||
-- VALUES ('user-assets', 'user-assets') ON CONFLICT DO NOTHING; | ||
|
||
-- INSERT INTO STORAGE.buckets (id, name, public) | ||
-- VALUES ('public-user-assets', 'public-user-assets', TRUE) ON CONFLICT DO NOTHING; | ||
|
||
-- INSERT INTO STORAGE.buckets (id, name, public) | ||
-- VALUES ('public-assets', 'public-assets', TRUE) ON CONFLICT DO NOTHING; | ||
|
||
-- -- admin blog bucket | ||
-- INSERT INTO STORAGE.buckets (id, name, public) | ||
-- VALUES ('admin-blog', 'admin-blog', TRUE) ON CONFLICT DO NOTHING; | ||
|
||
-- -- Create policies | ||
-- DROP policy IF EXISTS "Give users access to own folder 10fq7k5_0" ON "storage"."objects"; | ||
-- CREATE policy "Give users access to own folder 10fq7k5_0" ON "storage"."objects" AS permissive FOR | ||
-- SELECT TO authenticated USING ( | ||
-- ( | ||
-- (bucket_id = 'user-assets'::text) | ||
-- AND ( | ||
-- ( | ||
-- ( | ||
-- SELECT ( | ||
-- SELECT auth.uid() | ||
-- ) | ||
-- ) | ||
-- )::text = (STORAGE.foldername(name)) [1] | ||
-- ) | ||
-- ) | ||
-- ); | ||
|
||
-- DROP policy IF EXISTS "Give users access to own folder 10fq7k5_1" ON "storage"."objects"; | ||
-- CREATE policy "Give users access to own folder 10fq7k5_1" ON "storage"."objects" AS permissive FOR | ||
-- INSERT TO authenticated WITH CHECK ( | ||
-- ( | ||
-- (bucket_id = 'user-assets'::text) | ||
-- AND ( | ||
-- ( | ||
-- ( | ||
-- SELECT auth.uid() | ||
-- ) | ||
-- )::text = (STORAGE.foldername(name)) [1] | ||
-- ) | ||
-- ) | ||
-- ); | ||
|
||
-- DROP policy IF EXISTS "Give users access to own folder 10fq7k5_2" ON "storage"."objects"; | ||
-- CREATE policy "Give users access to own folder 10fq7k5_2" ON "storage"."objects" AS permissive FOR | ||
-- UPDATE TO authenticated USING ( | ||
-- ( | ||
-- (bucket_id = 'user-assets'::text) | ||
-- AND ( | ||
-- ( | ||
-- ( | ||
-- SELECT auth.uid() | ||
-- ) | ||
-- )::text = (STORAGE.foldername(name)) [1] | ||
-- ) | ||
-- ) | ||
-- ); | ||
|
||
-- DROP policy IF EXISTS "Give users access to own folder 10fq7k5_3" ON "storage"."objects"; | ||
-- CREATE policy "Give users access to own folder 10fq7k5_3" ON "storage"."objects" AS permissive FOR DELETE TO authenticated USING ( | ||
-- ( | ||
-- (bucket_id = 'user-assets'::text) | ||
-- AND ( | ||
-- ( | ||
-- ( | ||
-- SELECT auth.uid() | ||
-- ) | ||
-- )::text = (STORAGE.foldername(name)) [1] | ||
-- ) | ||
-- ) | ||
-- ); | ||
|
||
-- DROP policy IF EXISTS "Give users access to own folder 1plzjhd_0" ON "storage"."objects"; | ||
-- CREATE policy "Give users access to own folder 1plzjhd_0" ON "storage"."objects" AS permissive FOR | ||
-- SELECT TO public USING (((bucket_id = 'public-user-assets'::text))); | ||
|
||
-- DROP policy IF EXISTS "Give users access to own folder 1plzjhd_1" ON "storage"."objects"; | ||
-- CREATE policy "Give users access to own folder 1plzjhd_1" ON "storage"."objects" AS permissive FOR | ||
-- INSERT TO public WITH CHECK ( | ||
-- ( | ||
-- (bucket_id = 'public-user-assets'::text) | ||
-- AND ( | ||
-- ( | ||
-- ( | ||
-- SELECT auth.uid() | ||
-- ) | ||
-- )::text = (STORAGE.foldername(name)) [1] | ||
-- ) | ||
-- ) | ||
-- ); | ||
|
||
-- DROP policy IF EXISTS "Give users access to own folder 1plzjhd_2" ON "storage"."objects"; | ||
-- CREATE policy "Give users access to own folder 1plzjhd_2" ON "storage"."objects" AS permissive FOR | ||
-- UPDATE TO public USING ( | ||
-- ( | ||
-- (bucket_id = 'public-user-assets'::text) | ||
-- AND ( | ||
-- ( | ||
-- ( | ||
-- SELECT auth.uid() | ||
-- ) | ||
-- )::text = (STORAGE.foldername(name)) [1] | ||
-- ) | ||
-- ) | ||
-- ); | ||
|
||
-- DROP policy IF EXISTS "Give users access to own folder 1plzjhd_3" ON "storage"."objects"; | ||
-- CREATE policy "Give users access to own folder 1plzjhd_3" ON "storage"."objects" AS permissive FOR DELETE TO public USING ( | ||
-- ( | ||
-- (bucket_id = 'public-user-assets'::text) | ||
-- AND ( | ||
-- ( | ||
-- ( | ||
-- SELECT auth.uid() | ||
-- ) | ||
-- )::text = (STORAGE.foldername(name)) [1] | ||
-- ) | ||
-- ) | ||
-- ); | ||
|
||
-- DROP policy IF EXISTS "anything 1plzjhd_0" ON "storage"."objects"; | ||
-- CREATE policy "anything 1plzjhd_0" ON "storage"."objects" AS permissive FOR | ||
-- UPDATE TO public USING (TRUE); | ||
|
||
-- DROP policy IF EXISTS "anything 1plzjhd_1" ON "storage"."objects"; | ||
-- CREATE policy "anything 1plzjhd_1" ON "storage"."objects" AS permissive FOR | ||
-- SELECT TO public USING (TRUE); | ||
|
||
-- DROP policy IF EXISTS "anything 1plzjhd_2" ON "storage"."objects"; | ||
-- CREATE policy "anything 1plzjhd_2" ON "storage"."objects" AS permissive FOR DELETE TO public USING (TRUE); | ||
|
||
-- DROP policy IF EXISTS "Public Access for public-assets 1plzjha_3" ON "storage"."objects"; | ||
-- CREATE policy "Public Access for public-assets 1plzjha_3" ON STORAGE.objects FOR | ||
-- SELECT USING (bucket_id = 'public-assets'); | ||
|
||
-- -- anyone can view assets in admin-blog | ||
-- DROP policy IF EXISTS "Public Access for admin-blog" ON "storage"."objects"; | ||
-- CREATE policy "Public Access for admin-blog " ON STORAGE.objects FOR | ||
-- SELECT USING (bucket_id = 'admin-blog'); | ||
|
||
-- INSERT INTO app_settings (id) | ||
-- VALUES (1) ON CONFLICT DO NOTHING; | ||
-- Create buckets | ||
INSERT INTO STORAGE.buckets (id, name) | ||
VALUES ('project-assets', 'project-assets') ON CONFLICT DO NOTHING; | ||
|
||
INSERT INTO STORAGE.buckets (id, name) | ||
VALUES ('user-assets', 'user-assets') ON CONFLICT DO NOTHING; | ||
|
||
INSERT INTO STORAGE.buckets (id, name, public) | ||
VALUES ('public-user-assets', 'public-user-assets', TRUE) ON CONFLICT DO NOTHING; | ||
|
||
INSERT INTO STORAGE.buckets (id, name, public) | ||
VALUES ('public-assets', 'public-assets', TRUE) ON CONFLICT DO NOTHING; | ||
|
||
-- admin blog bucket | ||
INSERT INTO STORAGE.buckets (id, name, public) | ||
VALUES ('admin-blog', 'admin-blog', TRUE) ON CONFLICT DO NOTHING; | ||
|
||
-- Create policies | ||
DROP policy IF EXISTS "Give users access to own folder 10fq7k5_0" ON "storage"."objects"; | ||
CREATE policy "Give users access to own folder 10fq7k5_0" ON "storage"."objects" AS permissive FOR | ||
SELECT TO authenticated USING ( | ||
( | ||
(bucket_id = 'user-assets'::text) | ||
AND ( | ||
( | ||
( | ||
SELECT ( | ||
SELECT auth.uid() | ||
) | ||
) | ||
)::text = (STORAGE.foldername(name)) [1] | ||
) | ||
) | ||
); | ||
|
||
DROP policy IF EXISTS "Give users access to own folder 10fq7k5_1" ON "storage"."objects"; | ||
CREATE policy "Give users access to own folder 10fq7k5_1" ON "storage"."objects" AS permissive FOR | ||
INSERT TO authenticated WITH CHECK ( | ||
( | ||
(bucket_id = 'user-assets'::text) | ||
AND ( | ||
( | ||
( | ||
SELECT auth.uid() | ||
) | ||
)::text = (STORAGE.foldername(name)) [1] | ||
) | ||
) | ||
); | ||
|
||
DROP policy IF EXISTS "Give users access to own folder 10fq7k5_2" ON "storage"."objects"; | ||
CREATE policy "Give users access to own folder 10fq7k5_2" ON "storage"."objects" AS permissive FOR | ||
UPDATE TO authenticated USING ( | ||
( | ||
(bucket_id = 'user-assets'::text) | ||
AND ( | ||
( | ||
( | ||
SELECT auth.uid() | ||
) | ||
)::text = (STORAGE.foldername(name)) [1] | ||
) | ||
) | ||
); | ||
|
||
DROP policy IF EXISTS "Give users access to own folder 10fq7k5_3" ON "storage"."objects"; | ||
CREATE policy "Give users access to own folder 10fq7k5_3" ON "storage"."objects" AS permissive FOR DELETE TO authenticated USING ( | ||
( | ||
(bucket_id = 'user-assets'::text) | ||
AND ( | ||
( | ||
( | ||
SELECT auth.uid() | ||
) | ||
)::text = (STORAGE.foldername(name)) [1] | ||
) | ||
) | ||
); | ||
|
||
DROP policy IF EXISTS "Give users access to own folder 1plzjhd_0" ON "storage"."objects"; | ||
CREATE policy "Give users access to own folder 1plzjhd_0" ON "storage"."objects" AS permissive FOR | ||
SELECT TO public USING (((bucket_id = 'public-user-assets'::text))); | ||
|
||
DROP policy IF EXISTS "Give users access to own folder 1plzjhd_1" ON "storage"."objects"; | ||
CREATE policy "Give users access to own folder 1plzjhd_1" ON "storage"."objects" AS permissive FOR | ||
INSERT TO public WITH CHECK ( | ||
( | ||
(bucket_id = 'public-user-assets'::text) | ||
AND ( | ||
( | ||
( | ||
SELECT auth.uid() | ||
) | ||
)::text = (STORAGE.foldername(name)) [1] | ||
) | ||
) | ||
); | ||
|
||
DROP policy IF EXISTS "Give users access to own folder 1plzjhd_2" ON "storage"."objects"; | ||
CREATE policy "Give users access to own folder 1plzjhd_2" ON "storage"."objects" AS permissive FOR | ||
UPDATE TO public USING ( | ||
( | ||
(bucket_id = 'public-user-assets'::text) | ||
AND ( | ||
( | ||
( | ||
SELECT auth.uid() | ||
) | ||
)::text = (STORAGE.foldername(name)) [1] | ||
) | ||
) | ||
); | ||
|
||
DROP policy IF EXISTS "Give users access to own folder 1plzjhd_3" ON "storage"."objects"; | ||
CREATE policy "Give users access to own folder 1plzjhd_3" ON "storage"."objects" AS permissive FOR DELETE TO public USING ( | ||
( | ||
(bucket_id = 'public-user-assets'::text) | ||
AND ( | ||
( | ||
( | ||
SELECT auth.uid() | ||
) | ||
)::text = (STORAGE.foldername(name)) [1] | ||
) | ||
) | ||
); | ||
|
||
DROP policy IF EXISTS "anything 1plzjhd_0" ON "storage"."objects"; | ||
CREATE policy "anything 1plzjhd_0" ON "storage"."objects" AS permissive FOR | ||
UPDATE TO public USING (TRUE); | ||
|
||
DROP policy IF EXISTS "anything 1plzjhd_1" ON "storage"."objects"; | ||
CREATE policy "anything 1plzjhd_1" ON "storage"."objects" AS permissive FOR | ||
SELECT TO public USING (TRUE); | ||
|
||
DROP policy IF EXISTS "anything 1plzjhd_2" ON "storage"."objects"; | ||
CREATE policy "anything 1plzjhd_2" ON "storage"."objects" AS permissive FOR DELETE TO public USING (TRUE); | ||
|
||
DROP policy IF EXISTS "Public Access for public-assets 1plzjha_3" ON "storage"."objects"; | ||
CREATE policy "Public Access for public-assets 1plzjha_3" ON STORAGE.objects FOR | ||
SELECT USING (bucket_id = 'public-assets'); | ||
|
||
-- anyone can view assets in admin-blog | ||
DROP policy IF EXISTS "Public Access for admin-blog" ON "storage"."objects"; | ||
CREATE policy "Public Access for admin-blog " ON STORAGE.objects FOR | ||
SELECT USING (bucket_id = 'admin-blog'); | ||
|
||
INSERT INTO app_settings (id) | ||
VALUES (1) ON CONFLICT DO NOTHING; |
14 changes: 7 additions & 7 deletions
14
supabase/migrations/20240423143011_changelogs_storage_bucket.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
-- insert into storage.buckets(id, name, public, file_size_limit) values ('changelog-assets', 'changelog-assets', true, 52428800); | ||
insert into storage.buckets(id, name, public, file_size_limit) values ('changelog-assets', 'changelog-assets', true, 52428800); | ||
|
||
-- create policy "Allow users to read their changelog assets" | ||
-- on "storage"."objects" | ||
-- as permissive | ||
-- for select | ||
-- to public | ||
-- using ((bucket_id = 'changelog-assets'::text)); | ||
create policy "Allow users to read their changelog assets" | ||
on "storage"."objects" | ||
as permissive | ||
for select | ||
to public | ||
using ((bucket_id = 'changelog-assets'::text)); | ||
|
||
|
14 changes: 7 additions & 7 deletions
14
supabase/migrations/20240522201153_openai_images_bucket.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
-- insert into storage.buckets(id, name, public, file_size_limit) values ('openai-images', 'openai-images', true, 52428800); | ||
insert into storage.buckets(id, name, public, file_size_limit) values ('openai-images', 'openai-images', true, 52428800); | ||
|
||
-- create policy "Allow users to read their openai images" | ||
-- on "storage"."objects" | ||
-- as permissive | ||
-- for select | ||
-- to public | ||
-- using ((bucket_id = 'openai-images'::text)); | ||
create policy "Allow users to read their openai images" | ||
on "storage"."objects" | ||
as permissive | ||
for select | ||
to public | ||
using ((bucket_id = 'openai-images'::text)); | ||
|
||
|