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
Format the time string according to the precision of the time column #18914
Format the time string according to the precision of the time column #18914
Conversation
@@ -733,7 +733,7 @@ def register_integer_type(mapping, key, options) # :nodoc: | |||
end | |||
|
|||
def extract_precision(sql_type) | |||
if /datetime/ === sql_type | |||
if /^(?:date)?time/ === sql_type |
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.
Was the missing ^
anchor intentional before?
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.
It seems the missing ^ anchor not intentional.
If you prefer to shortest pattern, it is possible to match /time/
. It is only datetime, timestamp and time to match this in MySQL. These types can have a precision.
http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
20653ef
to
30f9175
Compare
@@ -87,7 +87,7 @@ platforms :ruby do | |||
group :db do | |||
gem 'pg', '>= 0.18.0' | |||
gem 'mysql', '>= 2.9.0' | |||
gem 'mysql2', '>= 0.3.13' | |||
gem 'mysql2', '>= 0.3.18' |
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.
0.3.18 includes fix msec for time field is not passed. brianmario/mysql2#579
e628c27
to
2803623
Compare
It is also necessary to format a time column like a datetime column.
2803623
to
cddc298
Compare
Format the time string according to the precision of the time column
Follow up rails#18914.
Follow up rails#18914.
It is also necessary to format a time column like a datetime column.