ybr-nx / laravel-mariadb

Add MariaDB JSON select support to Laravel
95 stars 7 forks source link

SQL error with nullable() and after during migration #6

Open RibesAlexandre opened 6 years ago

RibesAlexandre commented 6 years ago

Hi,

I've got an error durant a migration with Maria DB. I just try to add a JSON field in my tables after a specific column.

Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that correspon
ds to your MariaDB server version for the right syntax to use near 'CHECK (json_data IS NULL OR JSON_VALID(json_data))' a
t line 1

My migrations :

Schema::table('polls', function (Blueprint $table) {
     $table->json('json_data')->nullable()->after('article_id');
});

Schema::table('composition_team', function(Blueprint $table) {
    $table->json('json_data')->nullable()->after('article_id');
 });

Works perfectly without ->after('article_id');

Thanks, Regards, SquallX.

pix2D commented 5 years ago

@ybr-nx I am getting this same issue again since upgrading to Laravel 5.8. If ->after() is present it errors out, without it everything works.

ybr-nx commented 5 years ago

I'll investigate it soon

jbarton-ysg commented 5 years ago

getting same error during migrations 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