Allow defaultTableOptions to be overridden from configuration.
Signed-off-by: Yip Rui Fung <rf@yrf.me>
This commit is contained in:
parent
df9ce19a6b
commit
af92e6f7eb
|
@ -1512,6 +1512,21 @@ $CONFIG = [
|
||||||
*/
|
*/
|
||||||
'mysql.utf8mb4' => false,
|
'mysql.utf8mb4' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This configuration parameter can be used to override the default options used for table creation.
|
||||||
|
* This parameter will take precedence over mysql.utf8mb4 if that is set to true.
|
||||||
|
*
|
||||||
|
* 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/remove the row_format option.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
'dbdefaulttableoptions' => [
|
||||||
|
'collate' => 'utf8mb4_bin',
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'row_format' => 'compressed'
|
||||||
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database types that are supported for installation.
|
* Database types that are supported for installation.
|
||||||
*
|
*
|
||||||
|
|
|
@ -216,20 +216,20 @@ class ConnectionFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default table creation options
|
// set default table creation options
|
||||||
$connectionParams['defaultTableOptions'] = [
|
$connectionParams['defaultTableOptions'] = $this->config->getValue('dbdefaulttableoptions', [
|
||||||
'collate' => 'utf8_bin',
|
'collate' => 'utf8_bin'
|
||||||
'tablePrefix' => $connectionParams['tablePrefix']
|
]);
|
||||||
];
|
|
||||||
|
|
||||||
if ($this->config->getValue('mysql.utf8mb4', false)) {
|
if ($this->config->getValue('mysql.utf8mb4', false) && is_null($this->config->getValue('dbdefaulttableoptions'))) {
|
||||||
$connectionParams['defaultTableOptions'] = [
|
$connectionParams['defaultTableOptions'] = [
|
||||||
'collate' => 'utf8mb4_bin',
|
'collate' => 'utf8mb4_bin',
|
||||||
'charset' => 'utf8mb4',
|
'charset' => 'utf8mb4',
|
||||||
'row_format' => 'compressed',
|
'row_format' => 'compressed'
|
||||||
'tablePrefix' => $connectionParams['tablePrefix']
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$connectionParams['defaultTableOptions']['tablePrefix'] = $connectionParams['tablePrefix'];
|
||||||
|
|
||||||
return $connectionParams;
|
return $connectionParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue