Problem
Some users are asking for a less restricted way for opening an interactive transaction. Instead of having a callback for the transaction, there would be manual calls to $begin, $commit, and $rollback.
Suggested solution
Example of a use-case
describe('some test', () => {
let trx: Transaction;
beforeEach(async () => {
trx = await prisma.$begin();
jest.mock('./prisma', () => trx);
});
afterEach(async () => {
await trx.$rollback();
});
it('.....', () => {
// ....
});
});
Alternatives
Additional context
#1844 (comment)
Problem
Some users are asking for a less restricted way for opening an interactive transaction. Instead of having a callback for the transaction, there would be manual calls to
$begin,$commit, and$rollback.Suggested solution
Example of a use-case
Alternatives
Additional context
#1844 (comment)