use o2o;
CREATE TABLE tb_person_info
(user_id
int(10) NOT NULL AUTO_INCREMENT,name
varchar(32) DEFAULT NULL,profile_img
varchar(1024) DEFAULT NULL,email
varchar(1024) DEFAULT NULL,gender
varchar(2) DEFAULT NULL,enable_status
int(2) NOT NULL DEFAULT ‘0’ COMMENT ‘0:禁止访问,1:允许访问’,user_type
int(2) NOT NULL DEFAULT ‘1’ COMMENT ‘1:顾客,2:店家,3:超级管理员’,create_time
datetime DEFAULT NULL,last_edit_time
datetime DEFAULT NULL,
PRIMARY KEY (user_id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
USE o2o;
CREATE TABLE tb_wechat_auth
(wechat_auth_id
INT(10) NOT NULL AUTO_INCREMENT,user_id
INT(10) NOT NULL,open_id
VARCHAR(1024) NOT NULL,create_time
DATETIME DEFAULT NULL,
PRIMARY KEY(wechat_auth_id
),
CONSTRAINT fk_wechatauth_profile
FOREIGN KEY(user_id
) REFERENCEStb_person_info
(user_id
)
)ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLEtb_local_auth
(local_auth_id
INT(10) NOT NULL AUTO_INCREMENT,user_id
INT(10) NOT NULL,username
VARCHAR(128) NOT NULL,password
VARCHAR(128) NOT NULL,createtime
DATETIME DEFAULT NULL,last_edit_time
DATETIME DEFAULT NULL,
PRIMARY KEY(local_auth_id
),
UNIQUE KEY uk_local_profile
(username
),
CONSTRAINT fk_localauth_profile
FOREIGN KEY(user_id
) REFERENCEStb_person_info
(user_id
)
)ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
查询:CREATE TABLE tb_wechat_auth
( wechat_auth_id
INT(10) NOT NULL AUTO_INCREMENT, user_id
int(10) NOT NULL, open_id
VARCHAR(1…错误代码: 1215
Cannot add foreign key constraint
查询:CREATE TABLEtb_local_auth
( local_auth_id
INT(10) NOT NULL AUTO_INCREMENT, user_id
INT(10) NOT NULL, username
VARCHAR(128…错误代码: 1215
Cannot add foreign key constraint
执行耗时 : 0 sec
传送时间 : 0 sec
总耗时 : 0.088 sec
请问如何解决
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程