2020_08_07_144503_create_inventories_table.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateInventoriesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('inventories', function (Blueprint $table) {
  15. $table->bigIncrements('id');
  16. $table->integer('owner_id')->index();
  17. $table->enum('type',['全盘','动盘'])->comment('盘点类型');
  18. $table->timestamp('start_at')->nullable();
  19. $table->timestamp('end_at')->nullable();
  20. $table->integer('total')->nullable()->comment('记录数');
  21. $table->integer('processed')->default(0)->comment('已盘数');
  22. $table->integer('difference')->default(0)->comment('复盘差异');
  23. $table->integer('returned')->default(0)->comment('复盘归位');
  24. $table->timestamp('deleted_at')->index()->nullable();
  25. $table->timestamps();
  26. });
  27. }
  28. /**
  29. * Reverse the migrations.
  30. *
  31. * @return void
  32. */
  33. public function down()
  34. {
  35. Schema::dropIfExists('inventories');
  36. }
  37. }