I think I might
UserEmail.where("email like '%@brokendomain.com'").each do |e|
e.update(email: SecureRandom.hex + "@email.invalid)
end
Yours could work too, but Im’ not sure if the User model got updated to be able to do a u.email.include? after they moved emails to another model/table.