<?php

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

class CreateAnnualCycle extends Migration
{

	public function up()
	{
		Schema::create('annual_cycle', function (Blueprint $table) {

			$table->increments('id');
			$table->string('academic_year');
			$table->integer('semester_start')->unsigned();
			$table->integer('semester_end')->unsigned();
			$table->foreign('semester_start')
				->references('id')
				->on('semesters')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('user_id')->unsigned();
			$table->foreign('semester_end')
				->references('id')
				->on('semesters')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->timestamps();
		});
	}


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