Nosean
5 months ago

Migration json field

Posted 5 months ago by Nosean

Hello,

i have a problem with json field migration. I get the following error message after confirming the migrate command:

   Illuminate\Database\QueryException  : 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 the right syntax to use near 'json null, `is_active` tiny
int(1) not null default '0', `created_at` timestamp n' at line 1 (SQL: create table `roles` (`id` int unsigned not null auto_increment primary key, `name` varchar(191) not null, `slug` varchar(191) null, `description` text null, `permissions` json null, `is_act
ive` tinyint(1) not null default '0', `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

my migration file:

 public function up()
    {
        Schema::create('roles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('slug')->nullable();
            $table->text('description')->nullable();
            $table->json('permissions')->nullable();
            $table->boolean('is_active')->default(false);
            $table->timestamps();
        });
    }

Where is the problem ?

Please sign in or create an account to participate in this conversation.