【发布时间】:2020-06-17 08:28:52
【问题描述】:
我正在尝试向现有表添加外键:
public function up()
{
Schema::table('employee', function (Blueprint $table) {
$table->uuid("agency_id");
}
}
SQLite 抛出错误:
一般错误:1 无法添加默认值为 NULL 的 NOT NULL 列(SQL:alter table "employees" add column "agency_id" varchar not null)
我无法添加空字符串的默认值,因为类型是 UUID。我能做些什么?
【问题讨论】:
-
如果你让它不为空,你应该有某种值可以插入,否则让它可以为空。