up
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Migration: añadir columnas reply_to_message_id, reaction_to_message_id, reaction_emoji
|
||||
*/
|
||||
require_once __DIR__ . '/../config/config_enhanced.php';
|
||||
require_once __DIR__ . '/../classes/Database.php';
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
$columns = $db->fetchAll("SHOW COLUMNS FROM conversations");
|
||||
$colNames = array_column($columns, 'Field');
|
||||
|
||||
if (!in_array('reply_to_message_id', $colNames)) {
|
||||
$db->query("ALTER TABLE conversations ADD COLUMN reply_to_message_id INT NULL AFTER message_id");
|
||||
echo "Added column reply_to_message_id\n";
|
||||
} else {
|
||||
echo "reply_to_message_id exists\n";
|
||||
}
|
||||
|
||||
if (!in_array('reaction_to_message_id', $colNames)) {
|
||||
$db->query("ALTER TABLE conversations ADD COLUMN reaction_to_message_id INT NULL AFTER reply_to_message_id");
|
||||
echo "Added column reaction_to_message_id\n";
|
||||
} else {
|
||||
echo "reaction_to_message_id exists\n";
|
||||
}
|
||||
|
||||
if (!in_array('reaction_emoji', $colNames)) {
|
||||
$db->query("ALTER TABLE conversations ADD COLUMN reaction_emoji VARCHAR(32) NULL AFTER reaction_to_message_id");
|
||||
echo "Added column reaction_emoji\n";
|
||||
} else {
|
||||
echo "reaction_emoji exists\n";
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "Error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user