I'm trying to change column type from integer to boolean.
I've created a migration with following
$table->integer('has_varients')->default(0)->comment('1:yes, 0:no');
Now I'm creating another migration to alter datatype
$table->boolean('has_varients')->nullable()->change();
When running php artisan migrate, I'm getting following error,
SQLSTATE[42804]: Datatype mismatch: 7 ERROR: column "has_varients" cannot be cast automatically to type boolean
HINT: You might need to specify "USING has_varients::boolean". (SQL: ALTER TABLE products ALTER has_varients TYPE BOOLEAN)
I'm using PostgreSQL.