Chen Jian's Java Blog 

Date types for createdAt and updatedAt in MySQL

by Chen Jian


Posted on 2018-11-19 16:11 in Database


If you really want them work well, :

1. Make sure your mysql's version is 5.6.5+

2. The two columns exact data types must be

  
createdAt timestamp not null DEFAULT CURRENT_TIMESTAMP,   
updatedAt timestamp null DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP



No one has commented yet.
该日志评论功能被禁用了。