fix(onebot): preserve historical media independently of cache limits

Preserve message history and the media information needed for reliable
forwarding. Retain available older data during upgrades and report storage
failures explicitly.

Fixes #462
This commit is contained in:
DrSmoothl committed 2026-10-04 14:00:30 +08:00
1 parent d86e0fc7b5
commit 99bcfca15c
17 files changed
+659 -230

No files matched your search

@@ -279,6 +279,9 @@ export function inspectMessageStoreMigration(dbPath: string): MessageStoreMigrat
export function prepareMessageStoreSchema(db: DatabaseSync): void {
const before = db.prepare('PRAGMA table_info(messages)').all() as Array<{ name: string }>;
const existingColumns = new Set(before.map((column) => column.name));
if (!existingColumns.has('media_data')) {
db.exec('ALTER TABLE messages ADD COLUMN media_data TEXT');
}
const existingRowsAreCurrent = existingColumns.has('sequence_authoritative')
&& existingColumns.has('private_direction')
&& hasLegacyPrivateSequenceMigration(db);