Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

meherab's avatar

PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for t he right syntax to use near 'json not null, `custom_properties` json not n

hello this is my first post can anyone help me i got stuck...i am using spatie media library when i am going to migrate i am getting this error

PDO::prepare("create table media (id int unsigned not null auto_increment primary key, model_type varchar(191) not null, model_id char(36) not null, collection_name varch ar(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, manipulatio ns json not null, custom_properties json not null, responsive_images json not null, order_column int unsigned null, created_at timestamp null, updated_at timestamp null) defau lt character set utf8mb4 collate 'utf8mb4_unicode_ci'")

my migration file look like this

   {
         Schema::create('media', function (Blueprint $table) {
               $table->increments('id');
               $table->string('model_type');
               $table->uuid('model_id');
               $table->string('collection_name');
               $table->string('name');
               $table->string('file_name');
               $table->string('mime_type')->nullable();
               $table->string('disk');
               $table->unsignedInteger('size');
               $table->json('manipulations');
               $table->json('custom_properties');
               $table->json('responsive_images');
               $table->unsignedInteger('order_column')->nullable();
               $table->nullableTimestamps();
0 likes
6 replies
jlrdw's avatar

Try changing to manipulatio_ns

meherab's avatar

sorry couldn't understand..its default by spatie media library what change can i do...

jlrdw's avatar

You have this in migration:

$table->json('manipulations');

But in the pdo statement where is manipulatio ns the stray ns coming from.

Double check your migration for errors. Format you code (github markdown) so it's more readable here.

meherab's avatar

thanks for your utmost reply and suggestions and also i found the answer.. problem was actually my mysql version was old so i upgrade it and now it's good

Please or to participate in this conversation.