2019_08_05_162649_create_orders_table.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateOrdersTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('orders', function (Blueprint $table) {
  15. $table->bigIncrements('id');
  16. $table->string('order_no', 30)->comment('订单号');
  17. $table->bigInteger('user_id')->default(0)->comment('用户id');
  18. $table->bigInteger('bike_id')->default(0)->comment('车id');
  19. $table->bigInteger('area_id')->default(0)->comment('区域id');
  20. $table->timestamp('start_use_bike_time')->nullable()->comment('开始时间');
  21. $table->timestamp('end_use_bike_time')->nullable()->comment('结束时间');
  22. $table->integer('use_bike_time_length')->default(0)->comment('骑行时间(分)');
  23. $table->integer('pause_bike_time_length')->default(0)->comment('暂停时间(分)');
  24. $table->integer('use_bike_distance_length')->default(0)->comment('骑行距离(千米)');
  25. $table->decimal('time_money', 7, 2)->default(0.00)->comment('时长费用');
  26. $table->decimal('distance_money', 7, 2)->default(0.00)->comment('里程费用');
  27. $table->decimal('pause_money', 7, 2)->default(0.00)->comment('停车费');
  28. $table->decimal('dispatch_money', 7, 2)->default(0.00)->comment('调度费');
  29. $table->decimal('preferential_money', 7, 2)->default(0.00)->comment('优惠金额');
  30. $table->decimal('total_money', 7, 2)->default(0.00)->comment('总价格');
  31. $table->tinyInteger('pay_status')->default(0)->comment('支付状态');
  32. $table->decimal('pay_money', 7, 2)->default(0.00)->comment('支付金额');
  33. $table->tinyInteger('pay_type')->default(0)->comment('支付方式(0:未支付;1已支付)');
  34. $table->tinyInteger('status')->default(1);
  35. $table->timestamps();
  36. });
  37. }
  38. /**
  39. * Reverse the migrations.
  40. *
  41. * @return void
  42. */
  43. public function down()
  44. {
  45. Schema::dropIfExists('orders');
  46. }
  47. }