<?php
require_once __DIR__ . '/api/config/database.php';

try {
    $db = Database::connect();
    
    // Check if column exists first
    $stmt = $db->query("SHOW COLUMNS FROM accounts LIKE 'alert_interval_days'");
    if ($stmt->rowCount() == 0) {
        $db->exec('ALTER TABLE accounts ADD COLUMN alert_interval_days INT DEFAULT 0 AFTER alert_date');
        echo "Column added successfully.";
    } else {
        echo "Column already exists.";
    }
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
