<?php

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

class CreateBusinessUnitsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('business_units', function(Blueprint $table){
            $table->increments('id');
            $table->string('business_unit', 255);
            $table->string('business_unit_code', 50)->nullable();
            $table->text('description')->nullable();
            $table->date('start_date')->nullable();
            $table->unsignedInteger('country')->nullable();
            $table->unsignedInteger('county')->nullable();
            $table->unsignedInteger('city')->nullable();
            $table->text('address_1')->nullable();
            $table->text('address_2')->nullable();
            $table->text('address_3')->nullable();
            $table->unsignedInteger('business_unit_head')->nullable();
            $table->unsignedTinyInteger('service_desk_flags')->comment('1 = Buwise, 0 = Deptwise')->default(1)->nullable();
            $table->integer('created_by')->nullable();
            $table->integer('modified_by')->nullable();
            $table->tinyInteger('is_active')->default(1);
            $table->timestamps();
        });
    }

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