Sha256: a5b722a0f7a2ea59fc6d7181fe9c2cbb8a24a6fc50a959fdc8deb388f94ad5ec

Contents?: true

Size: 677 Bytes

Versions: 8

Compression:

Stored size: 677 Bytes

Contents

module ActiveRecord
  module PGEnum
    register :schema_dumper do
      require "active_record/schema_dumper"
      ActiveRecord::SchemaDumper.prepend SchemaDumper
    end

    module SchemaDumper
      private

      def extensions(stream)
        super
        enums(stream)
      end

      def enums(stream)
        return unless (enum_types = @connection.enum_types).any?

        stream.puts "  # These are custom enum types that must be created before they can be used in the schema definition"

        enum_types.each do |name, definition|
          stream.puts %Q{  create_enum "#{name}", #{definition}}
        end

        stream.puts
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activerecord-pg_enum-2.0.0 lib/active_record/pg_enum/4.1/schema_dumper.rb
activerecord-pg_enum-1.2.2 lib/active_record/pg_enum/4.1/schema_dumper.rb
activerecord-pg_enum-1.2.1 lib/active_record/pg_enum/4.1/schema_dumper.rb
activerecord-pg_enum-1.2.0 lib/active_record/pg_enum/4.1/schema_dumper.rb
activerecord-pg_enum-1.1.0 lib/active_record/pg_enum/4.1/schema_dumper.rb
activerecord-pg_enum-1.0.5 lib/active_record/pg_enum/4.1/schema_dumper.rb
activerecord-pg_enum-1.0.4 lib/active_record/pg_enum/4.1/schema_dumper.rb
activerecord-pg_enum-1.0.3 lib/active_record/pg_enum/4.1/schema_dumper.rb