From 2931f6bb1d3457107f2428e27097f92061fd9a69 Mon Sep 17 00:00:00 2001 From: Giancarlo Buomprisco Date: Mon, 9 Sep 2024 16:59:49 +0800 Subject: [PATCH] Updated main migration with a fix to include user name and avatar if these are found (e.g. they come from oAuth) (#65) --- apps/web/supabase/migrations/20221215192558_schema.sql | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/web/supabase/migrations/20221215192558_schema.sql b/apps/web/supabase/migrations/20221215192558_schema.sql index 28a30e02f..716c27efe 100644 --- a/apps/web/supabase/migrations/20221215192558_schema.sql +++ b/apps/web/supabase/migrations/20221215192558_schema.sql @@ -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,