R
R
RaDir2019-11-15 16:41:01
Laravel
RaDir, 2019-11-15 16:41:01

The json type field in laravel migration creates a longtext field in the database, why?

Hello!
I create a migration, specify , a field with type longtext is created in the database . How to create json type field in migration? $table->json('options')->nullable();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Vorotnev, 2019-11-15
@RaDir

MariaDB does not fully support the JSON type like new versions of MySQL do, but rather emulates it. However, she does it very well, but the field type will be longtext , and JSON will be just an alias to it. It's all in the official documentation.

S
Stanislav, 2019-11-15
@mzcoding

Because your DBMS does not support the json type (rather an old version of mysql)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question