<?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::table('dispositivo', function (Blueprint $table) {
            $table->bigInteger('cucina_id')->unsigned()->nullable();
            $table->foreign('cucina_id')->references('id')->on('cucina')->onDelete('set null');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('dispositivo', function (Blueprint $table) {
            $table->dropForeign(['cucina_id']);
            $table->dropColumn('cucina_id');
        });
    }
};
