<?php

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

class Add5cc08206d9085RelationshipsToSectionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('sections', function(Blueprint $table) {
            if (!Schema::hasColumn('sections', 'section_type_id')) {
                $table->integer('section_type_id')->unsigned()->nullable();
                $table->foreign('section_type_id', '296285_5cc082031a418')->references('id')->on('section_types')->onDelete('set null');
                }
                if (!Schema::hasColumn('sections', 'stage_of_construction_id')) {
                $table->integer('stage_of_construction_id')->unsigned()->nullable();
                $table->foreign('stage_of_construction_id', '296285_5cc082033fdde')->references('id')->on('stage_of_constructions')->onDelete('set null');
                }
                if (!Schema::hasColumn('sections', 'residental_complex_id')) {
                $table->integer('residental_complex_id')->unsigned()->nullable();
                $table->foreign('residental_complex_id', '296285_5cc0820366a66')->references('id')->on('residential_complexes')->onDelete('set null');
                }
                
        });
    }

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