From cc45546594bc5e3b25fbb9c195971ed711ac7c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Rish=C3=B8j?= Date: Mon, 31 Aug 2026 17:53:52 +0200 Subject: [PATCH] Support the UUID field type MariaDB 10.7+ and PostgreSQL both have a native UUID column type, and Laravel's $table->uuid() emits it, so it turns up in ordinary schema dumps. The parser rejected it outright with 'Unsupported field type: UUID'. UUID takes no length, precision or charset, so it belongs with the other argument-less types alongside JSON and DATE. --- src/SQLParser.php | 1 + tests/FieldTest.php | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/SQLParser.php b/src/SQLParser.php index 921386a..82fa2ad 100644 --- a/src/SQLParser.php +++ b/src/SQLParser.php @@ -601,6 +601,7 @@ function parse_field($tokens){ case 'MEDIUMBLOB': case 'LONGBLOB': case 'JSON': + case 'UUID': case 'GEOMETRY': case 'POINT': case 'LINESTRING': diff --git a/tests/FieldTest.php b/tests/FieldTest.php index af15803..037c3ba 100644 --- a/tests/FieldTest.php +++ b/tests/FieldTest.php @@ -27,6 +27,7 @@ function testSimpleFields(){ # MEDIUMBLOB # LONGBLOB # JSON + # UUID $tbl = $this->get_first_table("CREATE TABLE foo (bar DATE)"); $this->assertEquals($tbl['fields'], array( @@ -35,6 +36,14 @@ function testSimpleFields(){ 'type' => "DATE", ) )); + + $tbl = $this->get_first_table("CREATE TABLE foo (bar UUID)"); + $this->assertEquals($tbl['fields'], array( + array( + 'name' => "bar", + 'type' => "UUID", + ) + )); } function testInts(){