<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('event_packages', function (Blueprint $table) {
            if (! Schema::hasColumn('event_packages', 'gallery_expires_at')) {
                $table->timestamp('gallery_expires_at')->nullable();
            }

            if (! Schema::hasColumn('event_packages', 'used_guests')) {
                $table->integer('used_guests')->default(0);
            }
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('event_packages', function (Blueprint $table) {
            if (Schema::hasColumn('event_packages', 'gallery_expires_at')) {
                $table->dropColumn('gallery_expires_at');
            }

            if (Schema::hasColumn('event_packages', 'used_guests')) {
                $table->dropColumn('used_guests');
            }
        });
    }
};
