<?php

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

class CreatePagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pages', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('pid');
            $table->integer('pagetype')->default(1);
            $table->string('slug')->nullable();
            $table->tinyInteger('target')->default(1);
            $table->string('linkurl')->nullable();
            $table->integer('orders')->default(0);
            $table->boolean('flag')->default(1);   
            $table->timestamps();      
        });

        Schema::create('page_descriptions', function (Blueprint $table) {
            $table->increments('id');
            $table->char('lang', 10)->index();
            $table->integer('page_id');
            $table->string('title');
            $table->text('summary')->nullable();
            $table->longText('content')->nullable();
            $table->string('seo_title')->nullable();
            $table->string('seo_keywords')->nullable();
            $table->text('seo_description')->nullable();
            $table->string('img');
        });

    }

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