<?php

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

class CreateCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->increments('id');

            $table->string('title')->comment('名称');
            $table->integer('parent_id')->default(0)->index()->comment('父级id');
            $table->string('value')->nullable()->comment('值');
            $table->string('root', 8)->default('F')->comment('是否允许下级再分类');
            $table->integer('order')->default(0)->comment('排序');
            $table->tinyInteger('status')->default(1);

            $table->timestamps();
        });
    }

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