您的位置:首页 > 其它

Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAUL

2017-03-30 15:24 651 查看
导入sql文件时出错,提示

Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

查看表语句

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设置为当前时间,不支持,只能设置一个为当前时间,删除其中的一个默认值即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐