应用程序用户
-- auto-generated definition
create table application_user
(
id bigint auto_increment
primary key,
email varchar(255) not null,
is_active bit null,
name varchar(255) not null,
password varchar(255) not null,
surname varchar(255) not null,
username varchar(255) not null
)
engine = MyISAM;
我有一个由hibernate生成的表。
我想创建一个表并手动添加外键。
到目前为止我试过这个
应用程序用户日志
CREATE TABLE application_user_log (
log_id BIGINT NOT NULL AUTO_INCREMENT,
fk_user_id BIGINT NOT NULL,
old_user_name BIGINT NOT NULL,
new_user_name BIGINT NOT NULL,
PRIMARY KEY (log_id),
FOREIGN KEY (fk_user_id) REFERENCES application_user(id)
) ;
我收到了这个错误信息。
[HY000][1215] Cannot add foreign key constraint
为什么我会犯这个错误?