Reputation: 99
How to fix this?
SQLSTATE[HY000]: General error: 1364 Field 'note' doesn't have a default value (SQL: insert into
people
(name
,user_id
,updated_at
,created_at
) values (Luis, [email protected], 2, 2021-08-09 15:03:07, 2021-08-09 15:03:07))
I've already tried to set a default value, but I believe I'm not doing it right
Upvotes: 1
Views: 161
Reputation: 1349
You should either decide to have a default null
value or some default other string.
For default null value:
Schema::table('people', function (Blueprint $table) {
$table->longText('note')->nullable()->after('email');
});
Any other default value should be:
Schema::table('people', function (Blueprint $table) {
$table->longText('note')->default('Some Default Value.')->after('email');
});
Upvotes: 2