Arquivo funcional original
schema.sql
O código e as páginas funcionais de exemplo mantêm seus identificadores e textos originais. A lição e as orientações dos arquivos explicam esses elementos no seu idioma.
create table public.profiles (
id uuid primary key references auth.users(id) on delete cascade,
display_name text not null check (char_length(display_name) between 1 and 80)
);
alter table public.profiles enable row level security;
revoke all on public.profiles from anon;
grant select,insert,update on public.profiles to authenticated;
create policy "read own" on public.profiles for select to authenticated using (auth.uid()=id);
create policy "insert own" on public.profiles for insert to authenticated with check (auth.uid()=id);
create policy "update own" on public.profiles for update to authenticated using (auth.uid()=id) with check (auth.uid()=id);