Skip to content

Commit f874ced

Browse files
Docs for 6.11.0 launch (#6978)
* document `dev stop` and `dev rm` commands * document mariadb adapter * fix indentation issue * update environments * add embedded prisma studio docs * Optimised images with calibre/image-actions * small changes on embedded prisma studio paghe * update embedding studio docs * minor updates for studio docs * small changes * revert db limits * Optimised images with calibre/image-actions * update vercel template list * update embedded studio to new api * update qc docs for neon and cockroach * update naming of d1 adapter * update and comment list of new generator examples; make public with launch * fix tyops --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 2d78ab6 commit f874ced

19 files changed

Lines changed: 619 additions & 116 deletions

File tree

content/200-orm/050-overview/500-databases/200-database-drivers.mdx

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,38 +39,37 @@ Prisma Client will use the Query Engine to transform the Prisma Client query to
3939
![Query flow from the user application to the database using Prisma Client and driver adapters](./images/drivers/qe-query-engine-adapter.png)
4040

4141
There are two different types of driver adapters:
42-
4342
- [Database driver adapters](#database-driver-adapters)
4443
- [Serverless driver adapters](#serverless-driver-adapters)
4544

4645
> **Note**: Driver adapters enable [edge deployments](/orm/prisma-client/deployment/edge/overview) of applications that use Prisma ORM.
4746
4847
### Database driver adapters
4948

50-
You can connect to your database using a Node.js-based driver from Prisma Client using a database driver adapter. Prisma maintains the following database driver adapters:
49+
You can connect to your database using a Node.js-based driver from Prisma Client using a database driver adapter. Prisma maintains the adapters for the following drivers:
5150

5251
- PostgreSQL
5352
- [`pg`](/orm/overview/databases/postgresql#using-the-node-postgres-driver)
53+
- MySQL/MariaDB
54+
- [`mariadb`](/orm/overview/databases/mysql#using-the-mariadb-driver)
5455
- SQLite
5556
- [`better-sqlite3`](/orm/overview/databases/sqlite#using-the-better-sqlite3-driver)
5657
- [`libSQL`](/orm/overview/databases/turso#how-to-connect-and-query-a-turso-database) (Turso)
57-
- MSSQL
58+
- MS SQL Server
5859
- [`node-mssql`](/orm/overview/databases/sql-server#using-the-node-mssql-driver)
5960

6061
### Serverless driver adapters
6162

6263
Database providers, such as Neon and PlanetScale, allow you to connect to your database using other protocols besides TCP, such as HTTP and WebSockets. These database drivers are optimized for connecting to your database in serverless and edge environments.
6364

6465
Prisma ORM maintains the following serverless driver adapters:
65-
6666
- [Neon](/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm-preview) (and Vercel Postgres)
6767
- [PlanetScale](/orm/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview)
6868
- [Cloudflare D1](/orm/overview/databases/cloudflare-d1)
6969

7070
### Community-maintained database driver adapters
7171

7272
You can also build your own driver adapter for the database you're using. The following is a list of community-maintained driver adapters:
73-
7473
- [TiDB Cloud Serverless Driver](https://github.com/tidbcloud/prisma-adapter)
7574
- [PGlite - Postgres in WASM](https://github.com/lucasthevenet/pglite-utils/tree/main/packages/prisma-adapter)
7675

@@ -79,27 +78,26 @@ You can also build your own driver adapter for the database you're using. The fo
7978
To use this feature:
8079

8180
1. Update the `previewFeatures` block in your schema to include the `driverAdapters` Preview feature:
82-
83-
```prisma
84-
generator client {
85-
provider = "prisma-client-js"
86-
previewFeatures = ["driverAdapters"]
87-
}
88-
```
81+
```prisma
82+
generator client {
83+
provider = "prisma-client-js"
84+
previewFeatures = ["driverAdapters"]
85+
}
86+
```
8987

9088
2. Generate Prisma Client:
91-
92-
```bash
93-
npx prisma generate
94-
```
89+
```terminal
90+
npx prisma generate
91+
```
9592

9693
3. Refer to the following pages to learn more about how to use the specific driver adapters with the specific database providers:
97-
98-
- [PostgreSQL](/orm/overview/databases/postgresql#using-the-node-postgres-driver)
99-
- [Neon](/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm-preview)
100-
- [PlanetScale](/orm/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview)
101-
- [Turso](/orm/overview/databases/turso#how-to-connect-and-query-a-turso-database)
102-
- [Cloudflare D1](/orm/overview/databases/cloudflare-d1)
94+
- [PostgreSQL](/orm/overview/databases/postgresql#using-the-node-postgres-driver)
95+
- [MySQL/MariaDB](/orm/overview/databases/mysql#using-the-mariadb-driver)
96+
- [MS SQL Server](/orm/overview/databases/sql-server#using-the-node-mssql-driver)
97+
- [Neon](/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm-preview)
98+
- [PlanetScale](/orm/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview)
99+
- [Turso](/orm/overview/databases/turso#how-to-connect-and-query-a-turso-database)
100+
- [Cloudflare D1](/orm/overview/databases/cloudflare-d1)
103101

104102
## Notes about using driver adapters
105103

content/200-orm/050-overview/500-databases/400-mysql.mdx

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ metaDescription: 'This page explains how Prisma can connect to a MySQL or MariaD
55
tocDepth: 3
66
---
77

8-
<TopBlock>
9-
108
The MySQL data source connector connects Prisma ORM to a [MySQL](https://www.mysql.com/) or [MariaDB](https://mariadb.org/) database server.
119

1210
By default, the MySQL connector contains a database driver responsible for connecting to your database. You can use a [driver adapter](/orm/overview/databases/database-drivers#driver-adapters) (Preview) to connect to your database using a JavaScript database driver from Prisma Client.
1311

14-
</TopBlock>
15-
1612
## Example
1713

1814
To connect to a MySQL database server, you need to configure a [`datasource`](/orm/prisma-schema/overview/data-sources) block in your [Prisma schema](/orm/prisma-schema):
@@ -29,6 +25,60 @@ The fields passed to the `datasource` block are:
2925
- `provider`: Specifies the `mysql` data source connector, which is used both for MySQL and MariaDB.
3026
- `url`: Specifies the [connection URL](#connection-url) for the MySQL database server. In this case, an [environment variable is used](/orm/prisma-schema/overview#accessing-environment-variables-from-the-schema) to provide the connection URL.
3127

28+
## Using the `mariadb` driver
29+
30+
As of [`v5.4.0`](https://github.com/prisma/prisma/releases/tag/5.4.0), you can use Prisma ORM with database drivers from the JavaScript ecosystem (instead of using Prisma ORM's built-in drivers). You can do this by using a [driver adapter](/orm/overview/databases/database-drivers).
31+
32+
For MySQL and MariaDB, [`mariadb`](https://github.com/mariadb-corporation/mariadb-connector-nodejs) is one of the most popular drivers in the JavaScript ecosystem.
33+
34+
This section explains how you can use it with Prisma ORM and the `@prisma/adapter-mariadb` driver adapter.
35+
36+
### 1. Enable the `driverAdapters` Preview feature flag
37+
38+
Since driver adapters are currently in [Preview](/orm/more/releases#preview), you need to enable its feature flag on the `datasource` block in your Prisma schema:
39+
40+
```prisma file=schema.prisma
41+
generator client {
42+
provider = "prisma-client-js"
43+
previewFeatures = ["driverAdapters"]
44+
}
45+
46+
datasource db {
47+
provider = "mysql"
48+
url = env("DATABASE_URL")
49+
}
50+
```
51+
52+
Once you have added the feature flag to your schema, re-generate Prisma Client:
53+
54+
```terminal
55+
npx prisma generate
56+
```
57+
58+
### 2. Install the dependencies
59+
60+
Next, install Prisma ORM's driver adapter for `mariadb`:
61+
62+
```terminal
63+
npm install @prisma/adapter-mariadb
64+
```
65+
66+
### 3. Instantiate Prisma Client using the driver adapter
67+
68+
Finally, when you instantiate Prisma Client, you need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
69+
70+
```ts
71+
import { PrismaMariaDb } from '@prisma/adapter-mariadb';
72+
import { PrismaClient } from './generated/prisma';
73+
74+
const adapter = new PrismaMariaDb({
75+
host: "localhost",
76+
port: 3306,
77+
connectionLimit: 5
78+
});
79+
const prisma = new PrismaClient({ adapter });
80+
```
81+
3282
## Connection details
3383

3484
### Connection URL

content/200-orm/050-overview/500-databases/950-cloudflare-d1.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Make sure that you have a [`prisma.config.ts`](/orm/reference/prisma-config-refe
9999
```ts file=prisma.config.ts
100100
import path from 'node:path'
101101
import type { PrismaConfig } from 'prisma'
102-
import { PrismaD1HTTP } from '@prisma/adapter-d1'
102+
import { PrismaD1 } from '@prisma/adapter-d1'
103103

104104
// import your .env file
105105
import 'dotenv/config'
@@ -117,7 +117,7 @@ export default {
117117
// add-start
118118
migrate: {
119119
async adapter(env) {
120-
return new PrismaD1HTTP({
120+
return new PrismaD1({
121121
CLOUDFLARE_D1_TOKEN: env.CLOUDFLARE_D1_TOKEN,
122122
CLOUDFLARE_ACCOUNT_ID: env.CLOUDFLARE_ACCOUNT_ID,
123123
CLOUDFLARE_DATABASE_ID: env.CLOUDFLARE_DATABASE_ID,
@@ -128,6 +128,8 @@ export default {
128128
} satisfies PrismaConfig<Env>
129129
```
130130

131+
> **Note**: As of [Prisma ORM v6.11.0](https://github.com/prisma/prisma/releases/tag/6.11.0), the D1 adapter has been renamed from `PrismaD1HTTP` to `PrismaD1`.
132+
131133
#### 4. Migrate your database
132134

133135
Prisma Migrate now will run migrations against your remote D1 database based on the configuration provided in `prisma.config.ts`.
@@ -143,7 +145,7 @@ npx prisma db push
143145
Note that for querying the database, you keep using the `PrismaD1` driver adapter from the `@prisma/adapter-d1` package:
144146

145147
```ts
146-
import { PrismaD1HTTP } from '@prisma/adapter-d1'
148+
import { PrismaD1 } from '@prisma/adapter-d1'
147149
```
148150

149151
:::

content/200-orm/100-prisma-schema/10-overview/03-generators.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,30 @@ generated/
252252
└── models.ts
253253
```
254254

255+
<!--
256+
### Examples
257+
258+
To see what the new `prisma-client` generator looks like in practice, check out our minimal and [ready-to-run examples](https://github.com/prisma/prisma-examples):
259+
- [`nextjs-starter-webpack`](https://github.com/prisma/prisma-examples/tree/latest/prisma-client-generator/nextjs-starter-webpack):
260+
- **Framework**: Next.js 15
261+
- **Bundler**: Webpack 5
262+
- **Runtime**: Node.js
263+
- [`nextjs-starter-turbopack`](https://github.com/prisma/prisma-examples/tree/latest/prisma-client-generator/nextjs-starter-turbopack):
264+
- **Framework**: Next.js 15
265+
- **Bundler**: Turbopack (alpha)
266+
- **Runtime**: Node.js
267+
- [`neextjs-starter-webpack-monorepo`](https://github.com/prisma/prisma-examples/tree/latest/prisma-client-generator/neextjs-starter-webpack-monorepo):
268+
- **Framework**: Next.js 15
269+
- **Bundler**: Webpack 5
270+
- **Runtime**: Node.js
271+
- **Monorepo Package Manager**: pnpm
272+
- [`nextjs-starter-webpack-with-middleware`](https://github.com/prisma/prisma-examples/tree/latest/prisma-client-generator/nextjs-starter-webpack-with-middleware):
273+
- **Framework**: Next.js 15
274+
- **Bundler**: Webpack 5
275+
- **Runtime**: Node.js (main pages), Vercel Edge Light (middleware)
276+
-->
277+
278+
255279
## Community generators
256280

257281
:::note

content/200-orm/200-prisma-client/000-setup-and-configuration/300-no-rust-engine.mdx

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metaDescription: "Learn how to use Prisma ORM without Rust engines"
55
sidebar_class_name: preview-badge
66
---
77

8-
As of [v6.7.0](https://pris.ly/release/6.7.0), you can use Prisma ORM without [Rust engine](/orm/more/under-the-hood/engines) binaries on PostgreSQL, SQLite, D1, PlanetScale & MS SQL Server databases.
8+
As of [v6.7.0](https://pris.ly/release/6.7.0), you can use Prisma ORM without [Rust engine](/orm/more/under-the-hood/engines) binaries on PostgreSQL, CockroachDB, Neon, MySQL, PlanetScale, SQLite, D1 & MS SQL Server databases.
99

1010
This page gives an overview of how to use this version of Prisma ORM.
1111

@@ -63,11 +63,11 @@ npm install @prisma/adapter-better-sqlite3
6363
npm install @prisma/adapter-d1
6464
```
6565
</TabItem>
66-
<!-- <TabItem value="MySQL">
66+
<TabItem value="MySQL/MariaDB">
6767
```terminal
68-
npm install @prisma/adapter-mysql2
68+
npm install @prisma/adapter-mariadb
6969
```
70-
</TabItem> -->
70+
</TabItem>
7171
<TabItem value="PlanetScale">
7272
```terminal
7373
npm install @prisma/adapter-planetscale
@@ -78,6 +78,16 @@ npm install @prisma/adapter-planetscale
7878
npm install @prisma/adapter-mssql
7979
```
8080
</TabItem>
81+
<TabItem value="CockroachDB">
82+
```terminal
83+
npm install @prisma/adapter-pg
84+
```
85+
</TabItem>
86+
<TabItem value="Neon Serverles">
87+
```terminal
88+
npm install @prisma/adapter-neon
89+
```
90+
</TabItem>
8191
</TabbedContent>
8292

8393
### 4. Instantiate Prisma Client
@@ -126,20 +136,19 @@ export default {
126136
}
127137
```
128138
</TabItem>
129-
<!--
130-
<TabItem value="MySQL">
139+
<TabItem value="MySQL/MariaDB">
131140
```typescript
132-
import { PrismaMySQL2 } from '@prisma/adapter-mysql2';
141+
import { PrismaMariaDb } from '@prisma/adapter-mariadb';
133142
import { PrismaClient } from './generated/prisma';
134143

135-
const adapter = new PrismaMySQL2({
136-
host: process.env.HOST,
137-
user: process.env.USER,
138-
database: process.env.DB_NAME,
139-
})
144+
const adapter = new PrismaMariaDb({
145+
host: "localhost",
146+
port: 3306,
147+
connectionLimit: 5
148+
});
140149
const prisma = new PrismaClient({ adapter });
141150
```
142-
</TabItem> -->
151+
</TabItem>
143152
<TabItem value="PlanetScale">
144153
```typescript
145154
import { PrismaPlanetScale } from '@prisma/adapter-planetscale'
@@ -175,6 +184,28 @@ const adapter = new PrismaMSSQL(sqlConfig)
175184
const prisma = new PrismaClient({ adapter });
176185
```
177186
</TabItem>
187+
<TabItem value="CockroachDB">
188+
```typescript
189+
import { PrismaPg } from '@prisma/adapter-pg'
190+
import { PrismaClient } from './generated/prisma'
191+
192+
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
193+
const prisma = new PrismaClient({ adapter })
194+
```
195+
</TabItem>
196+
<TabItem value="Neon Serverless">
197+
```typescript
198+
import { PrismaClient } from '@prisma/client'
199+
import { PrismaNeon } from '@prisma/adapter-neon'
200+
import dotenv from 'dotenv'
201+
202+
dotenv.config()
203+
const connectionString = `${process.env.DATABASE_URL}`
204+
205+
const adapter = new PrismaNeon({ connectionString })
206+
const prisma = new PrismaClient({ adapter })
207+
```
208+
</TabItem>
178209
</TabbedContent>
179210

180211

content/200-orm/400-tools/06-prisma-studio.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ import StudioEnumSvg from '/img/studio/enum.svg';
1313
import StudioArraySvg from '/img/studio/array.svg';
1414
import StudioObjectSvg from '/img/studio/object.svg';
1515

16-
<TopBlock>
17-
1816
Prisma Studio is a visual editor for the data in your database. Note that Prisma Studio is not open source but you can still create issues in the [`prisma/studio`](https://github.com/prisma/studio) repo.
1917

2018
Run `npx prisma studio` in your terminal.
2119

22-
</TopBlock>
23-
2420
## Models (tables or collections)
2521

2622
When you first open Prisma Studio, you will see a data table layout with a sidebar showing a list of all models defined in your Prisma schema file.

0 commit comments

Comments
 (0)