<?php

define('ROOT_PATH', dirname(__DIR__));
require_once ROOT_PATH . '/app/core/Autoloader.php';
\App\Core\Autoloader::register();
require_once ROOT_PATH . '/app/helpers/config.php';
$bootstrap = new \App\Core\Bootstrap();
$bootstrap->init();

use App\Core\Database;

try {
    $db = Database::getConnection();
    $sql = "ALTER TABLE `wishes` 
            ADD COLUMN IF NOT EXISTS `status` VARCHAR(20) NOT NULL DEFAULT 'approved' COMMENT 'pending | approved | rejected' AFTER `message`,
            ADD COLUMN IF NOT EXISTS `approved_at` DATETIME NULL DEFAULT NULL AFTER `hidden_at`,
            ADD COLUMN IF NOT EXISTS `approved_by` BIGINT UNSIGNED NULL DEFAULT NULL AFTER `approved_at`";
    $db->exec($sql);
    echo "G011 wishes migration executed successfully.\n";
} catch (\Throwable $e) {
    echo "Migration failed: " . $e->getMessage() . "\n";
}
