Skip to content

Commit

Permalink
Support BINARY columns
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Apr 22, 2021
1 parent 6078af6 commit 2e8b092
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Processor/CreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,17 @@ private static function getDefinitionColumn(Query\MysqlColumnType $stmt) : Colum
return new Column\Decimal($stmt->length, $stmt->decimals);

case DataType::BINARY:
if ($stmt->length === null) {
throw new \UnexpectedValueException('length should not be null');
}

return new Column\Binary($stmt->length, 'binary', 'binary');

case DataType::CHAR:
if ($stmt->length === null) {
throw new \UnexpectedValueException('length should not be null');
}

return new Column\Char($stmt->length);

case DataType::ENUM:
Expand Down
9 changes: 9 additions & 0 deletions src/Schema/Column/Binary.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
namespace Vimeo\MysqlEngine\Schema\Column;

use Pov\Definition\MySqlDefinition;

class Binary extends CharacterColumn implements StringColumn, Defaultable
{
use MySqlDefaultTrait;
}

0 comments on commit 2e8b092

Please sign in to comment.