diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 4250e05..5996173 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -18,6 +18,7 @@ Yii Framework 2 Change Log - Bug #12045: Added missing `LEVEL_PROFILE` to `yii\log\Logger::getLevelName()` map (Mak-Di) - Bug #10681: Reverted fix of beforeValidate event calling in `yii.activeForm.js` (silverfire) - Bug #11715: Fixed JS validation when the same model's attribute file input is listed more than once on the same page (uaoleg) +- Bug #11541: Fixed default MySQL integer display width for unsigned primary key (h311ion, rob006, cebe) - Enh #10583: Do not silence session errors in debug mode (samdark) - Enh #11804: Added `yii\behaviors\AttributeTypecastBehavior` for maintaining of strict ActiveRecord attribute types (klimov-paul) - Enh #12048: Improved message extraction command performance (samdark) diff --git a/framework/db/mysql/QueryBuilder.php b/framework/db/mysql/QueryBuilder.php index 065c461..98e0bea 100644 --- a/framework/db/mysql/QueryBuilder.php +++ b/framework/db/mysql/QueryBuilder.php @@ -24,7 +24,7 @@ class QueryBuilder extends \yii\db\QueryBuilder */ public $typeMap = [ Schema::TYPE_PK => 'int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY', - Schema::TYPE_UPK => 'int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY', + Schema::TYPE_UPK => 'int(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY', Schema::TYPE_BIGPK => 'bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY', Schema::TYPE_UBIGPK => 'bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY', Schema::TYPE_CHAR => 'char(1)', diff --git a/tests/framework/db/QueryBuilderTest.php b/tests/framework/db/QueryBuilderTest.php index 238d76e..b40074b 100644 --- a/tests/framework/db/QueryBuilderTest.php +++ b/tests/framework/db/QueryBuilderTest.php @@ -892,7 +892,7 @@ abstract class QueryBuilderTest extends DatabaseTestCase Schema::TYPE_UPK, $this->primaryKey()->unsigned(), [ - 'mysql' => 'int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'mysql' => 'int(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY', 'postgres' => 'serial NOT NULL PRIMARY KEY', 'sqlite' => 'integer UNSIGNED PRIMARY KEY AUTOINCREMENT NOT NULL', ],