<?php

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

class UpdateResidentialComplexTable06072021 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('residential_complexes', function (Blueprint $table) {
            if (!Schema::hasColumn('residential_complexes', 'preview')) {
                $table->string('preview')->nullable();
            }
            if (!Schema::hasColumn('residential_complexes', 'preview_color_picker')) {
                $table->string('preview_color_picker')->nullable();
            }
            if (!Schema::hasColumn('residential_complexes', 'is_show_price')) {
                $table->tinyInteger('is_show_price')->nullable()->default(1);
            }
        });
    }

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