Skip to content
Snippets Groups Projects
Commit cc0b2b76 authored by Satish's avatar Satish
Browse files

Fixes #799 - Move starred featured to common entity table.

parent a93bfc24
No related branches found
No related tags found
2 merge requests!311Language italian translation,!289Fixes #799, #729, #512
This commit is part of merge request !289. Comments created here will be created in the context of that merge request.
......@@ -182,9 +182,20 @@ if (defined('VTIGER_UPGRADE')) {
Vtiger_Utils::CreateTable($generalUserFieldTable,
'(`recordid` INT(19) NOT NULL,
`userid` INT(19) NOT NULL,
`starred` VARCHAR(100) DEFAULT NULL,
Index `record_user_idx` (`recordid`, `userid`),
FOREIGN KEY (recordid) REFERENCES vtiger_crmentity(crmid) ON DELETE CASCADE)', true);
`starred` VARCHAR(100) DEFAULT NULL', true);
}
if (Vtiger_Utils::CheckTable($generalUserFieldTable)) {
$indexRes = $db->pquery("SHOW INDEX FROM $generalUserFieldTable WHERE NON_UNIQUE=? AND KEY_NAME=?", array('1', 'record_user_idx'));
if ($db->num_rows($indexRes) < 2) {
$db->pquery('ALTER TABLE vtiger_crmentity_user_field ADD CONSTRAINT record_user_idx UNIQUE KEY(recordid, userid)', array());
}
$checkUserFieldConstraintExists = $db->pquery('SELECT DISTINCT 1 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE table_name=? AND CONSTRAINT_SCHEMA=?', array($generalUserFieldTable, $db->dbName));
if ($db->num_rows($checkUserFieldConstraintExists) < 1) {
$db->pquery('ALTER TABLE vtiger_crmentity_user_field ADD CONSTRAINT `fk_vtiger_crmentity_user_field_recordid` FOREIGN KEY (`recordid`) REFERENCES `vtiger_crmentity`(`crmid`) ON DELETE CASCADE', array());
}
}
$migratedTables = array();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment