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_properties
json not null,order_column
int unsigned nu’ at line 1 (SQL: create tablem edia
(id
int unsigned not null auto_increment primary key,model_id
int unsigned not null,model _type
varchar(191) not null,collection_name
varchar(191) not null,name
varchar(191) not null,file_name
varchar(191) not null,mime_type
varchar(191) null,disk
varchar(191) not null,size
int unsigned not null,manipulations
json not null,custom_properties
json not null,order_column
int unsigned null,created_at
timestamp null,updated_at
timestamp 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_properties
json not null,order_column
int 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
json
bytext
in 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!