Sha256: 7c07fa07b356b8a9cc814e706c3de033123108940ae529cc4b0becede99aa70a

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

module Views
  module Extensions
    module ActiveRecord
      module SchemaDumper
        extend ActiveSupport::Concern

        def dump(stream)
          header(stream)
          extensions(stream)
          tables(stream)
          views(stream)
          trailer(stream)
          stream
        end

        def views(stream)
          @connection.views.map(&:values).each do |name, type|
            stream.puts <<-SCHEMA.strip_heredoc.indent(2)
              create_view "#{name}", force: true
            SCHEMA
          end
          stream.puts "\n"
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
views-4.0.0.1 lib/views/extensions/active_record/schema_dumper.rb
views-4.0.0.0 lib/views/extensions/active_record/schema_dumper.rb