<?php

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

class DropUniqueToPropertyExecutive extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {

        // drop all index and forigns ...daha önce eklenene unique keyin kaldırılamamsı sebebi ile ...
        Schema::table('property_executive', function (Blueprint $table) {
            $table->dropForeign('property_executive_ibfk_1');
            $table->dropForeign('property_executive_ibfk_2');
            $table->dropForeign('property_executive_ibfk_3');
            $table->dropForeign('property_executive_ibfk_4');
            $table->dropIndex('property_executive_updated_by_foreign');
            $table->dropIndex('property_executive_created_by_foreign');
            $table->dropIndex('property_executive_executive_type_id_foreign');
            $table->dropIndex('property_executive_property_id_executive_type_id_unique');
        });

        Schema::table('property_executive',function (Blueprint $table) {
            $table->foreign('property_id')->references('id')->on('property');
            $table->foreign('executive_type_id')->references('id')->on('property_executive_type');
            $table->foreign('created_by')->references('id')->on('user');
            $table->foreign('updated_by')->references('id')->on('user');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */

}
