在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