<commit_before>class DestroyOrganizationAndPersonInfos < ActiveRecord::Migration
  def self.up
    Person.find(:all).each do |i|
      i.name = i.info.name unless i.info.name.nil?
      i.address = i.info.address unless i.info.address.nil?
      for field in [ :photo, :contact_information, :birth_date, :sex, :city, :state, :country ] do
        i.send("#{field}=", i.info.send(field))
      end
      i.save!
    end
    drop_table :person_infos

    Organization.find(:all).each do |i|
      for field in [ :contact_person, :contact_email, :acronym, :foundation_year, :legal_form, :economic_activity, :management_information, :validated ] do
        i.send("#{field}=", i.info.send(field))
      end
      i.save!
    end
    drop_table :organization_infos
  end

  def self.down<commit_msg>ActionItem380: fixed the migrations that do not function without the removed code<commit_after>class DestroyOrganizationAndPersonInfos < ActiveRecord::Migration
  def self.up
    Person.find(:all).each do |i|
      info = ActiveRecord::Base.connection.select_one("select * from person_infos where person_id = #{i.id}")
      i.name = info["name"] unless info["name"].nil?
      i.address = info["address"] unless info["address"].nil?
      [ "photo", "contact_information", "birth_date", "sex", "city", "state", "country" ].each do |field|
        i.send("#{field}=", info[field])
      end
      i.save!
    end
    drop_table :person_infos

    Organization.find(:all).each do |i|
      info = ActiveRecord::Base.connection.select_one("select * from organization_infos where organization_id = #{i.id}")
      [ "contact_person", "contact_email", "acronym", "foundation_year", "legal_form", "economic_activity", "management_information", "validated" ].each do |field|
        i.send("#{field}=", info[field])
      end
      i.save!
    end
    drop_table :organization_infos
  end

  def self.down
{'fraction_non_alphanumeric': 0.13946117274167988, 'fraction_numerical': 0.001584786053882726, 'mean_word_length': 3.6195121951219513, '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': '7656257', 'n_tokens_mistral': 607, 'n_tokens_neox': 605, 'n_words': 140}