An auto-initialized column is set to the current timestamp for inserted rows that specify no value for the column.
An auto-updated column is automatically updated to the current timestamp when the value of any other column in the row is changed from its current value. An auto-updated column remains unchanged if all other columns are set to their current values. To prevent an auto-updated column from updating when other columns change, explicitly set it to its current value. To update an auto-updated column even when other columns do not change, explicitly set it to the value it should have (for example, set it to
CURRENT_TIMESTAMP
).
一般表的字段datachange_lasttime 设置为timestamp类型 默认或者 OT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)。
update 时,如果除datachange_lasttime外其他字段没有改变,则datachange_lasttime并不更新,0.0和0 相当于值不变