<commit_before>module RailsSqlViews
  module SchemaDumper
    def self.included(base)
      base.alias_method_chain :trailer, :views
      base.alias_method_chain :dump, :views
      base.alias_method_chain :tables, :views_excluded
      
      # A list of views which should not be dumped to the schema. 
      # Acceptable values are strings as well as regexp.
      # This setting is only used if ActiveRecord::Base.schema_format == :ruby
      base.cattr_accessor :ignore_views
      base.ignore_views = []
      # Optional: specify the order that in which views are created.
      # This allows views to depend on and include fields from other views.
      # It is not necessary to specify all the view names, just the ones that 
      # need to be created first
      base.cattr_accessor :view_creation_order
      base.view_creation_order = []
    end
    
    def trailer_with_views(stream)
      # do nothing...we'll call this later
    end
    
    # Add views to the end of the dump stream
    def dump_with_views(stream)
      dump_without_views(stream)
      begin
        if @connection.supports_views?
          views(stream)
        end
      rescue => e
        if ActiveRecord::Base.logger<commit_msg>finally got schema dump to work - but had to use a kluge to do it.<commit_after>module RailsSqlViews
  module SchemaDumper
    def self.included(base)
      base.alias_method_chain :trailer, :views
      base.alias_method_chain :dump, :views
      base.alias_method_chain :tables, :views_excluded
      
      # A list of views which should not be dumped to the schema. 
      # Acceptable values are strings as well as regexp.
      # This setting is only used if ActiveRecord::Base.schema_format == :ruby
      base.cattr_accessor :ignore_views
      base.ignore_views = []
      # Optional: specify the order that in which views are created.
      # This allows views to depend on and include fields from other views.
      # It is not necessary to specify all the view names, just the ones that 
      # need to be created first
      base.cattr_accessor :view_creation_order
      base.view_creation_order = []
    end
    
    def trailer_with_views(stream)
      # do nothing...we'll call this later
    end
    
    # Add views to the end of the dump stream
    def dump_with_views(stream)
      dump_without_views(stream)
      begin
        @connection.class.send(:public, :supports_views?) # this is a kluge, but I don't know why it's changing back to private before it gets here
        if @connection.supports_views?
          views(stream)
        end
      rescue => e
        if ActiveRecord::Base.logger
{'fraction_non_alphanumeric': 0.05949223190602501, 'fraction_numerical': 0.0, 'mean_word_length': 2.6313617606602477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4994638', 'n_tokens_mistral': 744, 'n_tokens_neox': 723, 'n_words': 273}