<?php

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

class CreateObjectiveProgramTable extends Migration
{

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


			$table
				->foreign('objective_id')
				->references('id')
				->on('objectives')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table
				->foreign('program_id')
				->references('id')
				->on('programs')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->timestamps();
		});
	}

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