mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-09 01:27:20 +08:00
Merge branch 'fphammerle-mysql-comma-in-enum-fix'
This commit is contained in:
@ -6,6 +6,7 @@ Yii Framework 2 Change Log
|
||||
|
||||
- Bug #4113: Error page stacktrace was generating links to private methods which are not part of the API docs (samdark)
|
||||
- Bug #9305: Fixed MSSQL `Schema::TYPE_TIMESTAMP` to be 'datetime' instead of 'timestamp', which is just an incremental number (nkovacs)
|
||||
- Bug #9616: Fixed mysql\Schema::loadColumnSchema to set enumValues attribute correctly if enum definition contains commas (fphammerle)
|
||||
- Bug #9796: Initialization of not existing `yii\grid\ActionColumn` default buttons (arogachev)
|
||||
- Bug #12681: Changed `data` column type from `text` to `blob` to handle null-byte (`\0`) in serialized RBAC rule properly (silverfire)
|
||||
- Bug #12714: Fixed `yii\validation\EmailValidator` to prevent false-positives checks when property `checkDns` is set to `true` (silverfire)
|
||||
|
||||
@ -147,8 +147,8 @@ class Schema extends \yii\db\Schema
|
||||
}
|
||||
if (!empty($matches[2])) {
|
||||
if ($type === 'enum') {
|
||||
$values = explode(',', $matches[2]);
|
||||
foreach ($values as $i => $value) {
|
||||
preg_match_all("/'[^']*'/", $matches[2], $values);
|
||||
foreach ($values[0] as $i => $value) {
|
||||
$values[$i] = trim($value, "'");
|
||||
}
|
||||
$column->enumValues = $values;
|
||||
|
||||
@ -117,7 +117,7 @@ CREATE TABLE "type" (
|
||||
"char_col" char(100) NOT NULL,
|
||||
"char_col2" varchar(100) DEFAULT 'something',
|
||||
"char_col3" string,
|
||||
"enum_col" enum('a','B'),
|
||||
"enum_col" enum('a','B','c,D'),
|
||||
"float_col" double NOT NULL,
|
||||
"float_col2" double DEFAULT '1.23',
|
||||
"blob_col" blob,
|
||||
|
||||
@ -128,7 +128,7 @@ CREATE TABLE `type` (
|
||||
`char_col` char(100) NOT NULL,
|
||||
`char_col2` varchar(100) DEFAULT 'something',
|
||||
`char_col3` text,
|
||||
`enum_col` enum('a', 'B'),
|
||||
`enum_col` enum('a', 'B', 'c,D'),
|
||||
`float_col` double(4,3) NOT NULL,
|
||||
`float_col2` double DEFAULT '1.23',
|
||||
`blob_col` blob,
|
||||
|
||||
@ -218,11 +218,11 @@ abstract class SchemaTest extends DatabaseTestCase
|
||||
],
|
||||
'enum_col' => [
|
||||
'type' => 'string',
|
||||
'dbType' => "enum('a','B')",
|
||||
'dbType' => "enum('a','B','c,D')",
|
||||
'phpType' => 'string',
|
||||
'allowNull' => true,
|
||||
'autoIncrement' => false,
|
||||
'enumValues' => ['a', 'B'],
|
||||
'enumValues' => ['a', 'B','c,D'],
|
||||
'size' => null,
|
||||
'precision' => null,
|
||||
'scale' => null,
|
||||
|
||||
Reference in New Issue
Block a user