<commit_before>class AddItemsCountToTables < ActiveRecord::Migration
  def self.up
    add_column :members, :items_count, :integer, :default => 0
    add_column :raids, :items_count, :integer, :default => 0
  end

  def self.down
    remove_column :raids, :items_count<commit_msg>Populate the new items_count fields we create, though for some reason this doesn't work for the Raid items_count field.<commit_after>class AddItemsCountToTables < ActiveRecord::Migration
  def self.up
    add_column :members, :items_count, :integer, :default => 0
    add_column :raids, :items_count, :integer, :default => 0

    Raid.reset_column_information
    Raid.all.each do |raid|
      raid.update_attendee_cache = false
      raid.update_attribute :items_count, raid.items.length
    end

    Member.reset_column_information
    Member.all.each do |member|
      member.update_attribute :items_count, member.items.length
    end
  end

  def self.down
    remove_column :raids, :items_count
{'fraction_non_alphanumeric': 0.08478038815117467, 'fraction_numerical': 0.0040858018386108275, 'mean_word_length': 4.212765957446808, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6267565', 'n_tokens_mistral': 307, 'n_tokens_neox': 299, 'n_words': 81}