Relations in schema

Hi, I am a little bit confused about defining relations and foreign keys, why I need to define application level relation with "relations" keyword if I can just define foreign key by references and use it in my select query with join statement?
No description
3 Replies
jmandrosz
jmandrosz5mo ago
Okay, I assume that this is only for "query api" and if I want to use only regular select statements I can ignore this, am I right?
AstroBear
AstroBear5mo ago
Yes, I think relations are only used in "queries" (prisma-like selects). You don't need them when using selects
Mykhailo
Mykhailo5mo ago
you are right, there is a bit more info https://orm.drizzle.team/docs/rqb#foreign-keys
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
No description