<?php

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

class CreatePurchaseOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('purchase_orders', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('bill_of_quantity_id')->nullable();
            $table->unsignedInteger('branch_id')->nullable();
            $table->unsignedInteger('au_id')->nullable();
            $table->unsignedInteger('b_o_q_item_id')->nullable();
            $table->unsignedInteger('user_id')->nullable();
            $table->double('unit_price')->nullable();
            $table->string('p_number')->nullable();
            $table->string('remarks')->nullable();
            $table->string('brand')->nullable();
            $table->string('delivery_date')->nullable();
            $table->unsignedInteger('action_by')->nullable();
            $table->enum('status', ['Approved','Pending','Rejected','Completed'])->default('Pending');
            $table->string('quotation')->nullable();
            $table->enum('is_recycle', ['0','1','2'])->default('0');
            $table->timestamps();
        });
    }

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