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'>;
|
} satisfies Omit<MessageTypeUnhydrated, 'json'>;
|
||||||
|
|
||||||
if (id && !forceSave) {
|
if (id && !forceSave) {
|
||||||
if (normalizeAttachmentData) {
|
|
||||||
saveMessageAttachments(db, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = db
|
const result = db
|
||||||
.prepare(
|
.prepare(
|
||||||
// UPDATE queries that set the value of a primary key column can be very slow when
|
// UPDATE queries that set the value of a primary key column can be very slow when
|
||||||
|
@ -3019,6 +3015,10 @@ function saveMessage(
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (normalizeAttachmentData) {
|
||||||
|
saveMessageAttachments(db, message);
|
||||||
|
}
|
||||||
|
|
||||||
if (jobToInsert) {
|
if (jobToInsert) {
|
||||||
insertJob(db, jobToInsert);
|
insertJob(db, jobToInsert);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue