Laravel - 在迁移时为无符号整数获取“1067 无效默认值”

问题描述

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

语法错误或访问冲突:1067 'tracked_product_id' 的认值无效

我知道第一行 unsignedInteger 存在问题 - 我曾尝试更改此认值,但在尝试迁移时返回相同的错误

这是我尝试迁移的 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();
    });
}

任何帮助将不胜感激!

解决方法

改为:

If e.Control = True And e.KeyCode = Keys.B Then
            'Do Something...
        End If

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = torch.load('./checkpoints/fcn_model_5.pth')  # 加载模型
model = model.to(device)