<?php

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

class CreateRubricsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('rubrics', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('name');
			$table->text('contents');
			$table->integer('expected_percentage');
			$table->integer('expected_points');
			$table->integer('user_id')->unsigned();
			$table->timestamps();
		});

		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');
	}

}
