diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-06-03 13:56:21 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-06-03 13:56:21 +0200 |
commit | 098bb63ae4acc349826ab84b3e1dff985e38609c (patch) | |
tree | aecd8f4d2e38812e421ad60a70ebcc204d62d9d9 /activerecord/lib/active_record/connection_adapters | |
parent | ed1b747b85876122e0b7b11aaabcc877c6f819b9 (diff) | |
download | rails-098bb63ae4acc349826ab84b3e1dff985e38609c.tar.gz rails-098bb63ae4acc349826ab84b3e1dff985e38609c.tar.bz2 rails-098bb63ae4acc349826ab84b3e1dff985e38609c.zip |
pg, preserve point type when schema dumping.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
3 files changed, 11 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb index f9531ddee3..9007bfb178 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb @@ -2,7 +2,11 @@ module ActiveRecord module ConnectionAdapters module PostgreSQL module OID # :nodoc: - class Point < Type::String + class Point < Type::Value + def type + :point + end + def type_cast(value) if ::String === value if value[0] == '(' && value[-1] == ')' diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb index bcfd605165..deaea12408 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb @@ -67,6 +67,10 @@ module ActiveRecord def citext(name, options = {}) column(name, 'citext', options) end + + def point(name, options = {}) + column(name, 'point', options) + end end class ColumnDefinition < ActiveRecord::ConnectionAdapters::ColumnDefinition diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 23c1a8de2f..61694674ab 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -103,7 +103,8 @@ module ActiveRecord uuid: { name: "uuid" }, json: { name: "json" }, ltree: { name: "ltree" }, - citext: { name: "citext" } + citext: { name: "citext" }, + point: { name: "point"} } OID = PostgreSQL::OID #:nodoc: |