<?php

declare(strict_types=1);

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('plan_config_group_plan', function (Blueprint $table) {
            $table->foreignId('plan_config_group_id')->constrained()->cascadeOnDelete();
            $table->foreignId('plan_id')->constrained()->cascadeOnDelete();

            $table->unique(['plan_config_group_id', 'plan_id'], 'config_group_plan_unique');
        });
    }

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