<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('dispositivo_has_cucina', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('dispositivo_id')->unsigned();
            $table->bigInteger('cucina_id')->unsigned();
            $table->timestamps();
        });
        Schema::table('dispositivo_has_cucina', function (Blueprint $table) {
            $table->foreign('dispositivo_id')->references('id')->on('dispositivo')->onDelete('cascade');
            $table->foreign('cucina_id')->references('id')->on('cucina')->onDelete('cascade');
        });
    }

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