<?php

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

class CreateProcurementDeliveriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('procurement_deliveries', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('procurement_id')->index()->comment('外键采购单');
            $table->decimal('amount')->comment('送货数量');
            $table->bigInteger('initiator')->index()->comment('发起人');
            $table->bigInteger('signer')->index()->comment('签收人');
            $table->tinyInteger('status')->default(0)->comment('状态');
            $table->date('signed_at')->comment('签收时间');
            $table->timestamps();
        });
    }

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