laravel-medialibrary: php artisan migrate error
Hi, Using L5.4, I’m trying to install the package but I can’t migrate the table, an error says :
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check th
e manual that corresponds to your MariaDB server version for the right syntax to use near ‘json not nu
ll,custom_propertiesjson not null,order_columnint unsigned nu’ at line 1 (SQL: create tablem edia(idint unsigned not null auto_increment primary key,model_idint unsigned not null,model _typevarchar(191) not null,collection_namevarchar(191) not null,namevarchar(191) not null,file_namevarchar(191) not null,mime_typevarchar(191) null,diskvarchar(191) not null,size
int unsigned not null,manipulationsjson not null,custom_propertiesjson not null,order_columnint unsigned null,created_attimestamp null,updated_attimestamp null) default character set u
tf8mb4 collate utf8mb4_unicode_ci)
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check th
e manual that corresponds to your MariaDB server version for the right syntax to use near ‘json not nu
ll,custom_propertiesjson not null,order_columnint unsigned nu’ at line 1
Please where’s the mistake ?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (2 by maintainers)
Are you using MySQL 5.7? That requirement is mentioned in the docs
I’ve not tested it but you could try to replace
jsonbytextin the migrations and see if that works.As per mariadb version 10.1.32 and lower it seems like mariadb does not support json data type I am still unsure if it is available in version 10.2.7+.
but here’s a simple workaround to get through this.
change json data type into text and then run your migration again.
Mudei os meus campos de json para text:
$table->text('manipulations'); $table->text('custom_properties');Funciona normal!