ฉันกำลังพยายามรันการทดสอบ PHPUnit ฉันได้ตั้งค่า SQLite
ใน :memory
สำหรับสภาพแวดล้อมการทดสอบ ในการตั้งค่าของฉัน ฉันโทรไปที่ Artisan::call('migrate')
แต่ฉันได้รับข้อผิดพลาดต่อไปนี้:
ข้อผิดพลาดทั่วไป: 1 ไม่สามารถเพิ่มคอลัมน์ NOT NULL ด้วยค่าเริ่มต้น NULL (SQL: แก้ไขตาราง "admins" เพิ่มคอลัมน์ "title" ข้อความไม่เป็น null)
โดยพื้นฐานแล้ว ไฟล์การโยกย้ายใดๆ ที่กำลังแก้ไขตารางที่มีอยู่จะส่งกลับข้อผิดพลาด ทำไม
นี่คือการย้ายไฟล์ที่บ่นเกี่ยวกับ:
<?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');
});
}
}