-
Notifications
You must be signed in to change notification settings - Fork 64
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 don't include milliseconds #727
Labels
bug
Something isn't working
Comments
This happens here: avram/src/avram/charms/time_extensions.cr Lines 74 to 76 in a3d830c
Time.utc.to_s #=> "2021-09-10 19:21:22 UTC"
Time.utc.to_s("%F %X.%6N") #=> "2021-09-10 19:21:22.872793" We account for time formats when pulling the value out of the DB, but not for inserting the value. |
jwoertink
changed the title
Default created_at and updated_at don't include milliseconds
Time columns don't include milliseconds
Sep 10, 2021
jwoertink
added a commit
that referenced
this issue
Oct 15, 2021
jwoertink
added a commit
that referenced
this issue
Mar 12, 2022
jwoertink
added a commit
that referenced
this issue
Mar 14, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When we set the
created_at
andupdated_at
fields, we just calledcreated_at.value = Time.utc
. That value in the DB looks like2021-09-10 18:08:39+00
, but if you actually inspectTime.utc
you'll get something that looks like2021-09-10 18:03:38.655286917 UTC
. Storing the milliseconds makes a HUGE difference when you're sorting by created_at in your specs especially if you're doing any window function using created_at.We need to figure out how to include milliseconds on these fields by default.
Related: #393 if we just let SQL handle it via
NOW()
, it would be fine.EDIT: turns out it's all Time columns, not just
created_at
andupdated_at
.The text was updated successfully, but these errors were encountered: