<?php

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

class CreateCriteriaTable extends Migration
{

	public function up()
	{
		Schema::create('criteria', function (Blueprint $table) {
			$table->increments('id');
			$table->string('name', 400);
			$table->text('subcriteria')->nullable();
			$table->integer('user_id')->unsigned()->nullable();
			$table->text('copyright')->nullable();
			$table->text('notes')->nullable();
			$table->integer('num_scales');
			$table->integer('max_score');
			$table->timestamps();
			$table->timestamp('deleted_at')->nullable();

			$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
		});
	}


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