Sha256: c9a11e0f9f9d73c705d1c79a59fa4b69c6475a8e16085947859b2f026a21037a

Contents?: true

Size: 878 Bytes

Versions: 1

Compression:

Stored size: 878 Bytes

Contents

# encoding: utf-8

require 'dm-core'
require 'dm-postgres-adapter'
require 'dm-pg-json/property/pgjson'
require 'dm-pg-json/version'

module DataMapper
  module Migrations
    module PostgresAdapter
      def property_schema_hash(property)
        schema = super
        
        if property.kind_of?(::DataMapper::Property::PgJSON)
          schema.delete(:length)
        end

        schema
      end
    end
  end

  module PostgresJSON
    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
      # Types for PostgreSQL databases.
      #
      # @return [Hash] types for PostgreSQL databases.
      #
      # @api private
      def type_map
        super.merge(::DataMapper::Property::PgJSON => {:primitive => 'JSON'}).freeze
      end
    end
  end
end
DataMapper::Adapters::PostgresAdapter.send(:include, ::DataMapper::PostgresJSON)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-pg-json-0.1.0 lib/dm-pg-json.rb