Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7f66ae9
document `dev stop` and `dev rm` commands
nikolasburk Jun 23, 2025
17c9340
document mariadb adapter
nikolasburk Jun 24, 2025
095bec8
fix indentation issue
nikolasburk Jun 24, 2025
50df5dd
update environments
nikolasburk Jun 24, 2025
d5d1ebc
add embedded prisma studio docs
nikolasburk Jun 24, 2025
0996dc5
Merge branch 'main' into docs/6.11.0
nikolasburk Jun 24, 2025
1cd202b
Optimised images with calibre/image-actions
github-actions[bot] Jun 24, 2025
6a784fb
small changes on embedded prisma studio paghe
nikolasburk Jun 24, 2025
d23e3f3
update embedding studio docs
nikolasburk Jun 25, 2025
7e63fc8
Merge branch 'docs/6.11.0' of github.com:prisma/docs into docs/6.11.0
nikolasburk Jun 25, 2025
a38f101
minor updates for studio docs
nikolasburk Jun 25, 2025
89d031f
small changes
nikolasburk Jun 25, 2025
380bfc1
revert db limits
nikolasburk Jun 26, 2025
092ab72
Optimised images with calibre/image-actions
github-actions[bot] Jun 26, 2025
c13e860
update vercel template list
nikolasburk Jun 26, 2025
97b9d11
Merge branch 'docs/6.11.0' of github.com:prisma/docs into docs/6.11.0
nikolasburk Jun 26, 2025
cf622e5
update embedded studio to new api
nikolasburk Jun 26, 2025
3e4f2bf
update qc docs for neon and cockroach
nikolasburk Jun 26, 2025
2639e4d
update naming of d1 adapter
nikolasburk Jul 1, 2025
eafc7b2
update and comment list of new generator examples; make public with l…
nikolasburk Jul 1, 2025
cb31ce2
resolve merge conflict
nikolasburk Jul 1, 2025
716292e
fix tyops
nikolasburk Jul 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 20 additions & 22 deletions content/200-orm/050-overview/500-databases/200-database-drivers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,37 @@ Prisma Client will use the Query Engine to transform the Prisma Client query to
![Query flow from the user application to the database using Prisma Client and driver adapters](./images/drivers/qe-query-engine-adapter.png)

There are two different types of driver adapters:

- [Database driver adapters](#database-driver-adapters)
- [Serverless driver adapters](#serverless-driver-adapters)

> **Note**: Driver adapters enable [edge deployments](/orm/prisma-client/deployment/edge/overview) of applications that use Prisma ORM.

### Database driver adapters

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:
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:

- PostgreSQL
- [`pg`](/orm/overview/databases/postgresql#using-the-node-postgres-driver)
- MySQL/MariaDB
- [`mariadb`](/orm/overview/databases/mysql#using-the-mariadb-driver)
- SQLite
- [`better-sqlite3`](/orm/overview/databases/sqlite#using-the-better-sqlite3-driver)
- [`libSQL`](/orm/overview/databases/turso#how-to-connect-and-query-a-turso-database) (Turso)
- MSSQL
- MS SQL Server
- [`node-mssql`](/orm/overview/databases/sql-server#using-the-node-mssql-driver)

### Serverless driver adapters

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.

Prisma ORM maintains the following serverless driver adapters:

- [Neon](/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm-preview) (and Vercel Postgres)
- [PlanetScale](/orm/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview)
- [Cloudflare D1](/orm/overview/databases/cloudflare-d1)

### Community-maintained database driver adapters

You can also build your own driver adapter for the database you're using. The following is a list of community-maintained driver adapters:

- [TiDB Cloud Serverless Driver](https://github.com/tidbcloud/prisma-adapter)
- [PGlite - Postgres in WASM](https://github.com/lucasthevenet/pglite-utils/tree/main/packages/prisma-adapter)

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

1. Update the `previewFeatures` block in your schema to include the `driverAdapters` Preview feature:

```prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}
```
```prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}
```

2. Generate Prisma Client:

```bash
npx prisma generate
```
```terminal
npx prisma generate
```

3. Refer to the following pages to learn more about how to use the specific driver adapters with the specific database providers:

- [PostgreSQL](/orm/overview/databases/postgresql#using-the-node-postgres-driver)
- [Neon](/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm-preview)
- [PlanetScale](/orm/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview)
- [Turso](/orm/overview/databases/turso#how-to-connect-and-query-a-turso-database)
- [Cloudflare D1](/orm/overview/databases/cloudflare-d1)
- [PostgreSQL](/orm/overview/databases/postgresql#using-the-node-postgres-driver)
- [MySQL/MariaDB](/orm/overview/databases/mysql#using-the-mariadb-driver)
- [MS SQL Server](/orm/overview/databases/sql-server#using-the-node-mssql-driver)
- [Neon](/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm-preview)
- [PlanetScale](/orm/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview)
- [Turso](/orm/overview/databases/turso#how-to-connect-and-query-a-turso-database)
- [Cloudflare D1](/orm/overview/databases/cloudflare-d1)

## Notes about using driver adapters

Expand Down
58 changes: 54 additions & 4 deletions content/200-orm/050-overview/500-databases/400-mysql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ metaDescription: 'This page explains how Prisma can connect to a MySQL or MariaD
tocDepth: 3
---

<TopBlock>

The MySQL data source connector connects Prisma ORM to a [MySQL](https://www.mysql.com/) or [MariaDB](https://mariadb.org/) database server.

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.

</TopBlock>

## Example

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):
Expand All @@ -29,6 +25,60 @@ The fields passed to the `datasource` block are:
- `provider`: Specifies the `mysql` data source connector, which is used both for MySQL and MariaDB.
- `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.

## Using the `mariadb` driver

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).

For MySQL and MariaDB, [`mariadb`](https://github.com/mariadb-corporation/mariadb-connector-nodejs) is one of the most popular drivers in the JavaScript ecosystem.

This section explains how you can use it with Prisma ORM and the `@prisma/adapter-mariadb` driver adapter.

### 1. Enable the `driverAdapters` Preview feature flag

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:

```prisma file=schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
```

Once you have added the feature flag to your schema, re-generate Prisma Client:

```terminal
npx prisma generate
```

### 2. Install the dependencies

Next, install Prisma ORM's driver adapter for `mariadb`:

```terminal
npm install @prisma/adapter-mariadb
```

### 3. Instantiate Prisma Client using the driver adapter

Finally, when you instantiate Prisma Client, you need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:

```ts
import { PrismaMariaDb } from '@prisma/adapter-mariadb';
import { PrismaClient } from './generated/prisma';

const adapter = new PrismaMariaDb({
host: "localhost",
port: 3306,
connectionLimit: 5
});
const prisma = new PrismaClient({ adapter });
```

## Connection details

### Connection URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
```ts file=prisma.config.ts
import path from 'node:path'
import type { PrismaConfig } from 'prisma'
import { PrismaD1HTTP } from '@prisma/adapter-d1'
import { PrismaD1 } from '@prisma/adapter-d1'

// import your .env file
import 'dotenv/config'
Expand All @@ -117,7 +117,7 @@
// add-start
migrate: {
async adapter(env) {
return new PrismaD1HTTP({
return new PrismaD1({
CLOUDFLARE_D1_TOKEN: env.CLOUDFLARE_D1_TOKEN,
CLOUDFLARE_ACCOUNT_ID: env.CLOUDFLARE_ACCOUNT_ID,
CLOUDFLARE_DATABASE_ID: env.CLOUDFLARE_DATABASE_ID,
Expand All @@ -128,6 +128,8 @@
} satisfies PrismaConfig<Env>
```

> **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`.

Check failure on line 131 in content/200-orm/050-overview/500-databases/950-cloudflare-d1.mdx

View workflow job for this annotation

GitHub Actions / Linkspector

[linkspector] content/200-orm/050-overview/500-databases/950-cloudflare-d1.mdx#L131

Raw output
message:"Cannot reach https://github.com/prisma/prisma/releases/tag/6.11.0 Status: 404" location:{path:"content/200-orm/050-overview/500-databases/950-cloudflare-d1.mdx" range:{start:{line:131 column:19} end:{line:131 column:93}}} severity:ERROR source:{name:"linkspector" url:"https://github.com/UmbrellaDocs/linkspector"}

#### 4. Migrate your database

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

```ts
import { PrismaD1HTTP } from '@prisma/adapter-d1'
import { PrismaD1 } from '@prisma/adapter-d1'
```

:::
Expand Down
24 changes: 24 additions & 0 deletions content/200-orm/100-prisma-schema/10-overview/03-generators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,30 @@ generated/
└── models.ts
```

<!--
### Examples

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):
- [`nextjs-starter-webpack`](https://github.com/prisma/prisma-examples/tree/latest/prisma-client-generator/nextjs-starter-webpack):
- **Framework**: Next.js 15
- **Bundler**: Webpack 5
- **Runtime**: Node.js
- [`nextjs-starter-turbopack`](https://github.com/prisma/prisma-examples/tree/latest/prisma-client-generator/nextjs-starter-turbopack):
- **Framework**: Next.js 15
- **Bundler**: Turbopack (alpha)
- **Runtime**: Node.js
- [`neextjs-starter-webpack-monorepo`](https://github.com/prisma/prisma-examples/tree/latest/prisma-client-generator/neextjs-starter-webpack-monorepo):
- **Framework**: Next.js 15
- **Bundler**: Webpack 5
- **Runtime**: Node.js
- **Monorepo Package Manager**: pnpm
- [`nextjs-starter-webpack-with-middleware`](https://github.com/prisma/prisma-examples/tree/latest/prisma-client-generator/nextjs-starter-webpack-with-middleware):
- **Framework**: Next.js 15
- **Bundler**: Webpack 5
- **Runtime**: Node.js (main pages), Vercel Edge Light (middleware)
-->


## Community generators

:::note
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metaDescription: "Learn how to use Prisma ORM without Rust engines"
sidebar_class_name: preview-badge
---

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.
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.

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

Expand Down Expand Up @@ -63,11 +63,11 @@ npm install @prisma/adapter-better-sqlite3
npm install @prisma/adapter-d1
```
</TabItem>
<!-- <TabItem value="MySQL">
<TabItem value="MySQL/MariaDB">
```terminal
npm install @prisma/adapter-mysql2
npm install @prisma/adapter-mariadb
```
</TabItem> -->
</TabItem>
<TabItem value="PlanetScale">
```terminal
npm install @prisma/adapter-planetscale
Expand All @@ -78,6 +78,16 @@ npm install @prisma/adapter-planetscale
npm install @prisma/adapter-mssql
```
</TabItem>
<TabItem value="CockroachDB">
```terminal
npm install @prisma/adapter-pg
```
</TabItem>
<TabItem value="Neon Serverles">
```terminal
npm install @prisma/adapter-neon
```
</TabItem>
</TabbedContent>

### 4. Instantiate Prisma Client
Expand Down Expand Up @@ -126,20 +136,19 @@ export default {
}
```
</TabItem>
<!--
<TabItem value="MySQL">
<TabItem value="MySQL/MariaDB">
```typescript
import { PrismaMySQL2 } from '@prisma/adapter-mysql2';
import { PrismaMariaDb } from '@prisma/adapter-mariadb';
import { PrismaClient } from './generated/prisma';

const adapter = new PrismaMySQL2({
host: process.env.HOST,
user: process.env.USER,
database: process.env.DB_NAME,
})
const adapter = new PrismaMariaDb({
host: "localhost",
port: 3306,
connectionLimit: 5
});
const prisma = new PrismaClient({ adapter });
```
</TabItem> -->
</TabItem>
<TabItem value="PlanetScale">
```typescript
import { PrismaPlanetScale } from '@prisma/adapter-planetscale'
Expand Down Expand Up @@ -175,6 +184,28 @@ const adapter = new PrismaMSSQL(sqlConfig)
const prisma = new PrismaClient({ adapter });
```
</TabItem>
<TabItem value="CockroachDB">
```typescript
import { PrismaPg } from '@prisma/adapter-pg'
import { PrismaClient } from './generated/prisma'

const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })
```
</TabItem>
<TabItem value="Neon Serverless">
```typescript
import { PrismaClient } from '@prisma/client'
import { PrismaNeon } from '@prisma/adapter-neon'
import dotenv from 'dotenv'

dotenv.config()
const connectionString = `${process.env.DATABASE_URL}`

const adapter = new PrismaNeon({ connectionString })
const prisma = new PrismaClient({ adapter })
```
</TabItem>
</TabbedContent>


Expand Down
4 changes: 0 additions & 4 deletions content/200-orm/400-tools/06-prisma-studio.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ import StudioEnumSvg from '/img/studio/enum.svg';
import StudioArraySvg from '/img/studio/array.svg';
import StudioObjectSvg from '/img/studio/object.svg';

<TopBlock>

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.

Run `npx prisma studio` in your terminal.

</TopBlock>

## Models (tables or collections)

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.
Expand Down
Loading
Loading