Date types for createdAt and updatedAt in MySQL

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

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.