<commit_before>class MergeFirstAndLastName < Mongoid::Migration
  def self.up
    User.all.each do |u|
      u.full_name = u[:first_name] + ' ' + u[:last_name]
      u.remove_attribute(:first_name)
      u.remove_attribute(:last_name)
      u.save(validate: false)
    end
  end

  def self.down
    fail "This is a destructive migration."
  end
end<commit_msg>Fixed migration for users without a first or last name<commit_after>class MergeFirstAndLastName < Mongoid::Migration
  def self.up
    User.all.each do |u|
      if u[:full_name].blank?
        u.full_name = "#{u[:first_name]} #{u[:last_name]}"
        u.remove_attribute(:first_name)
        u.remove_attribute(:last_name)
        u.save(validate: false)
      end
    end
  end

  def self.down
    fail "This is a destructive migration."
  end
end
{'fraction_non_alphanumeric': 0.10727496917385944, 'fraction_numerical': 0.0, 'mean_word_length': 3.01980198019802, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4937715', 'n_tokens_mistral': 272, 'n_tokens_neox': 269, 'n_words': 65}