<commit_before>class AddDigestFieldsToTranslations < ActiveRecord::Migration
  def up
    # Translations must have a source_copy to translate
    change_column :translations, :source_copy, :text, null: false
    add_column :translations, :source_copy_sha_raw, :binary

    # Populate the source copy sha for all existing translations
    Translation.all.each do |translation|
      translation.update_attributes!(updated_at: Time.now)
    end

    # Now add the non-null constraint and add an index
    change_column :translations, :source_copy_sha_raw, :binary, null: false
    add_index :translations, :source_copy_sha_raw
  end

  def down
    remove_column :translations, :source_copy_sha_raw
    change_column :translations, :source_copy, :text, null: true
  end
end<commit_msg>Addressed PR review comments<commit_after>class AddDigestFieldsToTranslations < ActiveRecord::Migration
  def up
    # Translations must have a source_copy to translate
    change_column_null :translations, :source_copy, false
    add_column :translations, :source_copy_sha_raw, :binary

    # Populate the source copy sha for all existing translations
    Translation.all.each do |translation|
      translation.update_attributes!(updated_at: Time.now)
    end

    # Now add the non-null constraint and add an index
    change_column_null :translations, :source_copy_sha_raw, false
    add_index :translations, :source_copy_sha_raw
  end

  def down
    change_column_null :translations, :source_copy, :text, true
    remove_column :translations, :source_copy_sha_raw
  end
end
{'fraction_non_alphanumeric': 0.06209987195902689, 'fraction_numerical': 0.0, 'mean_word_length': 4.683636363636364, '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': '6078207', 'n_tokens_mistral': 463, 'n_tokens_neox': 452, 'n_words': 135}