<?php

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

class CreateTypPartOutcomesTable extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('typ_part_outcomes', function (Blueprint $table) {

			$table->increments('id')->unsigned();
			$table->integer('typ_part_id')->unsigned();
			$table
				->foreign('typ_part_id')
				->references('id')
				->on('typ_parts')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('outcome_id')->unsigned();
			$table
				->foreign('outcome_id')
				->references('id')
				->on('outcomes')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('objective_id')->unsigned()->nullable();
			$table
				->foreign('objective_id')
				->references('id')
				->on('objectives')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('course_id')->unsigned()->nullable();
			$table
				->foreign('course_id')
				->references('id')
				->on('courses')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->tinyInteger('display_order');
			$table->timestamps();
		});

		// DB::statement("ALTER TABLE typ_part_outcomes comment 'Outcomes for the annual plans of the three year plans'");
	}

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