kal
Explore posts from serversDTDrizzle Team
•Created by kal on 6/19/2024 in #help
How to properly handle/distinguish between errors
I'm using Drizzle ORM with a postgres.
I'd like to distinguish between certain errors that occur when inserting / querying the database.
In my current case, I would like to know specifically when my insertion fails as a result of a user not existing in the database.
(See the comments in the catch block in the following example)
The error I get when a user does not exist is like so:
What is the proper / best way to differentiate between causes of errors while using drizzle?
1 replies
DTDrizzle Team
•Created by kal on 4/19/2024 in #help
Infer typescript type from table with relations
4 replies
DTDrizzle Team
•Created by kal on 4/11/2024 in #help
How to reference composite key in foreign key
I'm trying to create a foreign key which points to another tables composite primary key. I cannot seem to find anywhere how this is meant to be achieved.
I have attached a simplified version of the code I am trying to get to work. As you can see in the
moves
table I am creating a composite primary key. How do I then reference that in the moveTimestamps
table. Also, what should I put in place of varchar
in the moveTimestamps
table move
column, typically I would just match the data type as what it is referencing, but in thise case it should reference both an interger and a varchar.
6 replies