diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2015-08-04 04:16:54 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2015-08-18 16:13:00 +0900 |
commit | 89d5d1cafb23280bda3f303442387e71353c9e49 (patch) | |
tree | 93968b2a2d1c8e817b0724b1f67b64862b867060 /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | |
parent | 2a2473fd71d75bcda68f70500178d32587700ab0 (diff) | |
download | rails-89d5d1cafb23280bda3f303442387e71353c9e49.tar.gz rails-89d5d1cafb23280bda3f303442387e71353c9e49.tar.bz2 rails-89d5d1cafb23280bda3f303442387e71353c9e49.zip |
Add a native JSON data type support in MySQL
As of MySQL 5.7.8, MySQL supports a native JSON data type.
Example:
create_table :json_data_type do |t|
t.json :settings
end
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 2c43c46a3d..861edbf3a2 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -201,6 +201,10 @@ module ActiveRecord true end + def supports_json? + postgresql_version >= 90200 + end + def index_algorithms { concurrently: 'CONCURRENTLY' } end @@ -478,7 +482,7 @@ module ActiveRecord m.register_type 'bytea', OID::Bytea.new m.register_type 'point', OID::Point.new m.register_type 'hstore', OID::Hstore.new - m.register_type 'json', OID::Json.new + m.register_type 'json', Type::Json.new m.register_type 'jsonb', OID::Jsonb.new m.register_type 'cidr', OID::Cidr.new m.register_type 'inet', OID::Inet.new @@ -834,7 +838,6 @@ module ActiveRecord ActiveRecord::Type.register(:enum, OID::Enum, adapter: :postgresql) ActiveRecord::Type.register(:hstore, OID::Hstore, adapter: :postgresql) ActiveRecord::Type.register(:inet, OID::Inet, adapter: :postgresql) - ActiveRecord::Type.register(:json, OID::Json, adapter: :postgresql) ActiveRecord::Type.register(:jsonb, OID::Jsonb, adapter: :postgresql) ActiveRecord::Type.register(:money, OID::Money, adapter: :postgresql) ActiveRecord::Type.register(:point, OID::Point, adapter: :postgresql) |