<?php

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

class CreateThreeYearPlansTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
			Schema::create('three_year_plans', function(Blueprint $table)
			{
					$table->increments('id')->unsigned();
					$table->integer('cycle_id')->unsigned();
					$table
							->foreign('cycle_id')
							->references('id')
							->on('cycles')
							->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('three_year_plans');
	}

}
