<?php

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

class CreateNewCriterionRubricTable extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('rubric_criterion', function (Blueprint $table) {
			$table->increments('id');
			$table->integer('criterion_id')->unsigned();
			$table->integer('rubric_id')->unsigned();
			$table->timestamps();

			$table
				->foreign('criterion_id')
				->references('id')
				->on('criteria')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table
				->foreign('rubric_id')
				->references('id')
				->on('rubrics')
				->onDelete('cascade')
				->onUpdate('cascade');
		});
	}


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