SQL 关联外键报错类型不匹配
如题,关联外键的时候,报错类型匹配。但是两个 类型都是int
sql 如下:
CREATE TABLE IF NOT EXISTS `alert_receiver_map` (
`id` INT UNSIGNED AUTO_INCREMENT,
`alert_id` INT NOT NULL,
`receiver_id` INT NOT NULL,
PRIMARY KEY ( `id` ),
FOREIGN KEY (`alert_id`) REFERENCES alert_conditions ( id ),
FOREIGN KEY (`receiver_id`) REFERENCES receivers ( id )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
show engine innodb status 查看 还是报类型不匹配,仔细瞅了瞅;最后发现是unsigned 导致的。
一个无符号,一个正常int 导致的类型不匹配。