sqlite – 使用sqllite的Laravel迁移’无法添加一个NOT NULL列,
为什么在使用SQLLITE驱动程序时收到此警告?我没有
MySQL驱动程序的问题,但是SQLLITE抛出了这个错误.
这对我来说没有意义,因为我理解种子在所有的迁移完成后发生,所以为什么它抱怨这个问题,只有数据已经??存在于数据库中才会出现. 我的两个迁移是 第一次移民 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)看起来这是一个SQLite的奇怪.根据 Laracast forum thread about the same issue:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |