<?php
$host = 'localhost';
$port = '5432';
$dbname = 'unms';
$user = 'ucrm';
$password = 'MtxWkaa5O2Cwy3PRFVXtC01bXFyQjykRpAIqEOXC5FmpMURD';

try {
    $dsn = "pgsql:host=$host;port=$port;dbname=$dbname;user=$user;password=$password";
    $pdo = new PDO($dsn);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    echo "Connected to DB.\n";

    // List tables in ucrm schema matching 'stripe'
    $stmt = $pdo->query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'ucrm' AND table_name LIKE '%stripe%'");
    $tables = $stmt->fetchAll(PDO::FETCH_COLUMN);

    echo "Tables found:\n";
    foreach ($tables as $table) {
        echo "- $table\n";
    }

    // Also check for 'payment' tables if stripe ones aren't obvious/enough
    $stmt2 = $pdo->query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'ucrm' AND table_name LIKE '%payment%' LIMIT 20");
    $tables2 = $stmt2->fetchAll(PDO::FETCH_COLUMN);
    echo "\nPayment Tables sample:\n";
    foreach ($tables2 as $table) {
        echo "- $table\n";
    }

} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage() . "\n";
}
