<?php

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

class Add5cbddb716f80cRelationshipsToResidentialComplexTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('residential_complexes', function(Blueprint $table) {
            if (!Schema::hasColumn('residential_complexes', 'developer_id')) {
                $table->integer('developer_id')->unsigned()->nullable();
                $table->foreign('developer_id', '295424_5cbddb6be15b7')->references('id')->on('developers')->onDelete('set null');
                }
                if (!Schema::hasColumn('residential_complexes', 'city_id')) {
                $table->integer('city_id')->unsigned()->nullable();
                $table->foreign('city_id', '295424_5cbddb6c176e1')->references('id')->on('cities')->onDelete('set null');
                }
                if (!Schema::hasColumn('residential_complexes', 'district_id')) {
                $table->integer('district_id')->unsigned()->nullable();
                $table->foreign('district_id', '295424_5cbddb6c4df9a')->references('id')->on('discricts')->onDelete('set null');
                }
                if (!Schema::hasColumn('residential_complexes', 'street_name_id')) {
                $table->integer('street_name_id')->unsigned()->nullable();
                $table->foreign('street_name_id', '295424_5cbddb6c787fa')->references('id')->on('street_names')->onDelete('set null');
                }
                
        });
    }

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