2019_11_22_094311_create_billing_models_table.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateBillingModelsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('billing_models', function (Blueprint $table) {
  15. $table->bigIncrements('id');
  16. $table->timestamps();
  17. $table->bigInteger('carrier_id')->index()->comment('承运商');
  18. $table->bigInteger('province_id')->index()->comment('省份');
  19. $table->bigInteger('city_id')->index()->comment('城市');
  20. $table->bigInteger('unit_id')->index()->comment('货物单位');
  21. $table->decimal('range_min')->index()->nullable()->comment('区间最小值');
  22. $table->decimal('range_max')->index()->nullable()->comment('区间最大值');
  23. $table->decimal('unit_price')->comment('单价(元)');
  24. $table->decimal('base_fee')->default(0)->comment('起步费');
  25. $table->decimal('initial_weight')->default(0)->comment('始重');
  26. /* //外键
  27. $table->foreign('carrier_id')->references('id')->on('carrier'); //承运商
  28. $table->foreign('province_id')->references('id')->on('provinces'); //省份
  29. $table->foreign('city_id')->references('id')->on('citys'); //城市
  30. $table->foreign('unit_id')->references('id')->on('units'); //单位*/
  31. });
  32. }
  33. /**
  34. * Reverse the migrations.
  35. *
  36. * @return void
  37. */
  38. public function down()
  39. {
  40. Schema::dropIfExists('billing_models');
  41. }
  42. }