2021_03_01_150232_create_delivery_appointments_table.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateDeliveryAppointmentsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('delivery_appointments', function (Blueprint $table) {
  15. $table->id();
  16. $table->bigInteger("user_id")->nullable()->comment("操作用户");
  17. $table->bigInteger("owner_id")->index()->comment("外键货主");
  18. $table->string("procurement_number")->nullable()->comment("采购单号");
  19. $table->string("asn_number")->index()->nullable()->comment("ASN单号");
  20. $table->bigInteger("warehouse_id")->index()->comment("外键仓库");
  21. $table->decimal("tonne",8,2)->nullable()->comment("吨");
  22. $table->decimal("cubic_meter",8,2)->nullable()->comment("立方米");
  23. $table->integer("box_amount")->nullable()->comment("箱数");
  24. $table->decimal("capacity",10,2)->default(0)->comment("产能");
  25. $table->date("appointment_date")->index()->comment("预约时间");
  26. $table->tinyInteger("date_period")->default(0)->comment("时间段");
  27. $table->tinyInteger("status")->default(0)->comment("状态");
  28. $table->timestamps();
  29. });
  30. Schema::create('delivery_appointment_cars', function (Blueprint $table) {
  31. $table->id();
  32. $table->bigInteger("delivery_appointment_id")->index()->comment("外键预约");
  33. $table->string("license_plate_number")->nullable()->comment("车牌号");
  34. $table->string("car_id")->index()->nullable()->comment("外键车型");
  35. $table->string("driver_name",20)->nullable()->comment("驾驶员姓名");
  36. $table->string("driver_phone",30)->nullable()->comment("驾驶员电话");
  37. $table->string("appointment_number")->comment("预约号码");
  38. $table->tinyInteger("status")->default(0)->comment("状态");
  39. });
  40. Schema::create('delivery_appointment_details', function (Blueprint $table) {
  41. $table->id();
  42. $table->bigInteger("delivery_appointment_id")->index()->comment("外键预约");
  43. $table->bigInteger("commodity_id")->index()->nullable()->comment("外键商品");
  44. $table->string("bar_code")->nullable()->comment("条码");
  45. $table->string("name")->nullable()->comment("名称");
  46. $table->integer("amount")->comment("数量");
  47. });
  48. }
  49. /**
  50. * Reverse the migrations.
  51. *
  52. * @return void
  53. */
  54. public function down()
  55. {
  56. Schema::dropIfExists('delivery_appointments');
  57. Schema::dropIfExists('delivery_appointment_cars');
  58. Schema::dropIfExists('delivery_appointment_details');
  59. }
  60. }