<?php
header('Content-Type: application/json; charset=utf-8');
require_once __DIR__ . '/../config.php';
try {
    $db = getDB();
    $stmt = $db->query("SHOW TABLES");
    $tables = $stmt->fetchAll(PDO::FETCH_COLUMN);
    echo json_encode(['success' => true, 'tables' => $tables, 'count' => count($tables)]);
} catch (Throwable $e) {
    echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}
