<?php
namespace FleekDash\Database\Migrations;

use FleekDash\Database\Core\BaseMigration;

/**
 * Drop legacy Site Growth Goals table
 *
 * The old goals system has been fully removed and replaced by the
 * Achievements + KPI Goal system. This migration safely drops the
 * legacy table if it still exists to avoid confusion and dead schema.
 *
 * - Table: {prefix}fleekdash_site_growth_goals
 *
 * Idempotent: safe to run multiple times.
 *
 * TODO (future cleanup):
 * - In a future major version, once we are 100% sure no environments
 *   still have the legacy goals table, this migration itself can be
 *   deleted from the codebase to keep the migrations folder clean.
 * - Until then, keeping this migration ensures automatic removal
 *   for any upgrade from older versions.
 *
 * @package FleekDash\Database\Migrations
 * @since 2.2.0
 * @date 29-Nov-2025
 */
return new class extends BaseMigration {

    public function up(): void
    {
        // Only drop if the legacy table exists
        if ($this->tableExists('fleekdash_site_growth_goals')) {
            $this->dropTable('fleekdash_site_growth_goals');
        }
    }

    public function down(): void
    {
        // No-op: we do not recreate legacy goals table.
        // The system no longer uses this schema.
    }
};
