语法错误或访问冲突:1075 table 定义不正确;只能有一个自动列,并且必须将其定义为键
Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key
我阅读了所有相关问题,但找不到我的迁移文件无法运行的原因。也许比我更有天赋的人会立即找到原因:
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();
});
}
干杯,马克
可以解决它:
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();
});
}
如果您想指定整数列的长度,请按以下方式进行
$table->bigInteger('orderID'')->length(11);
我阅读了所有相关问题,但找不到我的迁移文件无法运行的原因。也许比我更有天赋的人会立即找到原因:
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();
});
}
干杯,马克
可以解决它:
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();
});
}
如果您想指定整数列的长度,请按以下方式进行
$table->bigInteger('orderID'')->length(11);