<?php

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

class CreatePageCatesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('page_cates', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('parent_id')->nullable()->index();
            $table->integer('lft')->nullable()->index();
            $table->integer('rgt')->nullable()->index();
            $table->integer('depth')->nullable();
            $table->string('slug')->nullable();
            $table->char('cname');
            $table->boolean('flag')->default(1);
            $table->boolean('is_product_detail')->default(0);
        });

        Schema::create('page_cate_descriptions', function (Blueprint $table) {
            $table->increments('id');
            $table->char('lang', 10)->index();
            $table->integer('page_cid')->nullable();
            $table->string('cname');
            $table->text('summary')->nullable();
            $table->string('img');
        });
    }

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