<?php

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

class CreateTransformativeActionStatus extends Migration
{

	public function up()
	{
		Schema::create('transformative_action_status', function (Blueprint $table) {
			$table->increments('id');
			$table->boolean('accomplished');
			$table->boolean('it_was_useful')->default(0);

			$table->integer('trans_id')->unsigned();
			$table->foreign('trans_id')
				->references('id')
				->on('transformative_actions')
				->onDelete('cascade')
				->onUpdate('cascade');

			$table->integer('supervised_coordinator_id')->unsigned();
			$table->foreign('supervised_coordinator_id')
				->references('id')
				->on('users')
				->onDelete('restrict')
				->onUpdate('restrict');
			$table->text('comments')->nullable();
		});
	}

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