Way to get relations via typeof someSchema.$inferSelect?
Is there a way to get a type of a database schema with the relations included?
Currently, I get my
Account
type like this:
But that doesn't give me the relations I've built into the Account type (in my case I have a profile
relation similar to the profile_info
example in the docs.
Do I just need to build this manually? Something like this?
Drizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
3 Replies
You can do it that way. You can also use this custom helper type.
Then you use it like this. First parameter is base table name, second is the same query object drizzle users for relational queries.
Awesome, thank you!
hey i found a more precise one on a github discussion (and i'm using it) :