<?php

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

class CreateTopicsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('topics', function (Blueprint $table) {
            $table->id();
            $table->string('code');
            $table->string('title');
            $table->text('content')->nullable();
            $table->string('thumbnail')->nullable();
            $table->string('author')->nullable();
            $table->integer('rank_id')->nullable();
            $table->integer('category_id')->nullable();
            $table->integer('url_id')->nullable();
            $table->smallInteger('is_anonymous')->default(1);
            $table->smallInteger('is_show_id')->default(0);
            $table->smallInteger('is_allow_comment')->default(1);
            $table->smallInteger('is_published')->default(0);
            $table->smallInteger('is_activated')->default(1);
            $table->smallInteger('is_deleted')->default(0);
            $table->timestamps();
        });
    }

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