<?php
require_once 'config.php';
$pdo = getDBConnection();
header('Content-Type: text/plain');

$tables = ['mediciones', 'ships', 'sensor_positions', 'sensor_temperature_config', 'users', 'user_ships'];

foreach ($tables as $table) {
    echo "--- TABLE: $table ---\n";
    try {
        $stmt = $pdo->query("DESCRIBE $table");
        while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            echo "  {$row['Field']} ({$row['Type']})\n";
        }
    } catch (Exception $e) {
        echo "  ERROR: " . $e->getMessage() . "\n";
    }
    echo "\n";
}
?>