это мои таблицы
CREATE TABLE IF NOT EXISTS `carslibrary` (
`CarID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`CarName` varchar(255) NOT NULL,
PRIMARY KEY (`CarID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
CREATE TABLE IF NOT EXISTS `colorslibrary` (
`ColorID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ColorName` varchar(255) NOT NULL,
PRIMARY KEY (`ColorID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
я хочу создать другую таблицу со ссылкой на CarID и ColorID
я создал таблицу с именем facerecord
CREATE TABLE IF NOT EXISTS `facerecord` (
`carslibrary_ID` int(10) NOT NULL,
`colorslibrary_ID` int(11) NOT NULL,
KEY `carslibrary_ID` (`carslibrary_ID`),
KEY `colorslibrary_ID` (`colorslibrary_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
iполучаю эту ошибку
Error creating foreign key on carslibrary_ID (check data types)
Error creating foreign key on colorslibrary_ID (check data types)
Error
ALTER TABLE `facerecord` ADD FOREIGN KEY ( `carslibrary_ID` ) REFERENCES `cars2`.`carslibrary` (
`CarID`
) ON DELETE SET NULL ON UPDATE SET NULL ;
ALTER TABLE `facerecord` ADD FOREIGN KEY ( `colorslibrary_ID` ) REFERENCES `cars2`.`colorslibrary` (
`ColorID`
) ON DELETE SET NULL ON UPDATE SET NULL ;