<?php

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

class Create1555946321ResidentialComplexesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if(! Schema::hasTable('residential_complexes')) {
            Schema::create('residential_complexes', function (Blueprint $table) {
                $table->increments('id');
                $table->string('name')->nullable();
                $table->tinyInteger('is_repair')->nullable()->default('0');
                $table->tinyInteger('is_credit')->nullable()->default('0');
                $table->tinyInteger('is_transport_hub')->nullable()->default('0');
                $table->string('site_link')->nullable();
                $table->string('email')->nullable();
                $table->decimal('min_price', 15, 2)->nullable();
                $table->string('meta_title')->nullable();
                $table->string('meta_keywords')->nullable();
                $table->string('meta_description')->nullable();
                $table->string('seo_text')->nullable();
                $table->integer('main_page_priority')->nullable()->unsigned();
                $table->integer('res_com_page_priority')->nullable()->unsigned();
                $table->integer('building_count')->nullable();
                $table->integer('room_count')->nullable()->unsigned();
                $table->string('street_number')->nullable();
                
                $table->timestamps();
                $table->softDeletes();

                $table->index(['deleted_at']);
            });
        }
    }

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