aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-05-17 14:04:23 -0600
committerSean Griffin <sean@thoughtbot.com>2014-05-17 14:04:23 -0600
commitd070a657c006ccbcba1b24111f1c8b21b8b9b1c9 (patch)
treeb8a5fe6ab79b223d2389d445b9dcf074c3b32b43 /activerecord
parent067131524b5b5cb6100aca8bf5b48a3006a93acd (diff)
downloadrails-d070a657c006ccbcba1b24111f1c8b21b8b9b1c9.tar.gz
rails-d070a657c006ccbcba1b24111f1c8b21b8b9b1c9.tar.bz2
rails-d070a657c006ccbcba1b24111f1c8b21b8b9b1c9.zip
PostgreSQL timestamps are always datetimes
The current behavior is that they are treated as `datetime` normally, but if they are part of an array, they are treated as `timestamp`. The only place that seems to be impacted by this is schema dumping, which shouldn't matter since `t.datetime` and `t.timestamp` are equivalent in the `PostgreSQL` adapter, anyway.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/oid.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
index cf6a375704..a32915f363 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
@@ -204,11 +204,8 @@ This is not reliable and will be removed in the future.
end
end
- class Timestamp < Type
- def type; :timestamp; end
- def simplified_type(sql_type)
- :datetime
- end
+ class DateTime < Type
+ def type; :datetime; end
def type_cast(value)
return if value.nil?
@@ -483,7 +480,7 @@ This is not reliable and will be removed in the future.
register_type 'bool', OID::Boolean.new
register_type 'bit', OID::Bit.new
alias_type 'varbit', 'bit'
- register_type 'timestamp', OID::Timestamp.new
+ register_type 'timestamp', OID::DateTime.new
alias_type 'timestamptz', 'timestamp'
register_type 'date', OID::Date.new
register_type 'time', OID::Time.new