Zurück zur Lektion

Ursprüngliche Arbeitsdatei

schema.sql

Code und funktionsfähige Beispielseiten behalten ihre ursprünglichen Bezeichner und Beispieltexte. Die Lektion und die Dateihinweise erklären sie in deiner Sprache.

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);