<?php

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

class Add5cc089b983904RelationshipsToPlanningTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('plannings', function(Blueprint $table) {
            if (!Schema::hasColumn('plannings', 'room_id')) {
                $table->integer('room_id')->unsigned()->nullable();
                $table->foreign('room_id', '296326_5cc089b480533')->references('id')->on('room_counts')->onDelete('set null');
                }
                if (!Schema::hasColumn('plannings', 'room_type_id')) {
                $table->integer('room_type_id')->unsigned()->nullable();
                $table->foreign('room_type_id', '296326_5cc089b4a7ecc')->references('id')->on('room_types')->onDelete('set null');
                }
                if (!Schema::hasColumn('plannings', 'section_id')) {
                $table->integer('section_id')->unsigned()->nullable();
                $table->foreign('section_id', '296326_5cc089b4c839a')->references('id')->on('sections')->onDelete('cascade');
                }
        });
    }

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