<?php

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

class CreateRequisitionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('requisitions', function (Blueprint $table) {
            $table->id();
            $table->string('branch', 10)->nullable();
            $table->string('req_type', 100)->nullable();
            $table->string('ledger_id', 10)->nullable();
            $table->string('dr_id', 10)->nullable();
            $table->string('payee', 255)->nullable();
            $table->double('amount')->nullable();
            $table->date('req_date')->nullable();
            $table->longText('nar')->nullable();
            $table->string('currency', 10)->nullable();
            $table->string('conversion_rate', 100)->nullable();
            $table->boolean('first_approved')->default(0);
            $table->string('first_approved_by', 10)->nullable();
            $table->date('first_approved_at')->nullable();
            $table->boolean('second_approved')->default(0);
            $table->string('second_approved_by', 10)->nullable();
            $table->date('second_approved_at')->nullable();
            $table->string('reversal_reason', 255)->nullable();
            $table->string('reversed_by', 10)->nullable();
            $table->date('reversed_at')->nullable();
            $table->string('req_status', 50)->nullable();
            $table->string('created_by', 10)->nullable();
            $table->string('deleted_by', 10)->nullable();
            $table->softDeletes();
            $table->timestamps();
        });
    }

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