* @param string $properties
* @param bool $localizable is this a field that should be localized
* @param string|null $version CiviCRM version to use if rebuilding multilingual schema
+ * @param bool $triggerRebuild should we trigger the rebuild of the multilingual schema
*
* @return bool
*/
- public static function addColumn($ctx, $table, $column, $properties, $localizable = FALSE, $version = NULL) {
+ public static function addColumn($ctx, $table, $column, $properties, $localizable = FALSE, $version = NULL, $triggerRebuild = TRUE) {
$locales = CRM_Core_I18n::getMultilingual();
$queries = [];
if (!CRM_Core_BAO_SchemaHandler::checkIfFieldExists($table, $column, FALSE)) {
CRM_Core_DAO::executeQuery($query, [], TRUE, NULL, FALSE, FALSE);
}
}
- if ($locales) {
+ if ($locales && $triggerRebuild) {
CRM_Core_I18n_Schema::rebuildMultilingualSchema($locales, $version, TRUE);
}
return TRUE;
*
* @param CRM_Queue_TaskContext $ctx
* @param string $table
- * @param string|array $column
+ * @param string|array $columns
+ * @param string $prefix
* @return bool
*/
- public static function addIndex($ctx, $table, $column) {
- $tables = [$table => (array) $column];
- CRM_Core_BAO_SchemaHandler::createIndexes($tables);
+ public static function addIndex($ctx, $table, $columns, $prefix = 'index') {
+ $tables = [$table => (array) $columns];
+ CRM_Core_BAO_SchemaHandler::createIndexes($tables, $prefix);
return TRUE;
}