Issue
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, luis@hotmail.com, 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
Solution
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');
});
Answered By - Mohsen Nazari Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.