<commit_before>class FixBooleanColumnsInClassifications < ActiveRecord::Migration
  class Classification < ActiveRecord::Base; end

  def self.up
    # Fix issue where older code is placing hard "t" values when in SQL Server,
    #   which causes change_column to boolean to fail.
    if connection.adapter_name == "SQLServer"
      say_with_time("Fix invalid data") do
        expected = ["1", "0", nil]
        true_values = ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES

        Classification.all.each do |c|
          c.read_only    = true_values.include?(c.read_only)    unless expected.include?(c.read_only)
          c.default      = true_values.include?(c.default)      unless expected.include?(c.default)
          c.single_value = true_values.include?(c.single_value) unless expected.include?(c.single_value)
          c.save!
        end
      end
    end

    change_column :classifications, :read_only,    :boolean, :cast_as => :boolean
    change_column :classifications, :default,      :boolean, :cast_as => :boolean
    change_column :classifications, :single_value, :boolean, :cast_as => :boolean
  end

  def self.down
    change_column :classifications, :read_only,    :string, :cast_as => :string
    change_column :classifications, :default,      :string, :cast_as => :string
    change_column :classifications, :single_value, :string, :cast_as => :string
  end
end<commit_msg>only need to fix classifications for postgres<commit_after>class FixBooleanColumnsInClassifications < ActiveRecord::Migration
  class Classification < ActiveRecord::Base; end

  def self.up
    change_column :classifications, :read_only,    :boolean, :cast_as => :boolean
    change_column :classifications, :default,      :boolean, :cast_as => :boolean
    change_column :classifications, :single_value, :boolean, :cast_as => :boolean
  end

  def self.down
    change_column :classifications, :read_only,    :string, :cast_as => :string
    change_column :classifications, :default,      :string, :cast_as => :string
    change_column :classifications, :single_value, :string, :cast_as => :string
  end
end
{'fraction_non_alphanumeric': 0.10260047281323877, 'fraction_numerical': 0.0009456264775413711, 'mean_word_length': 3.9209302325581397, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '5833471', 'n_tokens_mistral': 617, 'n_tokens_neox': 614, 'n_words': 158}