<?php

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

class CreateFypPartOutcomesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('fyp_part_outcomes', function(Blueprint $table)
		{
			$table->engine = 'InnoDB';
			$table->increments('id');
			$table->integer('fyp_part_id')->unsigned();
			$table
				->foreign('fyp_part_id')
				->references('id')
				->on('fyp_parts')
				->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 of the five year plans'");
	}


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

}
