<?php

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

class RemoveSemesterIdFromAnnualPlansTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('annual_plans', function(Blueprint $table)
		{
			$table->dropForeign('annual_plans_semester_id_foreign');
			$table->dropColumn(array('semester_id'));
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table('annual_plans', function(Blueprint $table)
		{
			$table->integer('semester_id')->unsigned();
			$table
				->foreign('semester_id')
				->references('id')
				->on('semesters')
				->onDelete('cascade')
				->onUpdate('cascade');
		});
	}

}
