Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Phinx/Db/Adapter/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface AdapterInterface
public const PHINX_TYPE_JSON = 'json';
public const PHINX_TYPE_JSONB = 'jsonb';
public const PHINX_TYPE_UUID = 'uuid';
public const PHINX_TYPE_NATIVEUUID = 'nativeuuid';
public const PHINX_TYPE_FILESTREAM = 'filestream';

// Geospatial database types
Expand Down
6 changes: 6 additions & 0 deletions src/Phinx/Db/Adapter/MysqlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,8 @@ public function getSqlType(Literal|string $type, ?int $limit = null): array
return ['name' => 'tinyint', 'limit' => 1];
case static::PHINX_TYPE_UUID:
return ['name' => 'char', 'limit' => 36];
case static::PHINX_TYPE_NATIVEUUID:
return ['name' => 'uuid'];
case static::PHINX_TYPE_YEAR:
if (!$limit || in_array($limit, [2, 4])) {
$limit = 4;
Expand Down Expand Up @@ -1226,6 +1228,10 @@ public function getPhinxType(string $sqlTypeDef): array
$type = static::PHINX_TYPE_BINARYUUID;
}
break;
case 'uuid':
$type = static::PHINX_TYPE_NATIVEUUID;
$limit = null;
break;
}

try {
Expand Down
1 change: 1 addition & 0 deletions src/Phinx/Db/Adapter/PostgresAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,7 @@ public function getSqlType(Literal|string $type, ?int $limit = null): array
case static::PHINX_TYPE_DATETIME:
return ['name' => 'timestamp'];
case static::PHINX_TYPE_BINARYUUID:
case static::PHINX_TYPE_NATIVEUUID:
return ['name' => 'uuid'];
case static::PHINX_TYPE_BLOB:
case static::PHINX_TYPE_BINARY:
Expand Down
1 change: 1 addition & 0 deletions src/Phinx/Db/Adapter/SqlServerAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,7 @@ public function getSqlType(Literal|string $type, ?int $limit = null): array
return ['name' => 'bit'];
case static::PHINX_TYPE_BINARYUUID:
case static::PHINX_TYPE_UUID:
case static::PHINX_TYPE_NATIVEUUID:
return ['name' => 'uniqueidentifier'];
case static::PHINX_TYPE_FILESTREAM:
return ['name' => 'varbinary', 'limit' => 'max'];
Expand Down
1 change: 1 addition & 0 deletions src/Phinx/Db/Table/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Column
public const TIMESTAMP = AdapterInterface::PHINX_TYPE_TIMESTAMP;
public const UUID = AdapterInterface::PHINX_TYPE_UUID;
public const BINARYUUID = AdapterInterface::PHINX_TYPE_BINARYUUID;
public const NATIVEUUID = AdapterInterface::PHINX_TYPE_NATIVEUUID;
/** MySQL-only column type */
public const MEDIUMINTEGER = AdapterInterface::PHINX_TYPE_MEDIUM_INTEGER;
/** MySQL-only column type */
Expand Down