<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up()
    {
        Schema::create('class_attendees', function (Blueprint $table) {
            $table->id();
            $table->foreignId('gym_class_id')->constrained()->onDelete('cascade');
            $table->foreignId('member_id')->constrained()->onDelete('cascade');
            $table->boolean('attended')->default(false);
            $table->text('notes')->nullable();
            $table->timestamps();
            
            $table->unique(['gym_class_id', 'member_id']);
        });
    }

    public function down()
    {
        Schema::dropIfExists('class_attendees');
    }
};