<?php
include 'db.php';

echo "Checking table structures...\n\n";

// Check if user_group_memberships table exists and its structure
try {
    $stmt = $pdo->query('DESCRIBE user_group_memberships');
    echo "user_group_memberships table structure:\n";
    while ($row = $stmt->fetch()) {
        echo "  " . $row['Field'] . " - " . $row['Type'] . "\n";
    }
} catch (PDOException $e) {
    echo "user_group_memberships table error: " . $e->getMessage() . "\n";
}

echo "\n";

// Check budgets table structure
try {
    $stmt = $pdo->query('DESCRIBE budgets');
    echo "budgets table structure:\n";
    while ($row = $stmt->fetch()) {
        echo "  " . $row['Field'] . " - " . $row['Type'] . "\n";
    }
} catch (PDOException $e) {
    echo "budgets table error: " . $e->getMessage() . "\n";
}

echo "\n";

// Check user_groups table structure
try {
    $stmt = $pdo->query('DESCRIBE user_groups');
    echo "user_groups table structure:\n";
    while ($row = $stmt->fetch()) {
        echo "  " . $row['Field'] . " - " . $row['Type'] . "\n";
    }
} catch (PDOException $e) {
    echo "user_groups table error: " . $e->getMessage() . "\n";
}
?>
