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

"updated_at" is not set if the current value in the db is null #270

Open
rupertchen opened this issue Jan 28, 2021 · 0 comments
Open

"updated_at" is not set if the current value in the db is null #270

rupertchen opened this issue Jan 28, 2021 · 0 comments

Comments

@rupertchen
Copy link
Contributor

Expected

When a model defines updated_at field of type Long, the value of updated_at should always be automatically set to the current time when the model is modified.

Observed

When the model is loaded, if the updated_at column is null in the database, it will be null in the model's field and it will not be set to the current time when the model is modified.

I think the issue is within AbstractDatabaseModel#updatedAtCanBeHandled1. When the value of the field is null, it is unable to determine the type of the field. A possible solution is to add a getFieldType method that returns the type's Class.

Possible Workaround

A workaround for this is to explicitly set the value of the updated_at field to 0L. This allows Jack to confirm updated_at is of type Long and it will overwrite the 0 with the current time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant