<?php

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

class CreateProprietaireProprietaireTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('proprietaire_proprietaire', function (Blueprint $table) {
            $table->id();
            $table->timestamps();

            $table->unsignedBigInteger('proprietaireUn_id');
            $table->foreign('proprietaireUn_id')
                ->references('id')
                ->on('proprietaires')
                ->onDelete('cascade')
                ->onUpdate('cascade');

            $table->unsignedBigInteger('proprietaireDeux_id');
            $table->foreign('proprietaireDeux_id')
                ->references('id')
                ->on('proprietaires')
                ->onDelete('cascade')
                ->onUpdate('cascade');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('proprietaire_proprietaire');
    }
}
