Last active
October 9, 2015 11:58
-
-
Save bickart/3501593 to your computer and use it in GitHub Desktop.
SugarCRM Extension to added a Custom Index
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Created on Aug 27, 2012 | |
* | |
* Jeff Bickart | |
* @bickart | |
* NEPO Systems, LLC | |
* | |
* custom/Extension/application/Ext/TableDictionary/custom_indexes.php | |
*/ | |
include('custom/metadata/custom_indexes.php'); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Created on Aug 27, 2012 | |
* | |
* Jeff Bickart | |
* @bickart | |
* NEPO Systems, LLC | |
* | |
* custom/metadata/custom_indexes.php | |
*/ | |
/* $repairedTables is a variable that gets defined in the repairDatabase.php program */ | |
if (isset($repairedTables)) { | |
/* We have to tell the repairDatabases.php that we have not yet repaired our custom table | |
so that it can find custom indexes */ | |
if (isset($repairedTables['module_cstm'])) { | |
unset($repairedTables['module_cstm']); | |
} | |
} | |
/* Define the index */ | |
$dictionary["module_cstm"] = array( | |
'table' => 'module_cstm', | |
'fields' => //We can added fields here, we must at least have the id_c field | |
array( | |
0 => | |
array( | |
'name' => 'id_c', | |
'type' => 'id', | |
), | |
), | |
'indices' => // our custom indexes go here | |
array( | |
0 => | |
array( | |
'name' => 'custom_index_idx', | |
'type' => 'index', | |
'fields' => | |
array( | |
0 => 'field_c', | |
), | |
), | |
), | |
); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment