<?php

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

class ChangeColumnsExecutiveContactNameAndPropertyIdFields extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        DB::table('property_executive')->truncate();
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');

        Schema::table('property_executive', function (Blueprint $table) {
            $table->unique(['property_id', 'name_surname']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
