nkbmusic/supabase/migrations/20261102000000_covers.sql
metatroncubeswdev d994fc733f Cover photos for albums and songs: upload in NK Admin, shown in the app
Songs without their own cover use their album's. Covers live in a public
'covers' bucket that only admins can write to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 14:23:43 -04:00

10 lines
590 B
SQL

-- Cover photos for albums and songs: covers/album/<id>-<time>.<ext>, covers/track/<id>-<time>.<ext>.
-- Anyone can view them (the app shows them to guests too); only admins upload, replace or delete.
insert into storage.buckets (id, name, public, file_size_limit, allowed_mime_types)
values ('covers', 'covers', true, 5242880, array['image/jpeg','image/png','image/webp'])
on conflict (id) do nothing;
create policy nk_admin_covers on storage.objects for all to authenticated
using (bucket_id = 'covers' and public.is_admin())
with check (bucket_id = 'covers' and public.is_admin());