<?php

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

class CreateTimeTrackingTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('time_tracking', function(Blueprint $table)
		{
			$table->increments('id');
			$table->unsignedBigInteger('user_id');
			$table->unsignedBigInteger('task_id')->index();
			$table->timestamp('started_at')->index();
			$table->timestamp('ended_at')->nullable()->index();
			$table->timestamps();
		});
	}

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

}
