<?php

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

class CreateChatChannelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('chat_channels', function (Blueprint $table) {
            $table->increments('id');
            $table->string('tag')->unique();
            $table->boolean('public')->default(false);
            $table->integer('related_id')->unsigned()->nullable();
            $table->string('related_type', 32)->nullable();
            $table->boolean('closed')->default(false);
            $table->integer('created_by')->nullable()->unsigned();
            $table->timestamps();
        });
    }

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