<?php

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

class AddMappingColumnsToOutcomesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('outcomes', function(Blueprint $table)
		{
			$table->integer('new_outcome_id')->unsigned()->nullable();
			$table->date('deactivation_date')->nullable();

			$table->foreign('new_outcome_id')->references('id')->on('outcomes');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table('outcomes', function(Blueprint $table)
		{
			$table->dropForeign(['new_outcome_id']);

			$table->dropColumn('deactivation_date');
			$table->dropColumn('new_outcome_id');
		});
	}

}
