Skip to content

Commit

Permalink
Fixed detection of "binary" column. SqlserverSchema now returns lengt…
Browse files Browse the repository at this point in the history
…hs of binary fields.
  • Loading branch information
dmromanov committed Oct 2, 2018
1 parent b5c0db7 commit 123c5c8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Database/Schema/SqlserverSchema.php
Expand Up @@ -138,8 +138,8 @@ protected function _convertColumn($col, $length = null, $precision = null, $scal
return ['type' => TableSchema::TYPE_TEXT, 'length' => null];
}

if ($col === 'image' || strpos($col, 'binary')) {
return ['type' => TableSchema::TYPE_BINARY, 'length' => null];
if ($col === 'image' || strpos($col, 'binary') !== false) {
return ['type' => TableSchema::TYPE_BINARY, 'length' => $length];
}

if ($col === 'uniqueidentifier') {
Expand Down
21 changes: 21 additions & 0 deletions tests/TestCase/Database/Schema/SqlserverSchemaTest.php
Expand Up @@ -244,6 +244,27 @@ public static function convertColumnProvider()
null,
['type' => 'text', 'length' => null]
],
[
'IMAGE',
10,
null,
null,
['type' => 'binary', 'length' => 10]
],
[
'BINARY',
20,
null,
null,
['type' => 'binary', 'length' => 20]
],
[
'VARBINARY',
30,
null,
null,
['type' => 'binary', 'length' => 30]
],
];
}

Expand Down

0 comments on commit 123c5c8

Please sign in to comment.