<?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('asporto', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('ordine_id')->nullable()->unsigned();
            $table->string('stato')->nullable();
            $table->time('ora_ritiro')->nullable();
            $table->json('info')->nullable();
            $table->timestamps();

            $table->foreign('ordine_id')->references('id')->on('ordine')->onDelete('set null');
        });
    }

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