<?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 'cycle_start_date'");
    if ($stmt->rowCount() == 0) {
        $db->exec('ALTER TABLE accounts ADD COLUMN cycle_start_date DATE DEFAULT NULL AFTER is_active');
        echo "Column added successfully.";
    } else {
        echo "Column already exists.";
    }
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
