Hello all! I'm stuck on something seemingly simple, and I'm sure there's an easy and correct solution to this. I'm trying to add two fields to my standard Signup page: Username and DOB (date of birth), so that immediately after the Auth is creating a new row in my Supabase auth.users table, it also updates the 'username' field in the newly created row in public.user_data table with the value entered in the username field (and the same thing for the DOB field). (I keep Username and DOB fields in public.user_data table instead of auth.users table, as per good practices).
The Auth is creating the user in auth.users table perfectly well. I've also set up the Supabase to create a new row in public.user_data as soon as a new user is created in auth.users , and copies the id - and this works too. I achieved this with the following function:
BEGIN
-- Insert into user_data
INSERT INTO public.user_data (id, created_at, balance)
VALUES (NEW.id, now(), '0.00'::numeric);
RETURN NEW;
END;
I've added a secondary Action to "Join" button to take the value in 'username' field's Widget State and write it into the Supabase public.user_data -- (See the screenshot). But the new row in public.user_data is not updating the 'username' and 'DOB' columns.
I'm also attaching the screenshot for public.user_data RLS.
Can anyone help, please? How do I write contents of an additional text-field (username or DOB) on the signup page into a column in supabase's public.user_data table?