-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Currently, Drizzle ORM requires manual joins and explicit field selection to fetch related data, which can be repetitive and verbose for common parent-child queries.
Request:
-> I would like to request the addition of a built-in feature that supports automatic relation population or nested includes, similar to what ORMs like Prisma provide. This feature would allow developers to:
Fetch related entities in a single query with a simple, declarative API.
Receive nested objects in the query result without manually mapping or restructuring the output.
Improve developer experience by reducing boilerplate join and mapping code.
- Prisma: .findMany({ include: { plan: true } })
- TypeORM: .find({ relations: ['plan'] })
- Sequelize: .findAll({ include: Plan })
Expected in Drizzle ORM:
-> const subscriptions = await db.customerSubscription.findMany({
where: { userId: '...' },
include: { subscriptionPlan: true }
});
In Above code the subscriptionPlan is the foreign key for the customerSubscription which can be auto populate to get the row data automatically.