aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-06-14 18:55:10 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-06-14 18:55:10 -0300
commit57a952a223e10b1f4062f45a9490dc7076ea40ba (patch)
treea3d1b23752297c22e44862962b9340b8f1e40cf8 /activerecord/lib
parent86af7d357899057f1565b2ebbeb4f3c3235846a1 (diff)
parent12e9a75f227ea7bcc23e2717e9ff5a72ec64e1f1 (diff)
downloadrails-57a952a223e10b1f4062f45a9490dc7076ea40ba.tar.gz
rails-57a952a223e10b1f4062f45a9490dc7076ea40ba.tar.bz2
rails-57a952a223e10b1f4062f45a9490dc7076ea40ba.zip
Merge pull request #6713 from etehtsea/activerecord-uuid
Add uuid datatype support to PostgreSQL adapter
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/oid.rb1
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb10
2 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
index df3d5e4657..6657491c06 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
@@ -223,6 +223,7 @@ module ActiveRecord
alias_type 'bit', 'text'
alias_type 'varbit', 'text'
alias_type 'macaddr', 'text'
+ alias_type 'uuid', 'text'
# FIXME: I don't think this is correct. We should probably be returning a parsed date,
# but the tests pass with a string returned.
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 03c318f5f7..b08c59d97d 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -89,7 +89,6 @@ module ActiveRecord
else
string
end
-
end
def cidr_to_string(object)
@@ -256,7 +255,7 @@ module ActiveRecord
:integer
# UUID type
when 'uuid'
- :string
+ :uuid
# Small and big integer types
when /^(?:small|big)int$/
:integer
@@ -319,6 +318,10 @@ module ActiveRecord
def macaddr(name, options = {})
column(name, 'macaddr', options)
end
+
+ def uuid(name, options = {})
+ column(name, 'uuid', options)
+ end
end
ADAPTER_NAME = 'PostgreSQL'
@@ -341,7 +344,8 @@ module ActiveRecord
:hstore => { :name => "hstore" },
:inet => { :name => "inet" },
:cidr => { :name => "cidr" },
- :macaddr => { :name => "macaddr" }
+ :macaddr => { :name => "macaddr" },
+ :uuid => { :name => "uuid" }
}
# Returns 'PostgreSQL' as adapter name for identification purposes.