AFAIK, mariaDB doesn't have a datatype json ? (Some one correct me if wrong). To create a dynamic column you can try using $table->binary()
Edit: it available starting with 10.0.16
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, I've encountered an annoying error here while trying to make a json field(mariaDB).
Here's the code
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('username')->unique();
$table->string('email')->unique();
$table->string('password', 60);
$table->string('verification_token', 30)->nullable();
// $table->json('settings'); This causes an error, commenting it out solves it
$table->rememberToken();
$table->timestamps();
});
}
[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 fo
r the right syntax to use near 'json not null, `remember_token` varchar(100) null, `created_at` timestamp not nu' at line 1 (SQL: create table `users` (`id` int
unsigned not null auto_increment primary key, `username` varchar(255) not null, `email` varchar(255) not null, `password` varchar(60) not null, `verification_tok
en` varchar(30) null, `settings` json not null, `remember_token` varchar(100) null, `created_at` timestamp not null, `updated_at` timestamp not null) default cha
racter set utf8 collate utf8_unicode_ci)
I'm using Laravel 5.2, are there any extra steps I need to take?
Please or to participate in this conversation.