return TRUE;
}
+ /**
+ * @param $params
+ *
+ * @return string
+ */
static function buildTableSQL(&$params) {
$sql = "CREATE TABLE {$params['name']} (";
if (isset($params['fields']) &&
return $sql;
}
+ /**
+ * @param $params
+ * @param $separator
+ * @param $prefix
+ *
+ * @return string
+ */
static function buildFieldSQL(&$params, $separator, $prefix) {
$sql = '';
$sql .= $separator;
return $sql;
}
+ /**
+ * @param $params
+ * @param $separator
+ * @param $prefix
+ *
+ * @return null|string
+ */
static function buildPrimaryKeySQL(&$params, $separator, $prefix) {
$sql = NULL;
if (!empty($params['primary'])) {
return $sql;
}
+ /**
+ * @param $params
+ * @param $separator
+ * @param $prefix
+ * @param bool $indexExist
+ *
+ * @return null|string
+ */
static function buildSearchIndexSQL(&$params, $separator, $prefix, $indexExist = FALSE) {
$sql = NULL;
return $sql;
}
+ /**
+ * @param $params
+ * @param $separator
+ * @param $prefix
+ *
+ * @return string
+ */
static function buildIndexSQL(&$params, $separator, $prefix) {
$sql = '';
$sql .= $separator;
return $sql;
}
+ /**
+ * @param $tableName
+ * @param $fkTableName
+ *
+ * @return bool
+ */
static function changeFKConstraint($tableName, $fkTableName) {
$fkName = "{$tableName}_entity_id";
if (strlen($fkName) >= 48) {
return TRUE;
}
+ /**
+ * @param $params
+ * @param $separator
+ * @param $prefix
+ * @param $tableName
+ *
+ * @return null|string
+ */
static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) {
$sql = NULL;
if (!empty($params['fk_table_name']) && !empty($params['fk_field_name'])) {
return $sql;
}
+ /**
+ * @param $params
+ * @param bool $indexExist
+ * @param bool $triggerRebuild
+ *
+ * @return bool
+ */
static function alterFieldSQL(&$params, $indexExist = FALSE, $triggerRebuild = TRUE) {
$sql = str_repeat(' ', 8);
$sql .= "ALTER TABLE {$params['table_name']}";
$dao = CRM_Core_DAO::executeQuery($sql);
}
+ /**
+ * @param $tableName
+ * @param $columnName
+ */
static function dropColumn($tableName, $columnName) {
$sql = "ALTER TABLE $tableName DROP COLUMN $columnName";
$dao = CRM_Core_DAO::executeQuery($sql);
}
+ /**
+ * @param $tableName
+ * @param bool $dropUnique
+ */
static function changeUniqueToIndex($tableName, $dropUnique = TRUE) {
if ($dropUnique) {
$sql = "ALTER TABLE $tableName
$dao = CRM_Core_DAO::executeQuery($sql);
}
+ /**
+ * @param $tables
+ * @param string $createIndexPrefix
+ * @param array $substrLenghts
+ */
static function createIndexes(&$tables, $createIndexPrefix = 'index', $substrLenghts = array(
)) {
$queries = array();
}
}
+ /**
+ * @param $customFieldID
+ * @param $tableName
+ * @param $columnName
+ * @param $length
+ *
+ * @throws Exception
+ */
static function alterFieldLength($customFieldID, $tableName, $columnName, $length) {
// first update the custom field tables
$sql = "