Merge 076e09b195
into 188bc07869
This commit is contained in:
commit
6e704f6496
|
@ -1524,6 +1524,20 @@ $CONFIG = [
|
|||
*/
|
||||
'mysql.utf8mb4' => false,
|
||||
|
||||
/**
|
||||
* This configuration parameter can be used to add or change the default options used for table creation.
|
||||
* For changing charset / collation see mysql.utf8mb4
|
||||
*
|
||||
* An example use for this parameter is where MariaDB page compression is enabled by default as the
|
||||
* COMPRESSED row format is not allowed there, and thus table creation will fail.
|
||||
* This option can then be used to override this and change the row_format option.
|
||||
*
|
||||
*/
|
||||
'dbdefaulttableoptions' => [
|
||||
'row_format' => 'dynamic',
|
||||
'page_compressed' => '1'
|
||||
],
|
||||
|
||||
/**
|
||||
* Database types that are supported for installation.
|
||||
*
|
||||
|
|
|
@ -216,13 +216,13 @@ class ConnectionFactory {
|
|||
}
|
||||
|
||||
// set default table creation options
|
||||
$connectionParams['defaultTableOptions'] = [
|
||||
$defaultTableOptions = [
|
||||
'collate' => 'utf8_bin',
|
||||
'tablePrefix' => $connectionParams['tablePrefix']
|
||||
];
|
||||
|
||||
if ($this->config->getValue('mysql.utf8mb4', false)) {
|
||||
$connectionParams['defaultTableOptions'] = [
|
||||
$defaultTableOptions = [
|
||||
'collate' => 'utf8mb4_bin',
|
||||
'charset' => 'utf8mb4',
|
||||
'row_format' => 'compressed',
|
||||
|
@ -230,6 +230,21 @@ class ConnectionFactory {
|
|||
];
|
||||
}
|
||||
|
||||
$configTableOptions = $this->config->getValue('dbdefaulttableoptions', []);
|
||||
|
||||
// prevent user from overriding collation / charset and tablePrefix here (previous behavior.)
|
||||
if (array_key_exists('collate', $configTableOptions)) {
|
||||
unset($configTableOptions['collate']);
|
||||
}
|
||||
if (array_key_exists('charset', $configTableOptions)) {
|
||||
unset($configTableOptions['charset']);
|
||||
}
|
||||
if (array_key_exists('tablePrefix', $configTableOptions)) {
|
||||
unset($configTableOptions['tablePrefix']);
|
||||
}
|
||||
|
||||
$connectionParams['defaultTableOptions'] = array_merge($defaultTableOptions, $configTableOptions);
|
||||
|
||||
return $connectionParams;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue