Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typeorm: disable transactions by default

When I do any update/insert I have queries in a log file

START TRANSACTION
UPDATE/INSERT table SET .....
COMMIT

Is there any way to disable typeorm transactions by default for all queries?

like image 910
Евгений Одинец Avatar asked Mar 14 '26 11:03

Евгений Одинец


1 Answers

You can't disable transactions for the whole application, but you can do it for individual calls of methods like save and remove. To do this, pass the transaction option with a value of false. For example:

userRepository.save(users, { transaction: false });
userRepository.remove(users, { transaction: false });

See for details Additional options section.

like image 167
ns16 Avatar answered Mar 16 '26 02:03

ns16