为什么MySQL updatetime 不能自动更新
1.在创建表结构的时候增加:
DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
CREATE TABLE `account_additional_function` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `account_id` int(11) NOT NULL DEFAULT '0' COMMENT '商户ID', `saf_id` int(11) NOT NULL DEFAULT '0' COMMENT '系统附加功能ID', `create_time` datetime DEFAULT CURRENT_TIMESTAMP, `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `removed` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=837 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='商户对应的附加功能';
hello world!!!