Skip to content

Conversation

@yeganemehr
Copy link

@yeganemehr yeganemehr commented Oct 22, 2025

Problem

Currently MariaDB is not supported.
MariaDB’s grammar is very similar to MySQL’s, both should use the same binary(%d) column type.

Additionally, the typeEfficientUuid method determines the column type based on the grammar class name rather than its parent type. This causes issues when using a custom grammar class because developers must name it exactly the same as the parent class for laravel-model-uuid to work correctly.

Grammar::macro('typeEfficientUuid', function (Fluent $column) {
return match (class_basename(static::class)) {
'MySqlGrammar' => sprintf('binary(%d)', $column->length ?? 16),
'PostgresGrammar' => 'bytea',
'SQLiteGrammar' => 'blob(256)',
default => throw new UnknownGrammarClass
};
});

Solution

The solution is to check the parent type of the grammar class instead of relying on its name.
This makes the logic more flexible and ensures compatibility with MariaDB and any future MySQL or PostgreSQL variations.

@yeganemehr
Copy link
Author

@michaeldyrynda can you please review this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant