【发布时间】:2014-01-16 07:30:19
【问题描述】:
为什么我在使用 SQLite 驱动程序时会收到此警告?我的 MySQL 驱动程序没有问题,但 SQLite 抛出了这个错误。
这对我来说没有意义,因为我知道播种是在所有迁移完成后才发生的,所以为什么它抱怨这个问题只有在数据库中已经存在数据时才会出现。
我的两次迁移是
第一次迁移
public function up() {
Schema::create('users', function($table) {
$table->increments('id');
$table->string('username');
$table->string('email');
$table->string('password');
});
}
第二次迁移
public function up() {
Schema::table('users', function(Blueprint $table) {
$table->date('birthday')->after('id');
$table->string('last_name')->after('id');
$table->string('first_name')->after('id');
});
}
错误
Exception: SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL (SQL: alter table "users" add column "birthday" date not null)
【问题讨论】: