<?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('plan_tier_prices', function (Blueprint $table) {
            $table->id();
            $table->foreignId('plan_id')->constrained()->cascadeOnDelete();
            $table->string('tier', 20);
            $table->decimal('price', 12, 2);
            $table->timestamps();

            $table->unique(['plan_id', 'tier']);
            $table->index(['tier']);
        });
    }

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

