<?php
require_once __DIR__ . '/../src/Utils/Env.php';
require_once __DIR__ . '/../src/Config/Database.php';

use App\Utils\Env;
use App\Config\Database;

Env::load(__DIR__ . '/../../.env');
$db = Database::getInstance()->getConnection();

try {
    $db->exec("ALTER TABLE users ADD COLUMN real_user_id BIGINT UNSIGNED NULL AFTER seed_owner_admin_id");
    $db->exec("ALTER TABLE users ADD CONSTRAINT fk_users_real_user_id FOREIGN KEY (real_user_id) REFERENCES users(id) ON DELETE SET NULL");
    echo "Migration successful: Added real_user_id column.";
} catch (PDOException $e) {
    echo "Migration info: " . $e->getMessage();
}
