<?php

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

class CreateActivitiesTable extends Migration
{

	public function up()
	{
		Schema::create('activities', function (Blueprint $table) {
			$table->increments('id');
			$table->string('name');
			$table->string('description');
			$table->integer('course_id')->unsigned()->nullable();

			$table->timestamps();
			//$table->text('criteria_achieved')->nullable();
			//$table->text('criteria_weights')->nullable();
			//$table->text('outcomes_achieved')->nullable();
			//$table->text('outcomes_attempted')->nullable();

			$table->text('assessment_comments')->nullable();
			//$table->text('transforming_actions')->nullable();
			//$table->text('criteria_achieved_percentage')->nullable();

			$table->date('date');
			$table->boolean('draft')->default(0);
			//$table->text('criteria_participant_count')->nullable();
			//$table->text('criteria_achiever_count')->nullable();

			DB::statement('SET FOREIGN_KEY_CHECKS=1;');
		});

		Schema::table('activities', function (Blueprint $table) {
			$table->foreign('course_id')->references('id')->on('courses')->onDelete('cascade')->onUpdate('cascade');
		});
	}

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