<?php

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

class CreateProgramCriterion2 extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('program_criterion', function (Blueprint $table) {
			$table->increments('id');
			$table->timestamps();
			$table->integer('program_id')->nullable()->unsigned();
			$table->foreign('program_id')
				->references('id')
				->on('programs')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->integer('criterion_id')->unsigned();
			$table
				->foreign('criterion_id')
				->references('id')
				->on('criteria')
				->onDelete('cascade')
				->onUpdate('cascade');
		});
	}

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