vtiger_cv2users not being created
I noticed in the logs of a test migration system that there were some database errors about a non-existing table:
Mon Nov 5 13:19:37 2018,194 [12464] INFO VT - PearDatabase ->ADODB error Query Failed:SELECT vtiger_users.id, vtiger_users.last_name, vtiger_users.first_name FROM vtiger_users
INNER JOIN vtiger_cv2users ON vtiger_cv2users.userid = vtiger_users.id
WHERE vtiger_cv2users.cvid = ?::->[1146]Table 'test.vtiger_cv2users' doesn't exist
In the migration script 660_700.php is the fragment of code:
if (!Vtiger_Utils::CheckTable('vtiger_cv2users')) {
Vtiger_Utils::CreateTable('vtiger_cv2users',
'(`cvid` int(25) NOT NULL,
`userid` int(25) NOT NULL,
KEY `vtiger_cv2users_ibfk_1` (`cvid`),
CONSTRAINT `vtiger_customview_ibfk_1` FOREIGN KEY (`cvid`) REFERENCES `vtiger_customview` (`cvid`) ON DELETE CASCADE,
CONSTRAINT `vtiger_users_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `vtiger_users` (`id`) ON DELETE CASCADE)', true);
}
I tried to create this manually but got an error 121 from MySQL saying it couldn't create the table. I then removed the CONSTRAINTS and I could create the table.
According to Google this could suggest a possible name conflict in a foreign key constraint name.