<?php

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

class CreateDepartmentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('departments', function(Blueprint $table){
            $table->increments('id');
            $table->string('department_name', 150);
            $table->string('department_code', 20)->nullable();
            $table->date('start_date')->nullable();
            $table->unsignedInteger('country')->nullable();
            $table->unsignedInteger('county')->nullable();
            $table->unsignedInteger('city')->nullable();
            $table->text('address_1'); #Mandatory
            $table->text('address_2')->nullable();
            $table->text('address_3')->nullable();
            $table->unsignedInteger('department_head')->nullable();
            $table->integer('business_unit')->nullable();
            $table->unsignedInteger('created_by')->nullable();
            $table->unsignedInteger('modified_by')->nullable();
            $table->integer('is_active')->default(1);
            $table->timestamps();
        });
    }

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