LiveRamp/jack

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

rupertchen opened this issue · 0 comments

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.