update public.profiles as profile
set recovery_email = lower(btrim(auth_user.raw_user_meta_data->>'recovery_email'))
from auth.users as auth_user
where profile.id = auth_user.id
  and profile.recovery_email is null
  and btrim(coalesce(auth_user.raw_user_meta_data->>'recovery_email', '')) <> '';
