Remove :timestamp column type #15184

Merged
merged 1 commit into from May 19, 2014

Conversation

Projects
None yet
3 participants
@sgrif
Member

sgrif commented May 19, 2014

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.

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`.

rafaelfranca added a commit that referenced this pull request May 19, 2014

@rafaelfranca rafaelfranca merged commit 03035d6 into rails:master May 19, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@sgrif sgrif deleted the sgrif:sg-remove-timestamp-type branch May 19, 2014

@yahonda

This comment has been minimized.

Show comment
Hide comment
@yahonda

yahonda May 20, 2014

Contributor

Oracle enhanced adapter handles timestamp as timestamp. https://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb#L452-L455

Since we are behind to support rails master branch, it needs to implement 4bd5dff first and let me check...

Contributor

yahonda commented May 20, 2014

Oracle enhanced adapter handles timestamp as timestamp. https://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb#L452-L455

Since we are behind to support rails master branch, it needs to implement 4bd5dff first and let me check...

@sgrif

This comment has been minimized.

Show comment
Hide comment
@sgrif

sgrif May 20, 2014

Member

You should be able to override the aliased_types method in the oracle adapter, and just return an empty hash. https://github.com/rails/rails/pull/15184/files#diff-21d4fbe002689dc4b0ab29f021585457R297

Member

sgrif commented May 20, 2014

You should be able to override the aliased_types method in the oracle adapter, and just return an empty hash. https://github.com/rails/rails/pull/15184/files#diff-21d4fbe002689dc4b0ab29f021585457R297

@yahonda

This comment has been minimized.

Show comment
Hide comment
@yahonda

yahonda May 20, 2014

Contributor

Thanks for the advice. Let me try.

Contributor

yahonda commented May 20, 2014

Thanks for the advice. Let me try.

senny added a commit that referenced this pull request Nov 7, 2014

sachin004 added a commit to sachin004/rails that referenced this pull request Dec 13, 2014

@panchiz panchiz referenced this pull request in jruby/activerecord-jdbc-adapter Jan 17, 2015

Closed

DateTime columns are always returned as nil values. #613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment