<?php

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

class CreateAnnualReportTransformativeTable extends Migration
{

	public function up()
	{
		Schema::create('annual_report_transformative', function (Blueprint $table) {
			$table->increments('id');
			$table->boolean('accomplished');
			$table->integer('cycle_of_life');
			$table->integer("semester_used")->unsigned();
			$table->integer('semester_continue')->unsigned()->nullable();
			$table->integer('annual_trans_id')->unsigned();
			$table->foreign('annual_trans_id')
				->references('id')
				->on('annual_plan_transformative')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->foreign('semester_used')
				->references('id')
				->on('semesters')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->foreign('semester_continue')
				->references('id')
				->on('semesters')
				->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('annual_report_transformative');
	}
}
