Justifications for setting updated_at on record create?

For every Yii2 site I have created I have overridden the default TimestampBehavior to only set the created_at field when a record is created. Starting another new site, I am revisiting that concept. My guess is that people far smarter than I made the decision that the default TimestampBehavior should be to set updated_at whenever a record is created. I came across this post on GitHub that seems to suggest there are many advantages to the default functionality: Timestamp and Blameable Behaviors Same value for update and create. #7548.

Can someone list some pros and cons to setting updated_at whenever a record is created?

Hi,

Sorry I have nothing to add regarding pros and cons.

But I’m interested in your reasons…

Why did you put efforts in changing the standard behavior in the first place?

Just curious, because I can’t imagine a scenario where this could be “required”?

Regarding "setting of both attributes on create" I personally think: Why not?

For my opinion it does not do any damage nor does it produce any confusion, or?

And the attributes are having the same value only ONCE in the lifetime of the specified record…

Regards

It has everything to do with the logic of it. If the record has never been updated, why is updated_at set? If I want to know if a record had ever been changed, the default behavior requires me to check if the updated_at and created_at equal each other versus simply checking if updated_at is empty.

To me it just doesn’t make any sense to set an updated timestamp for non-updated records.

That original post I linked to seems to indicate there was a reason (or reasons) this default behavior was chosen and I was just hoping someone that helped mashed that decision could shed light into the reasoning.

I would rather use the default behavior but not if it doesn’t make sense to me and nobody can give me a few reasons why it makes more sense that way.