原文地址: https://blog.csdn.net/heatdeath/article/details/79833492

1 `create_time` timestamp not null default current_timestamp comment '创建时间',
2 
3 `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间',

当执行update操作是,并且字段有ON UPDATE CURRENT_TIMESTAMP属性。则字段无论值有没有变化,它的值也会跟着更新为当前UPDATE操作时的时间。


参考资料:

1、timestamp的两个属性:CURRENT_TIMESTAMP 和ON UPDATE CURRENT_TIMESTAMP
https://blog.csdn.net/aitcax/article/details/41849591

posted on 2019-10-11 09:48  睡着的糖葫芦  阅读(8202)  评论(0编辑  收藏  举报