<?php

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

class CreateIQContentTagsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('i_q_content_tags', function (Blueprint $table) {

            $table->bigIncrements('id');
            $table->unsignedBigInteger('category_id')->index();

            $table->string('name')->index();
            $table->string('slug')->unique()->index();
            $table->unsignedTinyInteger('pos')->default(0);
            $table->boolean('active')->default(true);

            $table->timestamps();

            $table->foreign('category_id')
                ->references('id')
                ->on('i_q_content_categories')
                ->onDelete('cascade');
        });
    }

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

