<?php

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

class CreateAccountsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('accounts', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('head_id')->nullable();
            $table->unsignedInteger('branch_id')->nullable();
            $table->unsignedInteger('bank_id')->nullable();
            $table->unsignedInteger('user_id')->nullable();
            $table->unsignedInteger('scale_id')->nullable();
            $table->unsignedInteger('designation_id')->nullable();
             $table->unsignedInteger('bill_subcategory_id')->nullable();
             $table->unsignedInteger('opening_balance_id')->nullable();
             
            $table->string('code')->nullable();
            $table->string('name')->nullable();
            $table->double('opening_balance')->nullable();

            $table->string('type',25)->nullable();
            $table->enum('is_recycle', ['0','1','2'])->default('0');
            $table->enum('flag', ['0','1'])->default('0');
            $table->timestamps();
        });
    }

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