<?php

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

class CreateWaybillPayoffsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('waybill_payoffs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();
            $table->bigInteger('waybill_id')->unique()->index()->comment('运单ID');
            $table->decimal('total_expense')->comment('应付运费');
            $table->decimal('total_receivable')->comment('应收运费');
            $table->decimal('gross_margin')->comment('毛利');
            $table->decimal('gross_profit_rate',10,8)->comment('毛利率');
        });
    }

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