<?php

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

class CreateRubricScales extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create("rubric_criteria_scale", function (Blueprint $table) {
			$table->increments('id');
			$table->integer('rubric_criterion_id')->unsigned();
			$table->integer('scale_id')->unsigned();
			$table->foreign('scale_id')
				->references('id')
				->on('scales')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->foreign('rubric_criterion_id')
				->references('id')
				->on('rubric_criterion')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('position');
		});
	}

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