hello. I have a question. Why use transaction to o...
# orm-help
y
hello. I have a question. Why use transaction to one insert or update?? For example,
Copy code
await this.prismaService.customer.create({
            data: {
                name: 'hello',
                email: '<mailto:ltnscp9028@gmail.com|ltnscp9028@gmail.com>',
                password: 'password',
            },
        });
Code create this query.
j
Generally you'll find databases will automatically wrap queries in a transaction anyway. MySQL does it with autocommit mode enabled by default. Keeps each statement atomic
👍 1
n
Hey 👋 As Jared mentioned this could be due to your database settings and autocommit setting being enabled. If you are running any bulk or nested queries like createMany, updateMany etc then Prisma automatically wraps them in a transaction.