Updated main migration with a fix to include user name and avatar if these are found (e.g. they come from oAuth) (#65)

This commit is contained in:
Giancarlo Buomprisco
2024-09-09 16:59:49 +08:00
committed by GitHub
parent b2f4cf039c
commit 2931f6bb1d

View File

@@ -2297,8 +2297,8 @@ set
declare
user_name text;
begin
if new.raw_user_meta_data ->> 'display_name' is not null then
user_name := new.raw_user_meta_data ->> 'display_name';
if new.raw_user_meta_data ->> 'name' is not null then
user_name := new.raw_user_meta_data ->> 'name';
end if;
@@ -2312,6 +2312,11 @@ begin
end if;
if new.raw_user_meta_data ->> 'avatar_url' is not null then
new.picture_url := new.raw_user_meta_data ->> 'avatar_url';
end if;
insert into public.accounts(
id,
primary_owner_user_id,