Skip to content

Commit

Permalink
Start adding binaryuuid support.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Apr 10, 2020
1 parent 4b3ed1a commit 6cc5558
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Phinx/Db/Adapter/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ interface AdapterInterface
const PHINX_TYPE_DATE = 'date';
const PHINX_TYPE_BINARY = 'binary';
const PHINX_TYPE_VARBINARY = 'varbinary';
const PHINX_TYPE_BINARYUUID = 'binaryuuid';
const PHINX_TYPE_BLOB = 'blob';
const PHINX_TYPE_BOOLEAN = 'boolean';
const PHINX_TYPE_JSON = 'json';
Expand Down
4 changes: 4 additions & 0 deletions src/Phinx/Db/Adapter/MysqlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,10 @@ public function getPhinxType($sqlTypeDef)
$type = static::PHINX_TYPE_TEXT;
$limit = static::TEXT_LONG;
break;
case 'binary':
if ($limit === 16) {
$type = static::PHINX_TYPE_BINARYUUID;
}
}

try {
Expand Down
4 changes: 4 additions & 0 deletions src/Phinx/Db/Adapter/PostgresAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ public function getColumns($tableName)
$column->setPrecision($columnInfo['numeric_precision']);
}

if ($column->getType() === static::PHINX_TYPE_BINARY && $column->getLimit() === 16) {
$column->setType(static::PHINX_TYPE_BINARYUUID);
}

$columns[] = $column;
}

Expand Down

0 comments on commit 6cc5558

Please sign in to comment.