在MySQL中创建数据库表。我创建了两个字段来获取时间戳。sql中的数据库时间戳
created_at timestamp default '0000-00-00 00:00:00',
updated_at timestamp default now() on update now(),
当我更新数据库时,两个字段都更新为当前时间戳。有关如何防止这种情况发生的任何想法?我在更新时不提供'created_at'字段 - 我还为updated_at字段提供'null'来自动更新。
我无法复制它。什么版本的MySQL? – Barmar
我相信mysql v5.6.4 - 试图确认。 –
查看https://dev.mysql.com/doc/refman/5.6/en/upgrading-from-previous-series.html – Barmar