<?php

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

class CreateInstallmentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('installments', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('branch_id')->nullable();
            $table->unsignedInteger('booking_id')->nullable();
            $table->unsignedInteger('user_id')->nullable();
            $table->string('description')->nullable();
            $table->double('actual_amount')->nullable();
            $table->double('amount')->nullable();
            $table->double('received_amount')->default(0);
            $table->string('type_of_installment')->nullable();
            $table->timestamp('due_date')->nullable();
            $table->enum('status', ['Paid','Unpaid'])->default('Unpaid');
            $table->enum('is_recycle', ['0','1','2'])->default('0');
               // ONLY FOR DATA IMPORT
            $table->string('voucher_no')->nullable();
            $table->string('narration')->nullable();
            $table->string('mode',25)->nullable();
            $table->string('drawn_on')->nullable();
            $table->string('instrument')->nullable();
            $table->timestamp('instrument_date')->nullable();
            // END 
            $table->timestamps();
        });
    }

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