<?php

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

class CreateCriterionObjectiveOutcomeTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('criterion_objective_outcome', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('criterion_id')->unsigned();
			$table->integer('objective_id')->unsigned();
			$table->integer('outcome_id')->unsigned();
			$table
				->foreign('criterion_id')
				->references('id')
				->on('criteria')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table
				->foreign('objective_id')
				->references('id')
				->on('objectives')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table
				->foreign('outcome_id')
				->references('id')
				->on('outcomes')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->timestamps();
		});
	}

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

}
