Replies: 1 comment
-
I have the same issue here and did a transaction for attachmentQueue and another transaction to Kysely. Like this: if (imagesToDelete.length > 0) {
for (const imageToDelete of imagesToDelete) {
const recordToDelete =
await system.imageAttachmentsQueue?.newAttachmentRecord({
id: imageToDelete.image_attachment_id!
});
await system.powersync.writeTransaction(async (tx) => {
if (system.imageAttachmentsQueue && recordToDelete) {
await system.imageAttachmentsQueue?.delete(recordToDelete, tx);
}
});
await db.transaction().execute(async (trx) => {
await trx
.deleteFrom('evaluation_feedback_images')
.where('id', '=', imageToDelete.evaluation_feedback_image_id)
.execute();
});
}
} But one transaction would be better ... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Previously without kysely, I do transaction like this:
Now that I switched to kysely, and it seems that kysely transaction doesn't work with attachment, i.e. I can't do this:
For now I have to move the attachment part out of transaction, which is not an ideal solution.
Is there any better solution? Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions