<?php

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

class TypSemesterCourses extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('typ_semester_courses', function (Blueprint $table) {
			$table->increments('id');
			$table->timestamps();
			$table->integer('typ_semester_objective_id')->unsigned();
			$table->integer('course_id')->unsigned();


			$table->foreign('typ_semester_objective_id')
				->references('id')
				->on('typ_semester_objectives')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->foreign('course_id')
				->references('id')
				->on('courses')
				->onDelete('cascade')
				->onUpdate('cascade');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table('typ_semester_courses', function (Blueprint $table) {
			$table->dropForeign("typ_semester_courses_course_id_foreign");
			$table->dropForeign("typ_semester_courses_typ_semester_outcome_id_foreign");
		});
		Schema::drop('typ_semester_courses');
	}
}
