Create fix_migration.php
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/config/config.php';
|
||||
|
||||
$db = Database::getInstance();
|
||||
|
||||
echo "🔄 Ejecutando migración directamente...\n\n";
|
||||
$sql = file_get_contents(__DIR__ . '/database/02_add_template_components.sql');
|
||||
$statements = array_filter(array_map('trim', explode(';', $sql)));
|
||||
$count = 0;
|
||||
|
||||
foreach ($statements as $stmt) {
|
||||
if (empty($stmt) || preg_match('/^--/', $stmt)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$db->execute($stmt);
|
||||
$count++;
|
||||
echo " ✓ " . substr(preg_replace('/\s+/', ' ', $stmt), 0, 70) . "...\n";
|
||||
} catch (Exception $e) {
|
||||
echo " ✗ " . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n✅ Ejecutadas $count sentencias\n\n";
|
||||
|
||||
echo "📋 Columnas actuales de message_templates:\n";
|
||||
$cols = $db->fetchAll('DESCRIBE message_templates');
|
||||
foreach($cols as $c) {
|
||||
echo " - {$c['Field']} ({$c['Type']})\n";
|
||||
}
|
||||
Reference in New Issue
Block a user