create table profiles (
id uuid references auth.users on delete cascade not null primary key,
updated_at timestamp with time zone,
full_name text null,
age bigint null,
bio text null,
avatar_url text
);
-- This trigger automatically creates a profile entry when a new user signs up via Supabase Auth.
-- See https://supabase.com/docs/guides/auth/managing-user-data#using-triggers for more details.
create function public.handle_new_user()
returns trigger as $$
begin
insert into public.profiles (id, full_name, age, bio, avatar_url)
values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'age', new.raw_user_meta_data->>'bio', new.raw_user_meta_data->>'avatar_url');
return new;
end;
$$ language plpgsql security definer;
create trigger on_auth_user_created_new
after insert on auth.users
for each row execute procedure public.handle_new_user();
create table profiles (
id uuid references auth.users on delete cascade not null primary key,
updated_at timestamp with time zone,
full_name text null,
age bigint null,
bio text null,
avatar_url text
);
-- This trigger automatically creates a profile entry when a new user signs up via Supabase Auth.
-- See https://supabase.com/docs/guides/auth/managing-user-data#using-triggers for more details.
create function public.handle_new_user()
returns trigger as $$
begin
insert into public.profiles (id, full_name, age, bio, avatar_url)
values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'age', new.raw_user_meta_data->>'bio', new.raw_user_meta_data->>'avatar_url');
return new;
end;
$$ language plpgsql security definer;
create trigger on_auth_user_created_new
after insert on auth.users
for each row execute procedure public.handle_new_user();