<?php

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

class CreateAnnualPlanOutcomesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('annual_plan_outcomes', function(Blueprint $table)
		{
			$table->engine = 'InnoDB';
			$table->increments('id');
			$table->integer('annual_plan_id')->unsigned();
			$table
				->foreign('annual_plan_id')
				->references('id')
				->on('annual_plans')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('outcome_id')->unsigned();
			$table
				->foreign('outcome_id')
				->references('id')
				->on('outcomes')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->text('objectives')->nullable();
			$table->text('courses')->nullable();
			$table->text('methods')->nullable();
			$table->tinyInteger('display_order');
			$table->timestamps();
		});

		DB::statement("ALTER TABLE `fyp_part_outcomes` comment 'Outcomes for the annual plans'");
	}


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

}
