<?php

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

class CreateThreadsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('threads', function (Blueprint $table) {
            $table->id();
            $table->uuid('uuid')->index('uuid');
            $table->dateTime('created_at');
            $table->uuid('created_uuid')->index('created_uuid');
            $table->dateTime('updated_at');
            $table->uuid('updated_uuid')->index('updated_uuid');
            $table->uuid('forum_uuid')->index('forum_uuid');
            $table->string('title', 255);
            $table->string('slug', 255)->index('slug');
            $table->integer('views')->default(0);
            $table->integer('posts')->default(1);
        });
    }

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