<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('activity_email_logs', function (Blueprint $table): void {
            $table->id();
            $table->foreignId('activity_id')->constrained('activities')->cascadeOnDelete();
            $table->foreignId('email_log_id')->constrained('email_logs')->cascadeOnDelete();
            $table->timestamps();

            $table->unique(['activity_id', 'email_log_id']);
        });
    }

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