<?php

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

class Add5cbeef7ef23c6RelationshipsToDocumentTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('documents', function(Blueprint $table) {
            if (!Schema::hasColumn('documents', 'document_type_id')) {
                $table->integer('document_type_id')->unsigned()->nullable();
                $table->foreign('document_type_id', '295713_5cbeef7b402be')->references('id')->on('document_types')->onDelete('set null');
                }
                if (!Schema::hasColumn('documents', 'residental_complex_id')) {
                $table->integer('residental_complex_id')->unsigned()->nullable();
                $table->foreign('residental_complex_id', '295713_5cbeef7b6135c')->references('id')->on('residential_complexes')->onDelete('cascade');
                }
                
        });
    }

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