48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Ver estructura de la tabla message_templates
|
|
*/
|
|
|
|
require_once 'config/config.php';
|
|
|
|
header('Content-Type: text/plain; charset=utf-8');
|
|
|
|
try {
|
|
$db = Database::getInstance();
|
|
|
|
echo "=== ESTRUCTURA DE TABLA message_templates ===\n\n";
|
|
|
|
// Describir la tabla
|
|
$stmt = $db->query("DESCRIBE message_templates");
|
|
$columns = $stmt->fetchAll();
|
|
|
|
echo "Columnas disponibles:\n";
|
|
foreach ($columns as $column) {
|
|
echo "• {$column['Field']} ({$column['Type']}) - {$column['Null']} - {$column['Default']}\n";
|
|
}
|
|
|
|
echo "\n=== INTENTAR INSERCIÓN SIMPLE ===\n";
|
|
|
|
// Intentar inserción con campos mínimos
|
|
$stmt = $db->query(
|
|
"INSERT INTO message_templates (template_name, language_code, status) VALUES (?, ?, ?)",
|
|
['hello_world', 'en_US', 'approved']
|
|
);
|
|
|
|
if ($stmt) {
|
|
echo "✅ Plantilla 'hello_world' agregada exitosamente\n";
|
|
}
|
|
|
|
// Verificar que se agregó
|
|
echo "\n📋 Plantillas en la BD:\n";
|
|
$stmt = $db->query("SELECT * FROM message_templates");
|
|
$templates = $stmt->fetchAll();
|
|
|
|
foreach ($templates as $template) {
|
|
echo "• {$template['template_name']} ({$template['language_code']}) - {$template['status']}\n";
|
|
}
|
|
|
|
} catch (Exception $e) {
|
|
echo "❌ Error: " . $e->getMessage() . "\n";
|
|
}
|
|
?>
|