# encoding: utf-8 require 'dm-core' require 'dm-postgres-adapter' require 'dm-pg-json/version' module DataMapper class Property autoload :PgJSON, 'dm-pg-json/property/pgjson' end 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)