Level 28
You wrote
deafult(false);
Instead of
default(false);
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm using a migration that adds "verified" column to users table:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddVerifiedColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('verified')->deafult(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('verified');
});
}
}
The goal is to add "verified" column and set it to false for all current users and future registered users.
When I try to run php artisan migrate, I get the following error:
SQLSTATE[23502]: Not null violation: 7 ERROR: column "verified" contains null values (SQL: alter table "users" add column "verified" boolean not null)
Why does it contain null values? It should contain boolean value: false.
EDIT: database is postgreSQL
You wrote
deafult(false);
Instead of
default(false);
Please or to participate in this conversation.