<?php

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

class CreateAnnualPlanTransformativeTable extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('annual_plan_transformative', function (Blueprint $table) {
			$table->increments('id');
			$table->integer('annual_plan_id')->unsigned();
			$table->integer('trans_id')->unsigned();
			$table->foreign('trans_id')
				->references('id')
				->on('transformative_actions')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->foreign('annual_plan_id')
				->references('id')
				->on('annual_plans')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('typ_semester_course_id')->unsigned();
			$table->foreign('typ_semester_course_id')
				->references('id')
				->on('typ_semester_courses')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('proposing_coordinator_id')->unsigned();
			$table->foreign('proposing_coordinator_id')
				->references('id')
				->on('users')
				->onDelete('restrict')
				->onUpdate('restrict');
			$table->dateTime('proposed_date');
		});
	}

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