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: 20191209132634_nullify_invalid_assumed_teacher_id_reference_from_users.rb
    path of file: ./repos/i-diario/db/migrate
    
    the code of the file until where you have to start completion: class NullifyInvalidAssumedTeacherIdReferenceFromUsers < ActiveRecord::Migration[4.2]
  class Migr
    
  def change
    user_assumed_teacher_ids = MigrationUser.pluck(:assumed_teacher_id).uniq.compact
    teacher_ids = MigrationTeacher.where(id: user_assumed_teacher_ids).pluck(:id).uniq

    not_found = user_assumed_teacher_ids - teacher_ids

    MigrationUser.where(assumed_teacher_id: not_found).update_all(assumed_teacher_id: nil) if not_found.present?
  end