Zhouzhendong 4 лет назад
Родитель
Сommit
b71f5fd91a
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      database/migrations/2021_06_02_114506_change_storages_table.php

+ 2 - 1
database/migrations/2021_06_02_114506_change_storages_table.php

@@ -16,12 +16,13 @@ class ChangeStoragesTable extends Migration
         Schema::dropIfExists('storages');
         Schema::create('storages', function (Blueprint $table) {
             $table->id();
-            $table->bigInteger("station_id")->index()->comment("外键库位");
+            $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"]);
         });
     }