Skip to content

Commit

Permalink
Merge pull request #18642 from seamuslee001/dev_core_339_custom_field
Browse files Browse the repository at this point in the history
dev/core#334 Use the current in use collation and character sets when…
  • Loading branch information
seamuslee001 authored Sep 30, 2020
2 parents 6f776cf + 799f314 commit ee523fb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CRM/Core/BAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -1610,10 +1610,15 @@ public static function formatCustomField(
*/
public static function defaultCustomTableSchema($params) {
// add the id and extends_id
$collation = CRM_Core_BAO_SchemaHandler::getInUseCollation();
$characterSet = 'utf8';
if (stripos($collation, 'utf8mb4') !== FALSE) {
$characterSet = 'utf8mb4';
}
$table = [
'name' => $params['name'],
'is_multiple' => $params['is_multiple'],
'attributes' => "ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci",
'attributes' => "ENGINE=InnoDB DEFAULT CHARACTER SET {$characterSet} COLLATE {$collation}",
'fields' => [
[
'name' => 'id',
Expand Down

0 comments on commit ee523fb

Please sign in to comment.