[BUG]: Problem with the transaction #952
Labels
bug
Something isn't working
driver/mysql2
driver/planetscale
priority
Will be worked on next
qb/transactions
What version of
drizzle-orm
are you using?0.27.2
What version of
drizzle-kit
are you using?0.19.11
Describe the Bug
I recently switched from Prisma to Drizzle in the T3 stack, but during this process, I encountered some issues with transactions, so I decided to report it.
When using the drizzle-orm/planetscale-serverless package along with mysql2 and drizzle-orm/mysql2 packages, the results were different. Let me first explain the first scenario when
drizzle-orm/planetscale-serverless
was used:Here is an example code of a transaction that increments the values in two tables by 1 each:
The queries work whether using Prepared Statements or not. However, I couldn't confirm if they were executed as transactions through the query logs. I would appreciate it if the logging could be improved to be more intuitive.
Here is what the logs show:
Now, I will explain the situation when connected using
mysql2 and drizzle-orm/mysql2
.If the
increaseViewCount
function from the previous example has the isolationLevel set, the query doesn't work, and you can observe the following log:If I remove the isolationLevel, the query will execute successfully, and you'll be able to see the following log.
Expected behavior
When using the mysql2 driver, regardless of whether the isolation level option is set or not, the queries should function correctly, and it would be great to have consistent and improved transaction logging.
Perhaps something like this
Environment & setup
mysql2 v3.5.2
macOS v12.6
node v18.12
next v13.4.10
react v18.2
The text was updated successfully, but these errors were encountered: