<?php

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

class CreateCyclesSemestersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('cycles_semesters', function(Blueprint $table)
		{
			// id unico
			$table->increments('id')->unsigned();
			// id del ciclo que pertenece
			$table->integer('cycle_id')->unsigned();
			// semestre n
			$table->integer('semester_id')->unsigned();
			$table
				->foreign('cycle_id')
				->references('id')
				->on('cycles')
				->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('cycles_semesters');
	}

}
