<?php

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

class CreateForumsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('forums', function (Blueprint $table) {
            $table->id();
            $table->uuid('uuid')->index('uuid');
            $table->uuid('category_uuid')->index('category_uuid');
            $table->dateTime('created_at');
            $table->uuid('created_uuid')->index('created_uuid');
            $table->dateTime('updated_at');
            $table->uuid('updated_uuid')->index('updated_uuid');
            $table->string('title', 255);
            $table->string('description', 255)->nullable();
            $table->string('slug', 255)->index('slug');
            $table->integer('thread_count')->default(0);
            $table->integer('posting_count')->default(0);
        });
    }

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