<commit_before>require 'active_record'

namespace :db do
  namespace :audit do
    task :create_audit_tables do
      sql = ActiveRecord::Base.connection
      sql.tables.each do |table|
        next if table == "schema_migrations"
        time = Time.now
        sql.begin_db_transaction
        sql.execute("CREATE TABLE #{table}_#{time.month}_#{time.year} like #{table}")
        add_column table.to_sym, :username, :string
        add_column table.to_sym, :version, :integer, default: 0
        add_column table.to_sym, :deleted, :boolean
        add_column table.to_sym, :canonical_id, :integer
        indexes = sql.execute("SHOW INDEX FROM #{table}")
        indexes.each do |index|
          sql.execute("ALTER TABLE #{table} DROP INDEX #{index[2]};") unless index[2] == 'PRIMARY'<commit_msg>fixing add column<commit_after>require 'active_record'

namespace :db do
  namespace :audit do
    task :create_audit_tables do
      sql = ActiveRecord::Base.connection
      sql.tables.each do |table|
        next if table == "schema_migrations"
        time = Time.now
        sql.begin_db_transaction
        sql.execute("CREATE TABLE #{table}_#{time.month}_#{time.year} like #{table}")
        ActiveRecord::Migration.add_column table.to_sym, :username, :string
        ActiveRecord::Migration.add_column table.to_sym, :version, :integer, default: 0
        ActiveRecord::Migration.add_column table.to_sym, :deleted, :boolean
        ActiveRecord::Migration.add_column table.to_sym, :canonical_id, :integer
        indexes = sql.execute("SHOW INDEX FROM #{table}")
        indexes.each do |index|
          sql.execute("ALTER TABLE #{table} DROP INDEX #{index[2]};") unless index[2] == 'PRIMARY'
{'fraction_non_alphanumeric': 0.12, 'fraction_numerical': 0.0035294117647058825, 'mean_word_length': 3.372750642673522, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3619400', 'n_tokens_mistral': 514, 'n_tokens_neox': 523, 'n_words': 127}