<?php
require_once __DIR__ . '/../config/db.php';

try {
    $pdo = getConnection();
    
    echo "--- SCHEMA OF producto_presentaciones ---\n";
    $stmt = $pdo->query("SHOW COLUMNS FROM producto_presentaciones");
    $columns = $stmt->fetchAll();
    foreach ($columns as $col) {
        echo "Field: {$col['Field']} | Type: {$col['Type']} | Null: {$col['Null']} | Key: {$col['Key']} | Default: " . json_encode($col['Default']) . " | Extra: {$col['Extra']}\n";
    }
    
    echo "\n--- SCHEMA OF productos ---\n";
    $stmt = $pdo->query("SHOW COLUMNS FROM productos");
    $columns = $stmt->fetchAll();
    foreach ($columns as $col) {
         echo "Field: {$col['Field']} | Type: {$col['Type']} | Null: {$col['Null']} | Key: {$col['Key']} | Default: " . json_encode($col['Default']) . " | Extra: {$col['Extra']}\n";
    }
    
    echo "\n--- TRIGGERS IN farmacia_eles ---\n";
    $stmt = $pdo->query("SHOW TRIGGERS");
    $triggers = $stmt->fetchAll();
    print_r($triggers);

} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
