我有一个用此SQL创建的表:
CREATE TABLE `test_table` ( `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, `data` TEXT, `timestamp` TIMESTAMP ) CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE InnoDB;
但是当我跑步时SHOW CREATE TABLE test_table
,我得到:
CREATE TABLE `test_table` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `data` text COLLATE utf8_unicode_ci, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
为什么默认情况下将时间戳列分配为ON UPDATE CURRENT_TIMESTAMP?我不知道该如何摆脱。任何帮助将不胜感激。