<?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_tavolo', function (Blueprint $table) {
            $table->id();
            $table->string('nome');
            $table->string('email')->nullable();
            $table->string('telefono')->nullable();
            $table->bigInteger('tavolo_id')->unsigned()->nullable();
            $table->string('data_prenotazione')->nullable();
            $table->string('ora_prenotazione')->nullable();
            $table->string('note')->nullable();
            $table->string('stato')->nullable();
            $table->bigInteger('attivita_id')->unsigned()->nullable();
            $table->integer('coperti')->nullable();
            $table->timestamps();
        });
        Schema::table('prenotazione_tavolo', function (Blueprint $table) {
            $table->foreign('attivita_id')->references('id')->on('attivita')->onDelete('cascade');
            $table->foreign('tavolo_id')->references('id')->on('tavolo')->onDelete('cascade');
        });
    }

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