<?php

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

class AddContactsResidentialComplex extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('residential_complexes', function (Blueprint $table) {
            if (!Schema::hasColumn('residential_complexes', 'is_show_consultation')) {
                $table->tinyInteger('is_show_consultation')->default(1);
            }
            if (!Schema::hasColumn('residential_complexes', 'is_show_presentation')) {
                $table->tinyInteger('is_show_presentation')->default(0);
            }
            if (!Schema::hasColumn('residential_complexes', 'is_show_telegram')) {
                $table->tinyInteger('is_show_telegram')->default(0);
            }
            if (!Schema::hasColumn('residential_complexes', 'is_show_viber')) {
                $table->tinyInteger('is_show_viber')->default(0);
            }
            if (!Schema::hasColumn('residential_complexes', 'is_show_skype')) {
                $table->tinyInteger('is_show_skype')->default(0);
            }
            if (!Schema::hasColumn('residential_complexes', 'is_show_whatsapp')) {
                $table->tinyInteger('is_show_whatsapp')->default(0);
            }

            if (!Schema::hasColumn('residential_complexes', 'email')) {
                $table->string('email')->nullable();
            }
            if (!Schema::hasColumn('residential_complexes', 'presentation')) {
                $table->string('presentation')->nullable();
            }
            if (!Schema::hasColumn('residential_complexes', 'telegram')) {
                $table->string('telegram')->nullable();
            }
            if (!Schema::hasColumn('residential_complexes', 'viber')) {
                $table->string('viber')->nullable();
            }
            if (!Schema::hasColumn('residential_complexes', 'skype')) {
                $table->string('skype')->nullable();
            }
            if (!Schema::hasColumn('residential_complexes', 'whatsapp')) {
                $table->string('whatsapp')->nullable();
            }
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
