-
Notifications
You must be signed in to change notification settings - Fork 77
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
#at(time: <?>) returning nil #199
Comments
Or, even more straight forward - the object above, with the same log_data: object.at(time: object.created_at)
=> nil
object.at(time: object.updated_at)
=> nil |
I rolled back all the migrations and reverted everything. Then I re-did the install/setup, and now it works. This time I used the --backfill generator flag instead of the manual SQL update. The SQL update: Generator: Would that be the issue? It looks like the statement_timestamp() functions would be used unless specifying a ts_column (updated_at) to logidze_snapshot. updated_at is a timestamp without time zone, but statement_timestamp returns a datetime with timezone ... I dunno - this is making my brain melt lol =) |
Hm, the ts for the first version (1625814155032) is greater than the last one (1625803663098); and it doesn't match the select (extract(epoch from '2021-07-09T00:02:35.032324'::timestamp with time zone) * 1000)::bigint
#=> 1625788955032 Finally, the actual value is:
Any ideas where this datetime could came from? |
I believe it came from my copying and pasting the example SQL in the readme to backfill my model after I forgot to pass the --backfill option to the generator: UPDATE <my_table> as t
SET log_data = logidze_snapshot(to_jsonb(t)) Without specifying |
Ok, thanks. And since the difference between timestamp and What is your setting for |
|
I came up with my own versioning solution for the problem I was considering logidze for - largely for legacy reasons. |
Oh, that’s the answer! We must add mention this caveat in the docs. |
Nice work on this gem - I love how it uses triggers/stored procedures and json columns.
I am struggling with the
at(time: 1.hours.ago)
instance method not working as I expected.object.at(time: 1.hour.ago)
returns nil, but I've been making changes to the object multiple times in the past 8 hours.I'm wondering if it isn't a timezone issue?
1.hour.ago is
ActiveSupport::TimeWithZone
instance with time zone set to MDT.And here is the log_data for the record:
Cheers!
The text was updated successfully, but these errors were encountered: