<?php

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

class CreateJournalsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('journals', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('transaction_id')->nullable();
            $table->unsignedInteger('branch_id')->nullable();
            $table->unsignedInteger('booking_id')->nullable();
            $table->unsignedInteger('payment_id')->nullable();
            $table->unsignedInteger('user_id')->nullable();
            $table->unsignedInteger('role_id')->nullable();
            $table->unsignedInteger('loan_id')->nullable();
            $table->unsignedInteger('payroll_id')->nullable();
            $table->integer('post_dated')->default('0');
            $table->unsignedInteger('account_id')->nullable();
            $table->double('debit')->nullable();
            $table->double('credit')->nullable();
            $table->string('narration')->nullable();
            $table->string('mode', 25)->nullable();
            $table->string('drawn_on')->nullable();
            $table->string('instrument')->nullable();
            $table->timestamp('instrument_date')->nullable();
            $table->string('deposit_no')->nullable();
            $table->timestamp('deposit_date')->nullable();


            $table->enum('is_recycle', ['0', '1', '2'])->default('0');
            $table->enum('auto_jv', ['0', '1', '2'])->default('0');

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

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