تخطَّ إلى المحتوى

Missing Transaction For Multi Write (ARCH3065)

هذا المحتوى غير متوفر بلغتك بعد.

Key typescript.orm.missing-transaction-for-multi-write · Severity warning · Category orm

When two or more dependent persistence operations in the same method are not wrapped in an explicit transaction/atomic block, a partial commit can occur. Wrap dependent writes.

await accountRepo.save(debit); // succeeds
await accountRepo.save(credit); // if this fails, debit is left committed
await dataSource.transaction(async (tx) => {
await tx.save(debit);
await tx.save(credit);
});

Group dependent write operations inside a single transaction/atomic block.