diff --git a/src/Phinx/Db/Adapter/AdapterInterface.php b/src/Phinx/Db/Adapter/AdapterInterface.php index 774fb1f5d1..2470694fc1 100644 --- a/src/Phinx/Db/Adapter/AdapterInterface.php +++ b/src/Phinx/Db/Adapter/AdapterInterface.php @@ -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'; diff --git a/src/Phinx/Db/Adapter/MysqlAdapter.php b/src/Phinx/Db/Adapter/MysqlAdapter.php index e09fb384e4..b729500075 100644 --- a/src/Phinx/Db/Adapter/MysqlAdapter.php +++ b/src/Phinx/Db/Adapter/MysqlAdapter.php @@ -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 { diff --git a/src/Phinx/Db/Adapter/PostgresAdapter.php b/src/Phinx/Db/Adapter/PostgresAdapter.php index eaaf05cd02..d4808c5a5e 100644 --- a/src/Phinx/Db/Adapter/PostgresAdapter.php +++ b/src/Phinx/Db/Adapter/PostgresAdapter.php @@ -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; }