Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAUL
mysql数据库创建表时,对时间字段的定义,
DROP TABLE IF EXISTS `pro_favorite`;
CREATE TABLE `pro_favorite` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`user_id` int(11) unsigned NOT NULL COMMENT '用户ID',
`pro_id` int(11) unsigned NOT NULL COMMENT '商品ID',
`status` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '0:取消 1:确认',
`favoritetype` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '收藏类型(预留)',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
KEY `fav_userIdx_idx` (`user_id`),
CONSTRAINT `fav_userIdx` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品收藏';
其中把两个timestamp设置为当前时间,不支持,只能设置一个为当前时间,删除其中的一个默认值即可
好记性不如烂笔头
浙公网安备 33010602011771号