Add profile photo uploads and custom difficulty support
This commit is contained in:
34
supabase/migrations/20261013123545_profile_avatars.sql
Normal file
34
supabase/migrations/20261013123545_profile_avatars.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
alter table public.profiles
|
||||
add column avatar_path text;
|
||||
|
||||
insert into storage.buckets(id, name, public, file_size_limit, allowed_mime_types)
|
||||
values (
|
||||
'minegeo-avatars',
|
||||
'minegeo-avatars',
|
||||
true,
|
||||
5242880,
|
||||
array['image/jpeg', 'image/png', 'image/webp']
|
||||
)
|
||||
on conflict (id) do update set
|
||||
name = excluded.name,
|
||||
public = excluded.public,
|
||||
file_size_limit = excluded.file_size_limit,
|
||||
allowed_mime_types = excluded.allowed_mime_types;
|
||||
|
||||
create policy "MineGeo users upload their own avatars"
|
||||
on storage.objects
|
||||
for insert
|
||||
to authenticated
|
||||
with check (
|
||||
bucket_id = 'minegeo-avatars'
|
||||
and (storage.foldername(name))[1] = (select auth.uid()::text)
|
||||
);
|
||||
|
||||
create policy "MineGeo users delete their own avatars"
|
||||
on storage.objects
|
||||
for delete
|
||||
to authenticated
|
||||
using (
|
||||
bucket_id = 'minegeo-avatars'
|
||||
and (storage.foldername(name))[1] = (select auth.uid()::text)
|
||||
);
|
||||
Reference in New Issue
Block a user