<?php

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

class CreateTypPartsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('typ_parts', function(Blueprint $table)
		{
			$table->increments('id')->unsigned();
			$table->integer('three_year_plan_id')->unsigned();
			$table
				->foreign('three_year_plan_id')
				->references('id')
				->on('three_year_plans')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('semester_id')->unsigned();
			$table
					->foreign('semester_id')
					->references('id')
					->on('semesters')
					->onDelete('cascade')
					->onUpdate('cascade');
			$table->timestamps();
		});

		// DB::statement("ALTER TABLE `typ_parts` comment 'Annual plans that are part of a three-year plan'");
	}

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

}
