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: 20220404204439_copy_user_avatars_uploads_to_upload_references.rb
    path of file: ./repos/discourse/db/migrate
    
    the code of the file until where you have to start completion: # frozen_string_literal: tru
    
  def up
    execute <<~SQL
      INSERT INTO upload_references(upload_id, target_type, target_id, created_at, updated_at)
      SELECT user_avatars.custom_upload_id, 'UserAvatar', user_avatars.id, uploads.created_at, uploads.updated_at
      FROM user_avatars
      JOIN uploads ON uploads.id = user_avatars.custom_upload_id
      WHERE user_avatars.custom_upload_id IS NOT NULL
      ON CONFLICT DO NOTHING
    SQL

    execute <<~SQL
      INSERT INTO upload_references(upload_id, target_type, target_id, created_at, updated_at)
      SELECT user_avatars.gravatar_upload_id, 'UserAvatar', user_avatars.id, uploads.created_at, uploads.updated_at
      FROM user_avatars
      JOIN uploads ON uploads.id = user_avatars.gravatar_upload_id
      WHERE user_avatars.gravatar_upload_id IS NOT NULL
      ON CONFLICT DO NOTHING
    SQL
  end