<?php

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

class CreateActivityCriterionTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('activity_criterion', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('activity_id')->unsigned();
			$table->integer('criterion_id')->unsigned();
			$table
				->foreign('activity_id')
				->references('id')
				->on('activities')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table
				->foreign('criterion_id')
				->references('id')
				->on('criteria')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->text('transformative_actions')->nullable();
			$table->integer('expected_student_score')->nullable();
			$table->decimal('expected_percentage_students_achieving', 5, 2)->nullable();
			$table->decimal('percentage_students_who_achieved', 5, 2)->nullable();
			$table->decimal('weight', 3, 2)->default(1.0);
			$table->timestamps();
		});
	
	}

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

}
