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?
3 Replies
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?
Yes, I think relations are only used in "queries" (prisma-like selects). You don't need them when using selects
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.