Fichier fonctionnel d’origine
schema.sql
Le code et les pages d’exemple fonctionnelles conservent leurs identifiants et leurs textes d’origine. La leçon et les consignes des fichiers les expliquent dans votre langue.
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);