<?php

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

class CreateDischargeTasksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('discharge_tasks', function (Blueprint $table) {

            $table->bigIncrements('id');
            $table->bigInteger('owner_id')->comment('货主id');
            $table->bigInteger('facilitator_id')->default(null)->comment('服务商');

            $table->tinyInteger('type')->comment('作业名称');
            $table->string('numbers')->comment('入库单号');
            $table->tinyInteger('status')->comment('状态');

            $table->integer('income_amount')->comment('收入数量');
            $table->tinyInteger('income_unit')->comment('收入单位');
            $table->decimal('income_unit_price')->comment('收入单价');
            $table->decimal('income_total_cost')->comment('收入合计');
            $table->string('income_remark')->comment('收入描述');
            $table->timestamp('income_at')->comment('任务创建时间');

            $table->integer('expenditure_amount')->comment('支出数量');
            $table->tinyInteger('expenditure_unit')->comment('支出单位');
            $table->decimal('expenditure_unit_price')->comment('支出单价');
            $table->decimal('expenditure_total_cost')->comment('支出合计');
            $table->string('expenditure_remark')->comment('支出描述');
            $table->timestamp('expenditure_at')->comment('任务接受时间');

            $table->timestamps();
        });
    }

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