Enable backfilling of attachments without message_attachment rows
This commit is contained in:
parent
f4c1d9334f
commit
37ec000831
4 changed files with 109 additions and 8 deletions
|
@ -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>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue