2024_11_14_061044_create_order_table.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('order', function (Blueprint $table) {
  15. $table->comment('订单');
  16. $table->increments('id');
  17. $table->unsignedBigInteger('user_id')->comment('用户编号');
  18. $table->unsignedBigInteger('coach_id')->comment('技师编号');
  19. $table->unsignedBigInteger('service_id')->comment('项目编号');
  20. $table->unsignedBigInteger('channel_id')->nullable()->comment('渠道编号');
  21. $table->unsignedBigInteger('shop_id')->nullable()->comment('店铺编号');
  22. $table->unsignedBigInteger('customer_service_id')->nullable()->comment('跟单客服编号');
  23. $table->string('order_type')->default('')->comment('订单类型');
  24. $table->string('order_source')->default('PLATFORM')->comment('订单来源');
  25. $table->decimal('total_amount')->default(new \Illuminate\Database\Query\Expression('0.00'))->comment('订单金额');
  26. $table->decimal('service_amount')->default(new \Illuminate\Database\Query\Expression('0.00'))->comment('项目金额');
  27. $table->decimal('traffic_amount')->default(new \Illuminate\Database\Query\Expression('0.00'))->comment('路程金额');
  28. $table->json('service_snapshot')->nullable()->comment('项目快照');
  29. $table->timestamp('service_time')->comment('服务时间');
  30. $table->integer('distance')->default(new \Illuminate\Database\Query\Expression('0'))->nullable()->comment('目的地距离(米)');
  31. $table->decimal('latitude')->comment('目的地纬度');
  32. $table->decimal('longitude')->comment('目的地经度');
  33. $table->string('location')->default('')->comment('目的地定位地址');
  34. $table->string('address')->nullable()->comment('目的地详细地址');
  35. $table->string('area_code')->default('')->comment('目的地行政区划代码');
  36. $table->string('remark')->nullable()->comment('订单备注');
  37. $table->string('state')->default('CREATED')->comment('订单状态');
  38. $table->timestamps();
  39. $table->softDeletes();
  40. });
  41. }
  42. /**
  43. * Reverse the migrations.
  44. *
  45. * @return void
  46. */
  47. public function down()
  48. {
  49. Schema::dropIfExists('order');
  50. }
  51. };