<?php

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

class CreateTypSemesterTable extends Migration
{

	public function up()
	{
		Schema::create('typ_semesters', function (Blueprint $table) {
			// id unico
			$table->increments('id')->unsigned();
			// id del ciclo que pertenece
			$table->integer('typ_id')->unsigned();
			// semestre n
			$table->integer('semester_id')->unsigned();
			$table
				->foreign('typ_id')
				->references('id')
				->on('three_year_plan')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table
				->foreign('semester_id')
				->references('id')
				->on('semesters')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->timestamps();
		});
	}

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