<?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->bigIncrements('id');
            $table->string('name')->nullable();
            $table->string('title')->nullable();
            $table->unsignedBigInteger('faculty_id');

            $table->foreign('faculty_id')->references('id')->on('faculties');
        });

        // DB::table('departments')->insert(
        //     array(
        //         array('id' => '1','name' => 'BIOL', 'title' => 'Biolo'),
        //         array('id' => '4','name' => 'CIAM', 'title' => ),
        //         array('id' => '2','name' => 'FISI', 'title' => ),
        //         array('id' => '3','name' => 'MATE', 'title' => ),
        //         array('id' => '5','name' => 'PGCN', 'title' => ),
        //         array('id' => '6','name' => 'QUIM', 'title' => ),
        //         array('id' => '7','name' => 'default'),
        //     ));
    }

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