Skip to content

Commit

Permalink
Fixed SqlserverSchema return colum length double the actual size #11295
Browse files Browse the repository at this point in the history
  • Loading branch information
dmromanov committed Oct 9, 2017
1 parent 61e19f3 commit f6a27e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Database/Schema/SqlserverSchema.php
Expand Up @@ -46,7 +46,11 @@ public function describeColumnSql($tableName, $config)
AC.column_id AS [column_id],
AC.name AS [name],
TY.name AS [type],
AC.max_length AS [char_length],
IIF (
TY.name = \'nchar\' OR TY.name = \'nvarchar\' OR TY.name = \'ntext\',
AC.max_length / 2,
AC.max_length
) AS [char_length],
AC.precision AS [precision],
AC.scale AS [scale],
AC.is_identity AS [autoincrement],
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Database/Schema/SqlserverSchemaTest.php
Expand Up @@ -324,7 +324,7 @@ public function testDescribeTable()
'type' => 'string',
'null' => true,
'default' => '無題',
'length' => 40,
'length' => 20,
'precision' => null,
'comment' => null,
'fixed' => null,
Expand All @@ -334,7 +334,7 @@ public function testDescribeTable()
'type' => 'string',
'null' => true,
'default' => '本文なし',
'length' => 2000,
'length' => 1000,
'precision' => null,
'fixed' => null,
'comment' => null,
Expand Down

0 comments on commit f6a27e2

Please sign in to comment.