<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateWaybillPriceModelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('waybill_price_models', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();
            $table->bigInteger('carrier_id')->index()->comment('承运商');
            $table->bigInteger('province_id')->index()->comment('省份');
            $table->bigInteger('city_id')->nullable()->index()->comment('城市');
            $table->bigInteger('unit_id')->index()->comment('货物单位');
            $table->decimal('range_min')->index()->nullable()->comment('区间最小值');
            $table->decimal('range_max')->index()->nullable()->comment('区间最大值');
            $table->decimal('unit_price')->comment('单价(元)');
            $table->decimal('base_fee')->default(0)->comment('起步费');
            $table->decimal('initial_weight')->default(0)->comment('始重');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('waybill_price_models');
    }
}
