<?php
require_once __DIR__ . '/../config/config.php';
$db = Database::getInstance();
$col = $db->fetch("SHOW COLUMNS FROM conversations LIKE 'is_read'");
if ($col) {
    echo "Column is_read already exists\n";
    exit(0);
}
try {
    $db->query("ALTER TABLE conversations ADD COLUMN is_read TINYINT(1) NULL DEFAULT 0 AFTER status");
    echo "Added column is_read\n";
} catch (Exception $e) {
    echo "Failed to add is_read: " . $e->getMessage() . "\n";
    exit(1);
}
