Use correct precision when touching `updated_at` column in upsert by sambostock...
source link: https://github.com/rails/rails/pull/42993
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Summary
Closes #42992
InsertAll
(the machinery which powers, among others methods, upsert
) uses CURRENT_TIMESTAMP
with an implicit precision of 0
as the default when touching updated_at
/updated_on
.
This PR updates it to pass in the current time, serialized according to the column's type.
Not all databases support increased precision for CURRENT_TIMESTAMP
(e.g. MySQL supports CURRENT_TIMESTAMP(6)
, but SQLite does not), so it is simpler to just serialize the current time.
Other Information
Before Merging
- Address TODO comments
- Add changelog entry
-
Confirm there is no reason
CURRENT_TIMESTAMP
had been chosen instead of serializing the current time, and that this won't break anything.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK