Pete | grid0.xyz
04/04/2022, 12:10 AMsilentworks
04/04/2022, 12:21 AMprofiles
table which I assume you have row level security (RLS) turned on on.Pete | grid0.xyz
04/04/2022, 12:22 AMsilentworks
04/04/2022, 12:23 AMPete | grid0.xyz
04/04/2022, 12:23 AMsilentworks
04/04/2022, 12:24 AMPete | grid0.xyz
04/04/2022, 12:36 AMsilentworks
04/04/2022, 12:38 AMsignUp
function and pull them out through the trigger, so you will need to recreate your trigger function.silentworks
04/04/2022, 12:39 AMsilentworks
04/04/2022, 12:40 AMsignUp
function here which has the additional data https://github.com/silentworks/waiting-list/blob/main/src/lib/data/queries/users/auth.js#L20-L29Pete | grid0.xyz
04/04/2022, 2:18 AMPete | grid0.xyz
04/04/2022, 2:20 AMPete | grid0.xyz
04/04/2022, 2:20 AMconst { error } = await supabase.auth.signUp(
{ email: formData.email, password: formData.password },
{
data: {
full_name: formData.fullName,
username: formData.username
}
}
)
Pete | grid0.xyz
04/04/2022, 2:22 AMPete | grid0.xyz
04/04/2022, 2:22 AMcreate or replace function public.handle_new_user()
returns trigger as $$
begin
insert into public.profiles (id, email, username, full_name)
values (new.id, new.email, new.raw_user_meta_data->>'username', new.raw_user_meta_data->>'full_name');
return new;
end;
$$ language plpgsql security definer;
create trigger on_auth_user_created
after insert on auth.users
for each row execute procedure public.handle_new_user();
chrisb2244
04/04/2022, 9:45 AMsilentworks
04/04/2022, 10:57 AMchrisb2244
04/04/2022, 11:30 AMafter insert on auth.users
?
Is the verification also part of auth.users? (i.e., can I run after update on auth.users when new.role = "authenticated"
or similar?
Related, is there a page describing the schema for the built-in tables?silentworks
04/04/2022, 11:45 AMupdate
instead of insert
and check if the verified filed has changed, but this feels like a lot of work with not much value. Because if you set the username before the user is verified it isn't really causing any issues there.
You can view the schema from the table viewer inside the dashboard by selecting the auth schema or by using a SQL desktop client like TablePlus or Beekeeper Studio.chrisb2244
04/04/2022, 11:45 AMchrisb2244
04/04/2022, 11:45 AMchrisb2244
04/04/2022, 11:49 AMsilentworks
04/04/2022, 11:49 AM