Laravel - 在迁移时为 unsignedInteger 获取“1067 无效默认值”

Laravel - Getting "1067 Invalid Default Value" for unsignedInteger on migration

我正在尝试 运行 在 Laravel 上进行迁移以创建新的 table,但出现此错误:

语法错误或访问冲突:1067 'tracked_product_id'

的默认值无效

我知道第一个 unsignedInteger 行有问题 - 我试图更改此默认值,但它 returns 在尝试迁移时出现相同的错误。

这是我要迁移的 up 函数:

public function up()
{
    Schema::create('tracked_product_notes', function (Blueprint $table) {
        $table->increments('id');
        $table->unsignedInteger('tracked_product_id', true)->default(0);
        $table->unsignedInteger('user_id', true)->default(0);
        $table->string('note')->nullable();
        $table->timestamp('deleted_at');
        $table->timestamps();
    });
}

如有任何帮助,我们将不胜感激!

将其更改为:

$table->unsignedInteger('tracked_product_id')->default(null); 

$table->unsignedInteger('tracked_product_id')->nullable();