在 mysql 上插入值会产生“外键约束失败”

在 mysql 上插入值会产生“外键约束失败”

我正在运行基于 vtiger 构建的 Yetiforce,我需要一些帮助来移动一些数据库行。当我进行简单的导出和导入时,我收到此错误。(在 Vtiger-Attachments 表中)

 INSERT INTO `vtiger_attachments` (`attachmentsid`, `name`, `description`, `type`, `path`, `subject`) VALUES
(113, 'dnsreport_infinitysouthwest.co.uk.pdf', NULL, 'application/pdf', 'storage/2016/November/week4/', NULL),
(119, 'Signed_Associate_TOB.docx', NULL, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'storage/2016/November/week5/', NULL),
(121, 'Project_Start_TOB_8.8.16.docx', NULL, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'storage/2016/November/week5/', NULL),
(123, 'Company_Benefits_Package.docx', NULL, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'storage/2016/November/week5/', NULL),
(125, 'Recruitment_Interview_process.docx', NULL, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'storage/2016/November/week5/', NULL),
(127, 'Interview_Tips.pdf', NULL, 'application/pdf', 
 'storage/2016/November/week5/', NULL),
 (140, 'Interview_Tips.pdf', NULL, 'application/pdf',[...]
 MySQL said: Documentation

 #1452 - Cannot add or update a child row: a foreign key constraint fails 
 (`projectstart`.`vtiger_attachments`, CONSTRAINT `fk_1_vtiger_attachments` 
 FOREIGN KEY (`attachmentsid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE 
 CASCADE)

我得到的是它已经存在,但出于某种原因,密钥已经显示出来。我已经转移到新版本,但开发人员说我需要某种脚本,他不知道我需要什么。

有人能帮助我吗?我将不胜感激。

相关内容