Hello,
I'm feeling extremely stupid because I'm unable to make a very simple migration work:
return Migration::addColumns('users', [
'new_field' => ['string', 'nullable' => true]
]);
It fails with:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ') null' at line 1 (SQL: alter table `f1
5_users` add `new_field` varchar() null)
I'm using MySQL 8.0.
If I run the same migration built manually, it works fine:
return [
'up' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) {
$table->string('new_field')->nullable();
});
},
'down' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) {
$table->dropColumn('new_field');
});
},
];
Any insight? 😅