<?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::table('plans', function (Blueprint $table) {
            $table->renameColumn('stripe_price_id', 'stripe_price_id_monthly');
        });

        Schema::table('plans', function (Blueprint $table) {
            $table->string('stripe_price_id_annual')->nullable()->after('stripe_price_id_monthly')
                ->comment('Cashier price ID for annual billing');
        });
    }

    public function down(): void
    {
        Schema::table('plans', function (Blueprint $table) {
            $table->dropColumn('stripe_price_id_annual');
        });

        Schema::table('plans', function (Blueprint $table) {
            $table->renameColumn('stripe_price_id_monthly', 'stripe_price_id');
        });
    }
};
