Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(qe): implement
relationLoadStrategy
query argument (#4601)
Implement per-query configuration of relation load strategy as described in https://www.notion.so/prismaio/Relation-load-strategy-API-013e3ba957a34d45b4de1b722ca6804d, particularly [this section](https://www.notion.so/prismaio/Relation-load-strategy-API-013e3ba957a34d45b4de1b722ca6804d?pvs=4#045efb0e3cd54caeb6584d65f667fbb5) (Variant 1, only top level). This allows to choose the relation load strategy for all relations in a single query. Engine API: ```graphql query { findManyUser(relationLoadStrategy: join) { login posts { title } } } ``` Client API: ```ts await prisma.user.findMany({ relationLoadStrategy: 'join', // or 'query' select: { login: true, posts: { title: true, }, }, }) ``` The new `relationLoadStrategy` argument is available in the following operations: - findMany - findFirst - findFirstOrThrow - findUnique - findUniqueOrThrow - create - update - delete - upsert The argument is not available in the following operations: - aggregate - groupBy - createMany - updateMany - deleteMany Tests are included for all operations in this PR. Additionally, it must not be available in the `count` operation, which needs to be handled separately on the client side, because `count` is a synthetic operation that does not exist in the query schema and is not known to the engine, and its TS types are generated based on `findMany` args rather than `aggregate` that it translates to. Next steps: - Finalize the Client integration PR - Implement the global setting Part of prisma/team-orm#703 Closes: prisma/team-orm#801 Client PR: prisma/prisma#22483
- Loading branch information