Skip to content
Permalink
Browse files

Fixed detection of "binary" column. SqlserverSchema now returns lengt…

…hs of binary fields.
  • Loading branch information...
dmromanov committed Oct 2, 2018
1 parent b5c0db7 commit 123c5c8fb69e4d0788df6a943dc23d71475b7d96
Showing with 23 additions and 2 deletions.
  1. +2 −2 src/Database/Schema/SqlserverSchema.php
  2. +21 −0 tests/TestCase/Database/Schema/SqlserverSchemaTest.php
@@ -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') {
@@ -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]
],
];
}

0 comments on commit 123c5c8

Please sign in to comment.
You can’t perform that action at this time.