Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seckill table 创建出现end_time非法默认值 #4

Open
lovygit opened this issue Jun 5, 2019 · 1 comment
Open

seckill table 创建出现end_time非法默认值 #4

lovygit opened this issue Jun 5, 2019 · 1 comment

Comments

@lovygit
Copy link

lovygit commented Jun 5, 2019

执行
CREATE TABLE seckill(
seckill_id bigint NOT NULL AUTO_INCREMENT COMMENT '商品库存id',
name varchar(120) NOT NULL COMMENT '商品名称',
number int NOT NULL COMMENT '库存数量',
start_time timestamp NOT NULL COMMENT '秒杀开启时间',
end_time timestamp NOT NULL COMMENT '秒杀结束时间',
create_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY(seckill_id),
key idx_start_time(start_time),
key idx_end_time(end_time),
key idx_create_time(create_time)
)ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 COMMENT='秒杀库存表';
出现 ERROR 1067 (42000): Invalid default value for 'end_time' 错误
很是疑惑

@lovygit
Copy link
Author

lovygit commented Jun 5, 2019

由于使用的是mysql5.7,通过修改sql_mode已解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant