<?php
try {
    $pdo = new PDO('mysql:host=127.0.0.1;dbname=projects_membershipdb;charset=utf8mb4', 'root', '', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);

    $pdo->exec("ALTER TABLE contribution_types MODIFY COLUMN frequency ENUM('one-time','daily','weekly','monthly','quarterly','annual') NOT NULL DEFAULT 'one-time'");
    echo "Updated frequency ENUM to include daily and weekly\n";

    $pdo->exec("ALTER TABLE contribution_types ADD COLUMN duration_months INT DEFAULT NULL AFTER frequency");
    echo "Added duration_months column\n";

    echo "Migration 018 completed successfully\n";
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
    exit(1);
}
