<?php

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

class CreateStatusChangesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('status_changes', function(Blueprint $table)
		{
			$table->increments('id');
			$table->unsignedBigInteger('related_id')->index();
			$table->enum('related_type', array('task', 'project'))->default('task')->index();
			$table->unsignedBigInteger('old_status');
			$table->unsignedBigInteger('new_status');
			$table->unsignedBigInteger('changed_by');
			$table->timestamps();
		});
	}

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

}
