Sha256: c3dc69e0fc44d3e5f92181e6511c0b47abcccdf52b1a549894616a14c0d56d9a

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 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?(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(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.2.0 lib/dm-pg-json.rb