I am trying to run PHPUnit test. I have setup SQLite
in :memory
for the testing environment. In my setup, I call Artisan::call('migrate')
but then I get the following error:
General error: 1 Cannot add a NOT NULL column with default value NULL (SQL: alter table "admins" add column "title" text not null)
Basically, any migration file that is modifying an existing table returns an error. Why?
Here is the file migration is complaining about:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddTitleToAdminsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('admins', function(Blueprint $table)
{
$table->text('title');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('admins', function(Blueprint $table)
{
$table->dropColumn('title');
});
}
}