Skip to content

Commit 3bf085d

Browse files
DC-5043 Middleware removed from docs (#7233)
* middleware deleted * more middleware removed * more middleware removed * coderabbit changes
1 parent ac89f6a commit 3bf085d

File tree

16 files changed

+18
-1198
lines changed

16 files changed

+18
-1198
lines changed

content/200-orm/200-prisma-client/100-queries/100-query-optimization-performance.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ To get started, follow the [integration guide](/optimize/getting-started) and ad
4242

4343
You can also [log query events at the client level](/orm/prisma-client/observability-and-logging/logging#event-based-logging) to view the generated queries, their parameters, and execution times.
4444

45-
If you are particularly focused on monitoring query duration, consider using [logging middleware](/orm/prisma-client/client-extensions/middleware/logging-middleware).
46-
4745
:::
4846

4947
## Using bulk queries

content/200-orm/200-prisma-client/300-client-extensions/120-query.mdx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Prisma Client extensions are Generally Available from versions 4.16.0 and later.
1515

1616
You can use the `query` [Prisma Client extensions](/orm/prisma-client/client-extensions) component type to hook into the query life-cycle and modify an incoming query or its result.
1717

18-
You can use Prisma Client extensions `query` component to create independent clients. This provides an alternative to [middlewares](/orm/prisma-client/client-extensions/middleware). You can bind one client to a specific filter or user, and another client to another filter or user. For example, you might do this to get [user isolation](/orm/prisma-client/client-extensions#extended-clients) in a row-level security (RLS) extension. In addition, unlike middlewares the `query` extension component gives you end-to-end type safety. [Learn more about `query` extensions versus middlewares](#query-extensions-versus-middlewares).
18+
You can use Prisma Client extensions `query` component to create independent clients with customized behavior. You can bind one client to a specific filter or user, and another client to another filter or user. For example, you might do this to get [user isolation](/orm/prisma-client/client-extensions#extended-clients) in a row-level security (RLS) extension. The `query` extension component provides end-to-end type safety for all your custom queries.
1919

2020
</TopBlock>
2121

@@ -283,20 +283,3 @@ const transactionExtension = Prisma.defineExtension((prisma) =>
283283
const prisma = new PrismaClient().$extends(transactionExtension)
284284
```
285285

286-
## Query extensions versus middlewares
287-
288-
You can use query extensions or [middlewares](/orm/prisma-client/client-extensions/middleware) to hook into the query life-cycle and modify an incoming query or its result. Client extensions and middlewares differ in the following ways:
289-
290-
- Middlewares always apply globally to the same client. Client extensions are isolated, unless you deliberately combine them. [Learn more about client extensions](/orm/prisma-client/client-extensions#about-prisma-client-extensions).
291-
- For example, in a row-level security (RLS) scenario, you can keep each user in an entirely separate client. With middlewares, all users are active in the same client.
292-
- During application execution, with extensions you can choose from one or more extended clients, or the standard Prisma Client. With middlewares, you cannot choose which client to use, because there is only one global client.
293-
- Extensions benefit from end-to-end type safety and inference, but middlewares don't.
294-
295-
You can use Prisma Client extensions in all scenarios where middlewares can be used.
296-
297-
### If you use the `query` extension component and middlewares
298-
299-
If you use the `query` extension component and middlewares in your project, then the following rules and priorities apply:
300-
301-
- In your application code, you must declare all your middlewares on the main Prisma Client instance. You cannot declare them on an extended client.
302-
- In situations where middlewares and extensions with a `query` component execute, Prisma Client executes the middlewares before it executes the extensions with the `query` component. Prisma Client executes the individual middlewares and extensions in the order in which you instantiated them with `$use` or `$extends`.

0 commit comments

Comments
 (0)