Enable backfilling of attachments without message_attachment rows

This commit is contained in:
trevor-signal
2025-08-26 23:20:14 -04:00
committed by GitHub
parent f4c1d9334f
commit 37ec000831
4 changed files with 109 additions and 8 deletions

View File

@@ -705,6 +705,8 @@ export const DataWriter: ServerWritableInterface = {
disableFSync,
enableFSyncAndCheckpoint,
_testOnlyRemoveMessageAttachments,
// Server-only
removeKnownStickers,
@@ -2720,6 +2722,17 @@ function saveMessageAttachment({
).run(values);
}
function _testOnlyRemoveMessageAttachments(
db: WritableDB,
timestamp: number
): void {
const [query, params] = sql`
DELETE FROM message_attachments
WHERE sentAt = ${timestamp};`;
db.prepare(query).run(params);
}
function saveMessage(
db: WritableDB,
message: ReadonlyDeep<MessageType>,