Sha256: c8dfd18232dac2d0d72b203f24366593732b573146e5fb238e2e056ab1d779f1

Contents?: true

Size: 691 Bytes

Versions: 3

Compression:

Stored size: 691 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}", %w[#{definition.join(" ")}]}
        end

        stream.puts
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activerecord-pg_enum-1.0.2 lib/active_record/pg_enum/4.1/schema_dumper.rb
activerecord-pg_enum-1.0.1 lib/active_record/pg_enum/4.1/schema_dumper.rb
activerecord-pg_enum-1.0.0 lib/active_record/pg_enum/4.1/schema_dumper.rb