<?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
    {
        // Cambio nome della colonna disponibile in is_attivo
        Schema::table('piatto', function (Blueprint $table) {
            $table->renameColumn('disponibile', 'is_attivo');
        });
        Schema::table('dispositivo', function (Blueprint $table) {
            $table->string('ip')->nullable();
        });
        Schema::table('ordine', function (Blueprint $table) {
            $table->string('stato')->nullable()->change();
            $table->decimal('prezzo', 10, 2)->nullable()->change();
            $table->foreign('dispositivo_id')->references('id')->on('dispositivo')->onDelete('cascade');

        });

    }

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