22 lines
1016 B
SQL
22 lines
1016 B
SQL
-- Storage-Bucket für Mitarbeiter-Fotos. Bisher musste dieser Bucket bei
|
|
-- jeder neuen Instanz manuell in Supabase Studio angelegt werden — das war
|
|
-- die einzige Storage-Ressource ohne Migration (branding-assets kommt aus
|
|
-- 0006). Damit ein frisches Onboarding rein über die Migrationen läuft,
|
|
-- legen wir den Bucket hier idempotent an.
|
|
--
|
|
-- Öffentlich, weil die Karten-Fotos via next/image direkt aus der
|
|
-- public-Storage-Route geladen werden (Host in next.config.ts whitelisted).
|
|
-- Uploads laufen ausschließlich über die Service-Role (Server Action
|
|
-- saveEmployee / Portal-Upload) und umgehen RLS — daher keine Insert-Policy
|
|
-- für anon nötig, nur Lesezugriff.
|
|
|
|
insert into storage.buckets (id, name, public)
|
|
values ('employee-photos', 'employee-photos', true)
|
|
on conflict (id) do nothing;
|
|
|
|
drop policy if exists "public_read_employee_photos" on storage.objects;
|
|
create policy "public_read_employee_photos"
|
|
on storage.objects for select
|
|
to anon
|
|
using (bucket_id = 'employee-photos');
|