<?php

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

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('equip_work_land', function (Blueprint $table) {
            $table->bigInteger('land_id')->unsigned();
            $table->bigInteger('equip_work_id')->unsigned();

            $table
                ->foreign('land_id')
                ->references('id')
                ->on('lands')
                ->onDelete('cascade')
                ->onUpdate('cascade');
            $table
                ->foreign('equip_work_id')
                ->references('id')
                ->on('equip_works')
                ->onDelete('cascade')
                ->onUpdate('cascade');
        });
    }

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