<?php
require_once __DIR__ . '/../vendor/autoload.php';

use App\Config\Database;

try {
    $db = Database::getInstance()->getConnection();
    
    // Add tracking fields to users table
    $sql = "ALTER TABLE users 
            ADD COLUMN registration_ip VARCHAR(45) NULL AFTER link_slug,
            ADD COLUMN last_ip VARCHAR(45) NULL AFTER registration_ip,
            ADD COLUMN device_info JSON NULL AFTER last_ip";
    
    $db->exec($sql);
    
    echo "Successfully added tracking fields to users table.\n";
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
