Skip to content

Commit 2e8b092

Browse files
committed
Support BINARY columns
1 parent 6078af6 commit 2e8b092

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Processor/CreateProcessor.php

+10
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,17 @@ private static function getDefinitionColumn(Query\MysqlColumnType $stmt) : Colum
163163
return new Column\Decimal($stmt->length, $stmt->decimals);
164164

165165
case DataType::BINARY:
166+
if ($stmt->length === null) {
167+
throw new \UnexpectedValueException('length should not be null');
168+
}
169+
170+
return new Column\Binary($stmt->length, 'binary', 'binary');
171+
166172
case DataType::CHAR:
173+
if ($stmt->length === null) {
174+
throw new \UnexpectedValueException('length should not be null');
175+
}
176+
167177
return new Column\Char($stmt->length);
168178

169179
case DataType::ENUM:

src/Schema/Column/Binary.php

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
namespace Vimeo\MysqlEngine\Schema\Column;
3+
4+
use Pov\Definition\MySqlDefinition;
5+
6+
class Binary extends CharacterColumn implements StringColumn, Defaultable
7+
{
8+
use MySqlDefaultTrait;
9+
}

0 commit comments

Comments
 (0)