Important question about importing users

Hello, community. I’ve been learning and remaking an import script for my site on Livestreet CMS for a couple of weeks. I have already finished writing the script, it remains to clean it up and make a pull request.

I have already imported all users too, with the exception of those who use authorization through services. The question is: How to import those users from a donor site to a Discourse who use authorization via Facebook or Google? I want to find the most elegant solution. The problem is also that some Facebook users do not have emails.

Bonus! Importing likes with date_added parameter.

I also found another method to import likes with a date, since the old method in other scripts does not work.

likes = mysql_query(<<-SQL
    SELECT target_id
         , user_voter_id
         , vote_date
         , target_type
      FROM #{TABLE_PREFIX}vote
     WHERE vote_direction = 1
     ORDER BY vote_date
SQL
).to_a

likes.each do |l|
  next unless user_id = user_id_from_imported_user_id(l["user_voter_id"])
  next unless post_id = post_id_from_imported_post_id("post-#{l["target_id"]}") 
  next unless user = User.find_by(id: user_id)
  next unless post = Post.find_by(id: post_id)
  PostActionCreator.create(user, post, PostActionType.types[2], created_at: Time.at(l["vote_date"])); #PostActionType.types[2] is like
end