mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 21:41:19 +08:00
Fixes #15167: Fixed loading of default value current_timestamp() for MariaDB >= 10.2.3
This commit is contained in:
committed by
Alexander Makarov
parent
c59df914c1
commit
7ccadb4a79
@ -4,6 +4,7 @@ Yii Framework 2 Change Log
|
||||
2.0.16 under development
|
||||
------------------------
|
||||
|
||||
- Bug #15167: Fixed loading of default value `current_timestamp()` for MariaDB >= 10.2.3 (rugabarbo, bloodrain777, Skinka)
|
||||
- Bug #16253: Fixed empty checkboxlist validation (GHopperMSK)
|
||||
- Bug #15286: Fixed incorrect formatting of time with timezone information (rugabarbo)
|
||||
- Bug #17021: Fix to do not remove existing message category files in a subfolder (albertborsos)
|
||||
|
||||
@ -287,7 +287,14 @@ SQL;
|
||||
$column->phpType = $this->getColumnPhpType($column);
|
||||
|
||||
if (!$column->isPrimaryKey) {
|
||||
if (($column->type === 'timestamp' || $column->type ==='datetime') && $info['default'] === 'CURRENT_TIMESTAMP') {
|
||||
/**
|
||||
* When displayed in the INFORMATION_SCHEMA.COLUMNS table, a default CURRENT TIMESTAMP is displayed
|
||||
* as CURRENT_TIMESTAMP up until MariaDB 10.2.2, and as current_timestamp() from MariaDB 10.2.3.
|
||||
*
|
||||
* See details here: https://mariadb.com/kb/en/library/now/#description
|
||||
*/
|
||||
if (($column->type === 'timestamp' || $column->type === 'datetime') &&
|
||||
($info['default'] === 'CURRENT_TIMESTAMP' || $info['default'] === 'current_timestamp()')) {
|
||||
$column->defaultValue = new Expression('CURRENT_TIMESTAMP');
|
||||
} elseif (isset($type) && $type === 'bit') {
|
||||
$column->defaultValue = bindec(trim($info['default'], 'b\''));
|
||||
|
||||
Reference in New Issue
Block a user