<?php

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

class CreateRubricsTable extends Migration
{

	public function up()
	{
		Schema::create('rubrics', function (Blueprint $table) {
			$table->increments('id');
			$table->string('name');

			$table->integer('expected_percentage');
			$table->integer('expected_points');
			$table->integer('user_id')->unsigned();
			$table->timestamps();
			$table->integer('num_scales')->unsigned();
			$table->integer('max_score')->unsigned();
		});

		Schema::table('rubrics', function (Blueprint $table) {
			$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
		});
	}


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