From d0f8c46e1962b28d77209f367f12c2d2c77f4b12 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Mon, 19 May 2014 10:59:57 -0700 Subject: Remove :timestamp column type The `:timestamp` type for columns is unused. All database adapters treat them as the same database type. All code in `ActiveRecord` which changes its behavior based on the column's type acts the same in both cases. However, when the type is passed to code that checks for the `:datetime` type, but not `:timestamp` (such as XML serialization), the result is unexpected behavior. Existing schema definitions will continue to work, and the `timestamp` type is transparently aliased to `datetime`. --- activerecord/test/cases/column_test.rb | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'activerecord/test/cases/column_test.rb') diff --git a/activerecord/test/cases/column_test.rb b/activerecord/test/cases/column_test.rb index 91605a52f9..fffcb19e56 100644 --- a/activerecord/test/cases/column_test.rb +++ b/activerecord/test/cases/column_test.rb @@ -109,19 +109,14 @@ module ActiveRecord end def test_type_cast_datetime_and_timestamp - columns = [ - Column.new("field", nil, Type::DateTime.new), - Column.new("field", nil, Type::Timestamp.new), - ] - columns.each do |column| - assert_equal nil, column.type_cast(nil) - assert_equal nil, column.type_cast('') - assert_equal nil, column.type_cast(' ') - assert_equal nil, column.type_cast('ABC') - - datetime_string = Time.now.utc.strftime("%FT%T") - assert_equal datetime_string, column.type_cast(datetime_string).strftime("%FT%T") - end + column = Column.new("field", nil, Type::DateTime.new) + assert_equal nil, column.type_cast(nil) + assert_equal nil, column.type_cast('') + assert_equal nil, column.type_cast(' ') + assert_equal nil, column.type_cast('ABC') + + datetime_string = Time.now.utc.strftime("%FT%T") + assert_equal datetime_string, column.type_cast(datetime_string).strftime("%FT%T") end def test_type_cast_date -- cgit v1.2.3