-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time columns should support time zone aware attributes #15726
Conversation
Hmm, maybe this will make the upgrade path more painful. WDYT about keeping the default [:datetime] and generating [:datatime, :time] for new applications? |
I have no strong feelings, I'll make the change. |
If we feel that [:datetime, :time] should be the default going forward, perhaps we should output a deprecation warning if it's not explicitly configured one way or the other? (While still defaulting to the backward-compatible [:datetime] setting, for now.) |
I have no strong feelings on what the default should be.
|
@matthewd's plan is good to me. |
I've changed the default back to |
@@ -1,3 +1,17 @@ | |||
* `time` columns can now affected by `time_zone_aware_attributes`. If you have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"can now be affected" here, no ?
The types that are affected by `time_zone_aware_attributes` (which is on by default) have been made configurable, in case this is a breaking change for existing applications.
4978328
to
5cd3bbb
Compare
Time columns should support time zone aware attributes
time_zone_aware_types.include?(:not_explicitly_configured) | ||
ActiveSupport::Deprecation.warn(<<-MESSAGE) | ||
Time columns will become time zone aware in Rails 5.1. This | ||
sill cause `String`s to be parsed as if they were in `Time.zone`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: sill
[ci skip] @sgrif can you review when you have time? Thanks!
Fix docs of AR::Timestamp to match #15726
This PR integrates rails#15726, under which `Time` columns should support time zone aware attributes. In order for this to be the **default behavior** on brand new Rails 5.0 apps, an initializer is required. Without it, even brand new Rails 5.0 apps would be showing the following deprecation warning, which should be reserved to apps _ported_ to Rails 5.0 from an older version: ``` Time columns will become time zone aware in Rails 5.1. This still causes `String`s to be parsed as if they were in `Time.zone`, and `Time`s to be converted to `Time.zone`. To keep the old behavior, you must add the following to your initializer: config.active_record.time_zone_aware_types = [:datetime] To silence this deprecation warning, add the following: config.active_record.time_zone_aware_types << :time ``` @sgrif Is the above correct?
The types that are affected by
time_zone_aware_attributes
(which is on by default) have been made configurable, in case this not the desired behavior for existing applications.Fixes #3145