<commit_before>class RenameActiveToManualEnabled < ActiveRecord::Migration
  def self.up
    rename_column :listings, :active, :manual_enabled
    change_column :listings, :manual_enabled, :boolean, :null => true
    # Iterate over all listings to get listing_infos
    Listing.includes(:listing_infos).where(:listing_infos => {:key => 'ad_foreign_id'}).each do |listing|
      listing.listing_infos.where(:key => 'ad_foreign_id').each do |info|
        info.update_attribute(:value, nil)
      end
    end
  end

  def self.down
    change_column :listings, :manual_enabled, :boolean, :null => false
    rename_column :listings, :manual_enabled, :active
  end
end<commit_msg>Delete unused listing infos instead of setting their value to nil<commit_after>class RenameActiveToManualEnabled < ActiveRecord::Migration
  def self.up
    rename_column :listings, :active, :manual_enabled
    change_column :listings, :manual_enabled, :boolean, :null => true
    # Iterate over all listings to get listing_infos
    Listing.includes(:listing_infos).where(:listing_infos => {:key => 'ad_foreign_id'}).each do |listing|
      listing.listing_infos.where(:key => 'ad_foreign_id').each do |info|
        info.destroy
      end
    end
  end

  def self.down
    change_column :listings, :manual_enabled, :boolean, :null => false
    rename_column :listings, :manual_enabled, :active
  end
end
{'fraction_non_alphanumeric': 0.10419681620839363, 'fraction_numerical': 0.0, 'mean_word_length': 4.44488188976378, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '6438115', 'n_tokens_mistral': 449, 'n_tokens_neox': 424, 'n_words': 108}