<commit_before>module ActiveRecord
  module ActsAsRelationSuperclassMigration
    def self.included(base)
      base.class_eval do
        alias_method_chain :create_table, :as_relation_superclass
      end
    end

    def create_table_with_as_relation_superclass(table_name, options = {})
      create_table_without_as_relation_superclass(table_name, options) do |td|
        if superclass = options[:as_relation_superclass]
          association_name = if superclass.is_a? Symbol or superclass.is_a? String then
                               superclass
                             else
                               ActiveRecord::Base.acts_as_association_name table_name
                             end

          td.integer "#{association_name}_id"
          td.string  "#{association_name}_type"
          td.index ["#{association_name}_id", "#{association_name}_type"],
                   name: "#{association_name}_index"
        end

        yield td if block_given?
      end
    end
  end
end

module ActiveRecord::ConnectionAdapters::SchemaStatements
  include ActiveRecord::ActsAsRelationSuperclassMigration
end<commit_msg>If there are two superclasses with the same superclass name, disambiguate them for sqlite3.<commit_after>module ActiveRecord
  module ActsAsRelationSuperclassMigration
    def self.included(base)
      base.class_eval do
        alias_method_chain :create_table, :as_relation_superclass
      end
    end

    def create_table_with_as_relation_superclass(table_name, options = {})
      create_table_without_as_relation_superclass(table_name, options) do |td|
        if superclass = options[:as_relation_superclass]
          association_name = if superclass.is_a? Symbol or superclass.is_a? String then
                               superclass
                             else
                               ActiveRecord::Base.acts_as_association_name table_name
                             end

          td.integer "#{association_name}_id"
          td.string  "#{association_name}_type"
          td.index ["#{association_name}_id", "#{association_name}_type"],
                   name: "#{table_name}_#{association_name}_index"
        end

        yield td if block_given?
      end
    end
  end
end

module ActiveRecord::ConnectionAdapters::SchemaStatements
  include ActiveRecord::ActsAsRelationSuperclassMigration
end

{'fraction_non_alphanumeric': 0.06368620835090678, 'fraction_numerical': 0.00042176296921130323, 'mean_word_length': 2.488235294117647, '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': '6717837', 'n_tokens_mistral': 643, 'n_tokens_neox': 638, 'n_words': 130}