30 lines
901 B
SQL
30 lines
901 B
SQL
insert into storage.buckets (id, name, public)
|
|
values ('media', 'media', true)
|
|
on conflict (id) do nothing;
|
|
|
|
alter table if exists storage.objects enable row level security;
|
|
|
|
drop policy if exists "Public read access for media bucket" on storage.objects;
|
|
create policy "Public read access for media bucket"
|
|
on storage.objects
|
|
for select
|
|
using (bucket_id = 'media');
|
|
|
|
drop policy if exists "Authenticated upload to media bucket" on storage.objects;
|
|
create policy "Authenticated upload to media bucket"
|
|
on storage.objects
|
|
for insert
|
|
with check (
|
|
bucket_id = 'media'
|
|
and auth.role() = 'authenticated'
|
|
);
|
|
|
|
drop policy if exists "Authenticated delete media bucket" on storage.objects;
|
|
create policy "Authenticated delete media bucket"
|
|
on storage.objects
|
|
for delete
|
|
using (
|
|
bucket_id = 'media'
|
|
and auth.role() = 'authenticated'
|
|
);
|