Closed Gonzalo2683 closed 6 months ago
@Gonzalo2683 Could you provide your PHP, Laravel, spatie/laravel-medialibrary
, and MariaDB version numbers? I couldn't reproduce this issue using a fresh Laravel 11 project, this package v11.4
, and MariaDB 11 (along with the Laravel mariadb
driver.)
With MariaDB 11, the uuid
column with a uuid
type is created without issue:
MariaDB [db]> select VERSION();
+---------------------------------------------+
| VERSION() |
+---------------------------------------------+
| 10.4.33-MariaDB-1:10.4.33+maria~ubu2004-log |
+---------------------------------------------+
1 row in set (0.000 sec)
composer show spatie/laravel-medialibrary
name : spatie/laravel-medialibrary
descrip. : Associate files with Eloquent models
keywords : cms, conversion, downloads, images, laravel, laravel-medialibrary, media, spatie
versions : * 11.4.7
released : 2024-04-24, this week
type : library
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : https://github.com/spatie/laravel-medialibrary
source : [git] https://github.com/spatie/laravel-medialibrary.git 85f5f8284f827b8f2b426943e357e3df117ad1f5
dist : [zip] https://api.github.com/repos/spatie/laravel-medialibrary/zipball/85f5f8284f827b8f2b426943e357e3df117ad1f5 85f5f8284f827b8f2b426943e357e3df117ad1f5
path : /var/www/html/vendor/spatie/laravel-medialibrary
names : spatie/laravel-medialibrary
Laravel Version ............................................................................ 11.5.0
PHP Version ................................................................................. 8.2.18
Composer Version ........................................................................ 2.7.4
@Gonzalo2683 The issue appears to be with MariaDB versions below 10.7. According to the article linked below, 10.7 was when uuid
data types were introduced - I would suggest using the mysql
Laravel driver if you're unable to upgrade.
Since this is not an issue with the package, I'm going to close the issue. Thanks for the quick follow-up! :+1:
Reference: https://mariadb.org/10-7-preview-feature-uuid-data-type/
How to Reproduce the Problem
The problem occurs when using the new mariadb connection, but the error does not occur when using mysql. with -> DB_CONNECTION="mysql" // no error with -> DB_CONNECTION="mariadb" // migration error
Problem Summary
When attempting to run the migration for the Laravel Media Library package on a MariaDB database, a SQL syntax error occurs. The error message indicates a problem near line 1 of the SQL statement used to create the media table.
Technical Details
The issue is caused by the definition of the uuid column in the migration. The Media Library package defines this column as a uuid data type that allows null values (nullable()).