<?php

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

class CreateFiveYearPlansTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('five_year_plans', function(Blueprint $table)
		{
			$table->engine = 'InnoDB';
			$table->increments('id');
			$table->integer('quinquennium_id')->unsigned();
			$table
				->foreign('quinquennium_id')
				->references('id')
				->on('quinquenniums')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('program_id')->unsigned();
			$table
				->foreign('program_id')
				->references('id')
				->on('programs')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->boolean('is_submitted')->default(0);
			$table->dateTime('submitted_on')->nullable();
			$table->timestamps();
		});
	}


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

}
