Something strange is happening, I have been seeding my project with some data for over 2 months already and suddenly today I couldn't seed them. So I went over to the test file and it's the same thing.
In migration, the column is
$table->boolean('is_visible')->default(true); In factory
'is_visible' => true In my test, it throws the query exception when i do
EmploymentType::factory()->create(); This is the error
Illuminate\Database\QueryException : SQLSTATE[42804]: Datatype mismatch: 7 ERROR: column "is_visible" is of type boolean but expression is of type integer LINE 1: ...visible", "updated_at", "created_at") values (\$1, \$2, \$3, \$4... ^ HINT: You will need to rewrite or cast the expression. (SQL: insert into "employment_types" ("name", "is_visible", "updated_at", "created_at") values (FULL-TIME, 1, 2021-05-01 01:19:05.980494, 2021-05-01 01:19:05.980494) returning "id") I can see that the values that is inserting is 1 - an integer but previously it was true. I have no idea how to fix this as all the other tables that have boolean like this is having the same errors. The only difference I did was upgrade PHP 7.4.16 to 7.4.18
Currently on:
Database - Postgres 13
Laravel Framework 8.34.0
Update:
Test with 'true' or '1' works but not true or 1 - why does this happen? Need some advice.
没有评论:
发表评论