<commit_before>class AddInReplyToAccountIdToStatuses < ActiveRecord::Migration[5.0]
  def up
    add_column :statuses, :in_reply_to_account_id, :integer, null: true, default: nil

    ActiveRecord::Base.transaction do
      Status.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
        next if status.thread.nil?

        status.in_reply_to_account_id = status.thread.account_id
        status.save!
      end
    end
  end

  def down
    remove_column :statuses, :in_reply_to_account_id
  end
end<commit_msg>Make data migration more merciful<commit_after>class AddInReplyToAccountIdToStatuses < ActiveRecord::Migration[5.0]
  def up
    add_column :statuses, :in_reply_to_account_id, :integer, null: true, default: nil

    ActiveRecord::Base.transaction do
      Status.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
        next if status.thread.nil?

        status.in_reply_to_account_id = status.thread.account_id
        status.save(validate: false)
      end
    end
  end

  def down
    remove_column :statuses, :in_reply_to_account_id
  end
end
{'fraction_non_alphanumeric': 0.08333333333333333, 'fraction_numerical': 0.0036231884057971015, 'mean_word_length': 3.8464912280701755, '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': '3316178', 'n_tokens_mistral': 364, 'n_tokens_neox': 359, 'n_words': 74}