Vladimír Gál
Explore posts from serversDTDrizzle Team
•Created by Vladimír Gál on 1/11/2024 in #help
Unique constrain error, id still incremented
Hi folks,
so I have moved from TypeORM to DrizzleORM and I love it!
I encountered an issue recently where I have a unique constrain on my email field:
When I try to save the user, everything works, I get my user with id , for example
10
. Now when I try to save the same user, I get my nice error message: "detail": "Key (email)=([email protected]) already exists."
.
The issue comes when I try to save a new user now. Instead of saving a new user with id 11
, it skips the one it tried to save when unique constrain error was thrown and save the new user with id 12
. Any ideas how to fix this please ?5 replies