In MySQL, is there an easy way for the following:
- On creation, both
created_dateandupdated_dateare set to the sameTIMESTAMP - On subsequent edits,
updated_dateis changed to theCURRENT_TIMESTAMP
Why is only one field allowed to use the CURRENT_TIMESTAMP as its default value? Why can't I have one default to the CURRENT_TIMESTAMP and the other use it only on update?
If I use now() for created_date and on update CURRENT_TIMESTA开发者_运维百科MP for updated_date, will they be the same on the creation of a row?
That's just the way it is :)
But seriously, it's usually easier (less surprises) when you set those dates explicitly with 'now()' when you create/update the row.
加载中,请稍侯......
精彩评论