2021_06_02_114506_change_storages_table.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class ChangeStoragesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::dropIfExists('storages');
  15. Schema::create('storages', function (Blueprint $table) {
  16. $table->id();
  17. $table->bigInteger("station_id")->index()->nullable()->comment("外键库位");
  18. $table->bigInteger("material_box_id")->nullable()->index()->comment("外键料箱");
  19. $table->bigInteger("commodity_id")->nullable()->index()->comment("外键商品");
  20. $table->integer("amount")->default(0)->comment("数量");
  21. $table->tinyInteger("status")->default(0)->comment("状态");
  22. $table->timestamps();
  23. $table->unique(["station_id","material_box_id","commodity_id"]);
  24. });
  25. }
  26. /**
  27. * Reverse the migrations.
  28. *
  29. * @return void
  30. */
  31. public function down()
  32. {
  33. Schema::dropIfExists('storages');
  34. Schema::create('storages', function (Blueprint $table) {
  35. $table->id();
  36. $table->bigInteger("material_box_id")->index()->comment("外键料箱");
  37. $table->bigInteger("commodity_id")->nullable()->index()->comment("外键商品");
  38. $table->integer("amount")->default(0)->comment("数量");
  39. $table->timestamps();
  40. });
  41. }
  42. }