Avoid foreign key error if message is deleted before saving attachments
This commit is contained in:
parent
234d238786
commit
c98a346b0c
1 changed files with 4 additions and 4 deletions
|
@ -2997,10 +2997,6 @@ function saveMessage(
|
|||
} satisfies Omit<MessageTypeUnhydrated, 'json'>;
|
||||
|
||||
if (id && !forceSave) {
|
||||
if (normalizeAttachmentData) {
|
||||
saveMessageAttachments(db, message);
|
||||
}
|
||||
|
||||
const result = db
|
||||
.prepare(
|
||||
// UPDATE queries that set the value of a primary key column can be very slow when
|
||||
|
@ -3019,6 +3015,10 @@ function saveMessage(
|
|||
return id;
|
||||
}
|
||||
|
||||
if (normalizeAttachmentData) {
|
||||
saveMessageAttachments(db, message);
|
||||
}
|
||||
|
||||
if (jobToInsert) {
|
||||
insertJob(db, jobToInsert);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue