<?php

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

/**
 * Migration auto-generated by Sequel Pro Laravel Export (1.4.1)
 * @see https://github.com/cviebrock/sequel-pro-laravel-export
 */
class CreatePageTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysql_stern')->create('page', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('owner')->nullable()->default(0);
            $table->string('model', 20)->nullable();
            $table->integer('owner_second');
            $table->integer('catalog_id')->nullable();
            $table->integer('catalog_index')->nullable()->default(0);
            $table->string('slug', 255)->nullable();
            $table->integer('travel_program')->nullable();
            $table->integer('status')->nullable()->default(1);
            $table->integer('show_in_navi')->nullable()->default(1);
            $table->integer('order')->nullable()->default(0);
            $table->string('title', 255)->nullable();
            $table->string('pagetitle', 255)->nullable();
            $table->text('description')->nullable();
            $table->text('keywords')->nullable();
            $table->text('content')->nullable();
            $table->text('content_new')->nullable();
            $table->string('buma_destination', 255)->nullable();
            $table->integer('OLD_CatalogID')->nullable();
            $table->integer('OLD_OwnerID')->nullable();
            $table->integer('buma_gjr')->nullable();
            $table->dateTime('date');
            $table->tinyInteger('price-tags')->default(0);
            $table->text('text_right')->nullable();
            $table->string('keyword', 255)->nullable();
            $table->string('canonical_url', 511)->nullable();
            $table->integer('country_id')->nullable();
            $table->string('template', 80)->nullable();
            $table->integer('lft')->nullable();
            $table->integer('rgt')->nullable();
            $table->integer('lvl')->nullable();
            $table->integer('tree_root')->nullable();
            $table->integer('parent_id')->nullable();
            $table->string('real_url_path', 200)->nullable();
            $table->text('box_body')->nullable();
            $table->string('box_image_url', 200)->nullable();
            $table->string('box_star', 255)->nullable();
            $table->string('box_discount', 255)->nullable();
            $table->longText('cms_settings')->nullable();
            $table->integer('fewo_lodging')->nullable();

            $table->unique('keyword', 'keyword');
            $table->unique('real_url_path', 'UNIQ_140AB620E2652A2A');
            $table->unique('fewo_lodging', 'UNIQ_140AB6209629C357');
            $table->index('tree_root', 'IDX_140AB620A977936C');
            $table->index('parent_id', 'IDX_140AB620727ACA70');

            $table->foreign('parent_id', 'FK_140AB620727ACA70')->references('id')->on('page')->onDelete('CASCADE
')->onUpdate('RESTRICT');
            $table->foreign('fewo_lodging', 'FK_140AB6209629C357')->references('id')->on('fewo_lodging')->onDelete('SET NULL
')->onUpdate('RESTRICT');
            $table->foreign('tree_root', 'FK_140AB620A977936C')->references('id')->on('page')->onDelete('CASCADE
')->onUpdate('RESTRICT');
            $table->foreign('country_id', 'FK_page_travel_country')->references('id')->on('travel_country')->onDelete('SET NULL
')->onUpdate('RESTRICT');

        });



    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysql_stern')->dropIfExists('page');
    }
}
