0

I'm running Yetiforce which is built on vtiger, I am needing some help moving some database lines across. I am getting this error when i do a simple export and import.( in Vtiger-Attachments table)

 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)

I get some is that its already there but I for some reason the Key's are already showing. I've moved to the new version but the dev said I will need some sort of script and he does not know what I need.

Could anyone help me with this it would be much appreciated.

eckes
  • 835
  • 9
  • 21
  • It means you need to insert the row from `vtiger_crmentity` for attachmentsid='dnsreport_infinitysouthwest' first (and all other values). BTW, the question is not really related to PHPMyadmin. – eckes Apr 27 '17 at 08:48
  • The "vtiger_crmentity" already exsists in the DB however it wont import. – stoneseraphim May 02 '17 at 11:00
  • Not only the table, but all the referenced rows have to exist – eckes May 02 '17 at 17:18
  • im trying to import the rows from one to another a new database but already populated with items needed to be working. Sorry if that makes no sense if all else fails i'll have to manually import each file and associate it which will take me weeks. – stoneseraphim May 11 '17 at 08:52
  • I don't understand sorry. All I am saying is that you try to import entries in the Attachment table before you import the referenced crmentities, and this does not work. Either import the entities first, drop the foreign key constraint or import only the attachments with existing crmentities. – eckes May 11 '17 at 08:54
  • ah i understand i will try to import crmentities first and try it. – stoneseraphim May 11 '17 at 08:55

0 Answers0