<?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('opzione_form', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('evento_form_id')->nullable();
            $table->string('label', 255)->nullable();
            $table->integer('ordine')->nullable();
            $table->decimal('costo', 8, 2)->nullable();
            $table->string('limite_anno', 255)->nullable();
            $table->integer('remote_id')->nullable();
            $table->integer('posti_disponibili')->nullable();
            $table->timestamps();
        });
        Schema::table('opzione_form', function (Blueprint $table) {
            $table->foreign('evento_form_id')->references('id')->on('evento_form')->onDelete('cascade');
        });
    }

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