<?php

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

class CreateSemestersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('semesters', function (Blueprint $table) {
            $table->char('code', 3)->primary();
            $table->string('alpha');
        });

        DB::table('semesters')->insert(
            array(
                array('code' => 'B31','alpha' => '2013-2014 SEM 1'),
                array('code' => 'B32','alpha' => '2013-2014 SEM 2'),
                array('code' => 'B33','alpha' => '2013-2014 VERANO'),
                array('code' => 'B41','alpha' => '2014-2015 SEM 1'),
                array('code' => 'B42','alpha' => '2014-2015 SEM 2'),
                array('code' => 'B43','alpha' => '2014-2015 VERANO'),
                array('code' => 'B51','alpha' => '2015-2016 SEM 1'),
                array('code' => 'B52','alpha' => '2015-2016 SEM 2'),
                array('code' => 'B53','alpha' => '2015-2016 VERANO'),
                array('code' => 'B61','alpha' => '2016-2017 SEM 1'),
                array('code' => 'B62','alpha' => '2016-2017 SEM 2'),
                array('code' => 'B63','alpha' => '2016-2017 VERANO'),
                array('code' => 'B71','alpha' => '2017-2018 SEM 1'),
                array('code' => 'B72','alpha' => '2017-2018 SEM 2'),
                array('code' => 'B73','alpha' => '2017-2018 VERANO'),
                array('code' => 'B81','alpha' => '2018-2019 SEM 1'),
                array('code' => 'B82','alpha' => '2018-2019 SEM 2'),
                array('code' => 'B83','alpha' => '2018-2019 VERANO'),
                array('code' => 'B91','alpha' => '2019-2020 SEM 1'),
                array('code' => 'B92','alpha' => '2019-2020 SEM 2'),
                array('code' => 'B93','alpha' => '2019-2020 VERANO'),
                array('code' => 'C01','alpha' => '2020-2021 SEM 1'),
                array('code' => 'C02','alpha' => '2020-2021 SEM 2'),
                array('code' => 'C03','alpha' => '2020-2021 VERANO')
              )
            );
    }

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