create table public.posts ( id uuid primary key default gen_random_uuid(), title text not null, category text, price numeric(12,2) not null, description text, photos text[] not null, whatsapp text not null, author_name text, views integer default 0, created_at timestamptz default now() ); alter table public.posts enable row level security; grant select, insert on public.posts to anon, authenticated; grant update (views) on public.posts to anon, authenticated; create policy "Todos podem visualizar" on public.posts for select to anon, authenticated using (true); create policy "Todos podem publicar" on public.posts for insert to anon, authenticated with check (true); create policy "Atualizar visualizações" on public.posts for update to anon, authenticated using (true) with check (true); insert into storage.buckets (id, name, public) values ('post-images', 'post-images', true) on conflict (id) do update set public = true; create policy "Visualizar fotos públicas" on storage.objects for select to anon, authenticated using (bucket_id = 'post-images'); create policy "Enviar fotos" on storage.objects for insert to anon, authenticated with check (bucket_id = 'post-images');