Skip to content
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

Unable to load version using ActiveRecord updated_at #72

Closed
jasonjho opened this issue May 17, 2018 · 4 comments
Closed

Unable to load version using ActiveRecord updated_at #72

jasonjho opened this issue May 17, 2018 · 4 comments
Labels

Comments

@jasonjho
Copy link

If I understood the docs, the timestamp is derived from the updated_at timestamp at the record level. In my case, I have these set by ActiveRecord, so they are always available.

If I try to load a version at(time: <record.updated_at>), I am getting back nil. Somehow, the timestamps seem to be off by 1 millisecond after inspecting log_data. Simply adding 1 to the timestamp will yield the expected result, but I feel I am missing something here.

I simply want to grab the version based on the recorded updated_time. Any tips would be appreciated, thanks!

@jasonjho
Copy link
Author

jasonjho commented May 17, 2018

It seems as if the trigger function is rounding up somehow and storing that in ts.

@palkan
Copy link
Owner

palkan commented May 28, 2018

Sorry for a long reply.

the timestamp is derived from the updated_at timestamp at the record level

That's only true if you have provided the timestamp_column to the logidze:model generator. How does your Logidze migration for the table look like?

@palkan palkan added the awaiting response Awaiting reporter's response label May 28, 2018
@jasonjho
Copy link
Author

We have an updated_at column already present on the entity table. Based on the docs, I thought logidze would attempt to always use this as the default strategy, otherwise defaulting to the statement ts.

I see the following in our sql trigger. Does this mean we have the right setting?

EXECUTE PROCEDURE logidze_logger(null, 'updated_at');

@palkan
Copy link
Owner

palkan commented Jun 6, 2018

Does this mean we have the right setting?

Yep, looks good.

Could you, please, provide an example of SQL rows with wrong timestamps?

@palkan palkan added the stale label Jun 13, 2019
@palkan palkan closed this as completed Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants