<?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('prenotazione_risposta', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('prenotazione_id')->nullable();
            $table->unsignedBigInteger('evento_form_id')->nullable();
            $table->text('risposta')->nullable();
            $table->integer('remote_id')->nullable();
            $table->decimal('costo', 10, 2)->nullable();
            $table->timestamps();
        });
        Schema::table('prenotazione_risposta', function (Blueprint $table) {
            $table->foreign('prenotazione_id')->references('id')->on('prenotazione')->onDelete('cascade');
            $table->foreign('evento_form_id')->references('id')->on('evento_form')->onDelete('cascade');
        });
    }

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