glorand/laravel-model-settings

JSON DataType not supported with MariaDB ?

Closed this issue · 3 comments

[Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i n your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json not null, descriptionjso n null,detailsjson null,featuresjson nul' at line 1 (SQL: create ta bleproducts (idint unsigned not null auto_increment primary key,nam
ejson not null,descriptionjson null,detailsjson null,featuresjson null,priceint not null,category_idint not null,extrasjson null,created_attimestamp null,updated_at timestamp null) default cha racter set utf8 collate utf8_unicode_ci)

Unfortunately MariaDB doesn't support column type of json :/. I changed to longText to make it work. But is that in all cases safe to do ?

MariaDB supports JSON, but Laravel does not support MariaDB. This makes that work https://github.com/ybr-nx/laravel-mariadb.
I don't know if the text field would make any issues or such.

@AntonLugtenburg please use the mentioned package by @joveice laravel-mariadb - which add MariaDB JSON support to Laravel.
Requires at least MariaDB 10.2.7 to use ->json() migrations.

Thank you :)