<?php
declare(strict_types=1);
if (PHP_SAPI !== 'cli') { http_response_code(403); exit(1); }
require_once __DIR__ . '/../src/config.php';
require_once __DIR__ . '/../src/chat_store.php';
// Deploy all updated readers/writers and drain legacy workers before the first migration.
try {
    echo json_encode(migrateChatStore(), JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) . PHP_EOL;
} catch (Throwable $error) {
    fwrite(STDERR, $error->getMessage() . PHP_EOL);
    exit(1);
}
