Adding Column using sqlite caused error "Cannot add a NOT NULL column with default value NULL"

Posted: 2014-05-04 13:32:34

After the security update I had to add a remember_token to my user table. security update

Since I am using sqllite locally I ended up with this error

>php artisan migrate

  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL (SQL: alter table "users" add column "remember_token" text not null)

Finally this post made it clear I had to make this nullable

//migration file
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function(Blueprint $table)
        {
            $table->text('remember_token')->nullable();
        });
    }