| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- class ChangeStoragesTable extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::dropIfExists('storages');
- Schema::create('storages', function (Blueprint $table) {
- $table->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();
- });
- }
- }
|