<?php

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

class CreateTodosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('todos', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->softDeletes();

            $table->string('title');
            $table->dateTime('deadline')->nullable();
            $table->dateTime('start_time')->nullable();
            $table->integer('estimated_duration');
            $table->string('location')->nullable();
            $table->tinyInteger('status');
            $table->tinyInteger('difficulty');
            $table->integer('priority');


            $table->integer('task_id')->unsigned();
            $table->foreign('task_id')->references('id')->on('tasks');

            $table->integer('outcome_id')->unsigned();
            $table->foreign('outcome_id')->references('id')->on('outcomes');
        });
    }

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