语法错误或访问冲突:1075表定义不正确;只能有一个自动列,必须将其定义为键

问题描述 投票:0回答:1

我阅读了所有相关问题,但找不到我的迁移文件无效的原因。或许比我更有天赋的人会立即找到原因:

    public function up()
{
    Schema::create('orders_detail', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('orderID', 11)->nullable()->unsigned();
        $table->integer('userID', 11)->unsigned();
        $table->integer('roleID', 11)->unsigned();
        $table->integer('ownership', 11)->nullable()->unsigned();
        $table->integer('ownerID', 11)->nullable()->unsigned();
        $table->integer('ownerroleID', 11)->nullable()->unsigned();
        $table->integer('customerID', 11)->nullable()->unsigned();
        $table->integer('statusorderID', 11)->unsigned();
        $table->integer('statuslaboID', 11)->unsigned();
        $table->date('delivery_date');
        $table->integer('producttypeID', 11)->unsigned();
        $table->integer('productname', 11);
        $table->string('laboratory', 100);
        $table->integer('dessertservingID', 11)->nullable()->unsigned();
        $table->integer('dessertsizeID', 11)->nullable()->unsigned();
        $table->string('desserttextmessage', 200)->nullable();
        $table->string('dessertdecorchocolateID', 200)->nullable();
        $table->string('dessertdecorflowerID', 200)->nullable();
        $table->integer('partyloaftypeID')->nullable()->unsigned();
        $table->integer('partyloafportionID', 11)->nullable()->unsigned();
        $table->integer('partyloafweightID', 11)->nullable()->unsigned();
        $table->integer('partyloafsandwich1ID', 11)->nullable()->unsigned();
        $table->integer('partyloafsandwich2ID', 11)->nullable()->unsigned();
        $table->integer('partyloafsandwich3ID', 11)->nullable()->unsigned();
        $table->integer('partyloafsandwich4ID', 11)->nullable()->unsigned();
        $table->integer('partyloafribbonID', 11)->nullable()->unsigned();
        $table->double('productprice', 10, 2)->default('0.00');
        $table->double('productaddfee', 10, 2)->default('0.00');
        $table->double('subtotal', 10, 2)->default('0.00');
        $table->double('total', 10, 2)->default('0.00');
        $table->timestamps();
        $table->SoftDeletes();
    });
}

干杯,马克

migration laravel-5.6
1个回答
0
投票

可以解决它:

    public function up()
{
    Schema::create('orders_detail', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('orderID')->unsigned()->nullable();
        $table->integer('userID')->unsigned();
        $table->integer('roleID')->unsigned();
        $table->integer('ownership')->unsigned()->nullable();
        $table->integer('ownerID')->unsigned()->nullable();
        $table->integer('ownerroleID')->unsigned()->nullable();
        $table->integer('customerID')->unsigned()->nullable();
        $table->integer('statusorderID')->unsigned();
        $table->integer('statuslaboID')->unsigned();
        $table->date('delivery_date');
        $table->integer('producttypeID')->unsigned();
        $table->integer('productname');
        $table->string('laboratory', 100);
        $table->integer('dessertservingID')->unsigned()->nullable();
        $table->integer('dessertsizeID')->unsigned()->nullable();
        $table->string('desserttextmessage', 200)->nullable();
        $table->string('dessertdecorchocolateID', 200)->nullable();
        $table->string('dessertdecorflowerID', 200)->nullable();
        $table->integer('partyloaftypeID')->unsigned()->nullable();
        $table->integer('partyloafportionID')->unsigned()->nullable();
        $table->integer('partyloafweightID')->unsigned()->nullable();
        $table->integer('partyloafsandwich1ID')->unsigned()->nullable();
        $table->integer('partyloafsandwich2ID')->unsigned()->nullable();
        $table->integer('partyloafsandwich3ID')->unsigned()->nullable();
        $table->integer('partyloafsandwich4ID')->unsigned()->nullable();
        $table->integer('partyloafribbonID')->unsigned()->nullable();
        $table->double('productprice', 10, 2)->default('0.00');
        $table->double('productaddfee', 10, 2)->default('0.00');
        $table->double('subtotal', 10, 2)->default('0.00');
        $table->double('total', 10, 2)->default('0.00');
        $table->timestamps();
        $table->SoftDeletes();
    });
}
© www.soinside.com 2019 - 2024. All rights reserved.