You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 20200721022652_migrate_profile_data.rb
    path of file: ./repos/homeland/db/migrate
    
    the code of the file until where you have to start completion: class MigrateProfileData < ActiveRecord::Migration[6.0]
  disable_ddl_transaction!

  def up
    say_with_time "Migration profile_fields..." do
      Setting.unscoped.where(thing_type: "User", var: "profile_fields").find_each do |setting|
        Profile.upsert({contacts: setting.value, user_id: setting.thing_id}, unique
    
  def up
    say_with_time "Migration profile_fields..." do
      Setting.unscoped.where(thing_type: "User", var: "profile_fields").find_each do |setting|
        Profile.upsert({contacts: setting.value, user_id: setting.thing_id}, unique_by: :user_id)
      end
    end

    say_with_time "Migration reward_fields..." do
      Setting.unscoped.where(thing_type: "User", var: "reward_fields").find_each do |setting|
        Profile.upsert({rewards: setting.value, user_id: setting.thing_id}, unique_by: :user_id)
      end
    end
  end