2021_02_03_145200_create_procurements_table.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateProcurementsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('procurements', function (Blueprint $table) {
  15. $table->id();
  16. $table->string('code')->index()->comment('采购编号');
  17. $table->tinyInteger('type')->index()->default(0)->comment('采购类型');
  18. $table->bigInteger('owner_material_id')->index()->comment('外键项目耗材');
  19. $table->bigInteger('supplier_id')->index()->nullable()->comment('外键供应商');
  20. $table->decimal('quantity')->comment('采购数量');
  21. $table->decimal('amount')->comment('销售数量');
  22. $table->decimal('unit_price')->nullable()->comment('销售单价');
  23. $table->decimal('cost_price')->nullable()->comment('成本单价(采购)');
  24. $table->tinyInteger('status')->default(0)->comment('状态');//待报价 已报价 待接单 生产中 送货中 已完成 已取消
  25. $table->enum('is_enquiry',['是','否'])->default('否')->comment('是否询价');
  26. $table->bigInteger('initiator')->index()->comment('外键用户(发起者)');
  27. $table->timestamps();
  28. });
  29. }
  30. /**
  31. * Reverse the migrations.
  32. *
  33. * @return void
  34. */
  35. public function down()
  36. {
  37. Schema::dropIfExists('procurements');
  38. }
  39. }