Skip to content

Commit

Permalink
Fixes yiisoft#13776: Fixed setting precision and scale for decimal co…
Browse files Browse the repository at this point in the history
…lumns in MSSQL
  • Loading branch information
Artur Fursa authored and samdark committed Mar 16, 2017
1 parent 3c1f3e2 commit 1b322f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Yii Framework 2 Change Log
- Bug #4408: Add support for unicode word characters and `+` character in attribute names (sammousa, kmindi)
- Bug #10372: Fixed console controller including complex typed arguments in help (sammousa)
- Bug #13738: Fixed `getQueryParams()` method in `yii.js` to correctly parse URL with question mark and no query parameters (vladdnepr)
- Bug #13776: Fixed setting precision and scale for decimal columns in MSSQL (arturf)
- Bug #13704: Fixed `yii\validators\UniqueValidator` to prefix attribute name with model's database table name (vladis84)

2.0.11.2 February 08, 2017
Expand Down
2 changes: 1 addition & 1 deletion framework/db/mssql/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
Schema::TYPE_BIGINT => 'bigint',
Schema::TYPE_FLOAT => 'float',
Schema::TYPE_DOUBLE => 'float',
Schema::TYPE_DECIMAL => 'decimal',
Schema::TYPE_DECIMAL => 'decimal(18,0)',
Schema::TYPE_DATETIME => 'datetime',
Schema::TYPE_TIMESTAMP => 'datetime',
Schema::TYPE_TIME => 'time',
Expand Down
10 changes: 5 additions & 5 deletions tests/framework/db/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public function columnTypes()
'postgres' => 'numeric(10,0) CHECK (value > 5.6)',
'sqlite' => 'decimal(10,0) CHECK (value > 5.6)',
'oci' => 'NUMBER CHECK (value > 5.6)',
'sqlsrv' => 'decimal CHECK (value > 5.6)',
'sqlsrv' => 'decimal(18,0) CHECK (value > 5.6)',
'cubrid' => 'decimal(10,0) CHECK (value > 5.6)',
],
],
Expand All @@ -311,7 +311,7 @@ public function columnTypes()
'postgres' => 'numeric(10,0) NOT NULL',
'sqlite' => 'decimal(10,0) NOT NULL',
'oci' => 'NUMBER NOT NULL',
'sqlsrv' => 'decimal NOT NULL',
'sqlsrv' => 'decimal(18,0) NOT NULL',
'cubrid' => 'decimal(10,0) NOT NULL',
],
],
Expand All @@ -323,7 +323,7 @@ public function columnTypes()
'postgres' => 'numeric(12,4) CHECK (value > 5.6)',
'sqlite' => 'decimal(12,4) CHECK (value > 5.6)',
'oci' => 'NUMBER CHECK (value > 5.6)',
'sqlsrv' => 'decimal CHECK (value > 5.6)',
'sqlsrv' => 'decimal(12,4) CHECK (value > 5.6)',
'cubrid' => 'decimal(12,4) CHECK (value > 5.6)',
],
],
Expand All @@ -335,7 +335,7 @@ public function columnTypes()
'postgres' => 'numeric(12,4)',
'sqlite' => 'decimal(12,4)',
'oci' => 'NUMBER',
'sqlsrv' => 'decimal',
'sqlsrv' => 'decimal(12,4)',
'cubrid' => 'decimal(12,4)',
],
],
Expand All @@ -347,7 +347,7 @@ public function columnTypes()
'postgres' => 'numeric(10,0)',
'sqlite' => 'decimal(10,0)',
'oci' => 'NUMBER',
'sqlsrv' => 'decimal',
'sqlsrv' => 'decimal(18,0)',
'cubrid' => 'decimal(10,0)',
],
],
Expand Down

0 comments on commit 1b322f5

Please sign in to comment.