<?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('tavolo', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('label');
            $table->integer('posti')->nullable();
            $table->string('ubicazione')->nullable();
            $table->integer('coperti')->nullable();
            $table->json('info')->nullable();
            $table->boolean('is_attivo')->default(true);
            $table->bigInteger('attivita_id')->unsigned()->nullable();
            $table->timestamps();
       
        });
        Schema::table('tavolo', function (Blueprint $table) {
            $table->foreign('attivita_id')->references('id')->on('attivita')->onDelete('cascade');
        });
    }

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