id(); $table->bigInteger("station_id")->index()->nullable()->comment("外键库位"); $table->bigInteger("material_box_id")->nullable()->index()->comment("外键料箱"); $table->bigInteger("commodity_id")->nullable()->index()->comment("外键商品"); $table->integer("amount")->default(0)->comment("数量"); $table->tinyInteger("status")->default(0)->comment("状态"); $table->timestamps(); $table->unique(["station_id","material_box_id","commodity_id"]); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('storages'); Schema::create('storages', function (Blueprint $table) { $table->id(); $table->bigInteger("material_box_id")->index()->comment("外键料箱"); $table->bigInteger("commodity_id")->nullable()->index()->comment("外键商品"); $table->integer("amount")->default(0)->comment("数量"); $table->timestamps(); }); } }