diff --git a/apps/docs/content/docs.v6/(index)/index.mdx b/apps/docs/content/docs.v6/(index)/index.mdx
deleted file mode 100644
index 42479025ad..0000000000
--- a/apps/docs/content/docs.v6/(index)/index.mdx
+++ /dev/null
@@ -1,70 +0,0 @@
----
-title: Get Started
-description: Welcome to Prisma! Choose your path below to get started.
-url: /v6
-metaTitle: Get started with Prisma
-metaDescription: 'Build data-driven applications with ease using Prisma ORM, add connection pooling with Prisma Postgres.'
----
-
-## Prisma ORM
-
-[**Prisma ORM**](/v6/orm/overview/introduction/what-is-prisma) is an open-source ORM that provides fast, type-safe access to Postgres, MySQL, SQLite, and more databases.
-
-```npm
-npx prisma init --db
-```
-
-## Prisma Postgres
-
-[**Prisma Postgres**](/v6/postgres) is a fully managed PostgreSQL database that scales to zero, integrates with Prisma ORM and Prisma Studio.
-
-```npm
-npx create-db
-```
-
----
-
-## Quickstart
-
-The fastest way to set up **Prisma ORM** with a ready-to-use **Prisma Postgres** database.
-
-[**Start Quickstart →**](/v6/prisma-orm/quickstart/prisma-postgres)
-
----
-
-## Have Your Own Database?
-
-Set up Prisma ORM with your existing database:
-
-| Database | Guide |
-| ----------- | --------------------------------------------------------------------------- |
-| PostgreSQL | [Get started →](/v6/prisma-orm/quickstart/postgresql) |
-| MySQL | [Get started →](/v6/prisma-orm/quickstart/mysql) |
-| SQL Server | [Get started →](/v6/prisma-orm/quickstart/sql-server) |
-| SQLite | [Get started →](/v6/prisma-orm/quickstart/sqlite) |
-| MongoDB | [Get started →](/v6/prisma-orm/quickstart/mongodb) |
-| PlanetScale | [Get started →](/v6/prisma-orm/quickstart/planetscale) |
-| CockroachDB | [Get started →](/v6/prisma-orm/quickstart/cockroachdb) |
-
----
-
-## Add Prisma to Your Framework
-
-Working with a popular framework? You can easily add Prisma to your setup:
-
-| Framework | Guide |
-| -------------- | ----------------------------------------------- |
-| Next.js | [Get started →](/v6/guides/nextjs) |
-| Nuxt.js | [Get started →](/v6/guides/nuxt) |
-| Astro | [Get started →](/v6/guides/astro) |
-| SvelteKit | [Get started →](/v6/guides/sveltekit) |
-| React Router 7 | [Get started →](/v6/guides/react-router-7) |
-| TanStack Start | [Get started →](/v6/guides/tanstack-start) |
-
----
-
-## Add to Existing Project
-
-Already have a project? Add Prisma ORM to your existing application:
-
-[**Add to Existing Project →**](/v6/prisma-orm/add-to-existing-project/prisma-postgres)
diff --git a/apps/docs/content/docs.v6/(index)/meta.json b/apps/docs/content/docs.v6/(index)/meta.json
deleted file mode 100644
index 938f6a66cf..0000000000
--- a/apps/docs/content/docs.v6/(index)/meta.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "title": "Getting Started",
- "root": true,
- "defaultOpen": true,
- "pages": ["index", "prisma-orm", "prisma-postgres"]
-}
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/cockroachdb.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/cockroachdb.mdx
deleted file mode 100644
index 5fa7027aeb..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/cockroachdb.mdx
+++ /dev/null
@@ -1,241 +0,0 @@
----
-title: CockroachDB
-description: 'Add Prisma ORM to an existing TypeScript project with CockroachDB and learn database introspection, baselining, and querying.'
-url: /v6/prisma-orm/add-to-existing-project/cockroachdb
-metaTitle: How to add Prisma ORM to an existing project using CockroachDB (15 min)
-metaDescription: 'Add Prisma ORM to an existing TypeScript project with CockroachDB and learn database introspection, baselining, and querying.'
----
-
-[CockroachDB](https://www.cockroachlabs.com/) is a distributed SQL database designed for cloud applications, offering horizontal scalability, strong consistency, and high availability. In this guide, you will learn how to add Prisma ORM to an existing TypeScript project, connect it to CockroachDB, introspect your existing database schema, and start querying with type-safe Prisma Client.
-
-## Prerequisites
-
-## 1. Set up Prisma ORM
-
-Navigate to your existing project directory and install the required dependencies:
-
-```npm
-npm install prisma @types/node @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database (CockroachDB is PostgreSQL-compatible)
-- **`pg`** - The node-postgres database driver
-- **`@types/pg`** - TypeScript type definitions for node-postgres
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 2. Initialize Prisma ORM
-
-Set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider cockroachdb --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection configuration
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "cockroachdb"
-}
-```
-
-## 3. Connect your database
-
-Update the `.env` file with your CockroachDB connection URL:
-
-```bash title=".env"
-DATABASE_URL="postgresql://user:password@host:26257/mydb?sslmode=require"
-```
-
-The [format of the connection URL](/v6/orm/reference/connection-urls) for CockroachDB looks as follows:
-
-```
-postgresql://USER:PASSWORD@HOST:PORT/DATABASE?sslmode=require
-```
-
-## 4. Introspect your database
-
-Run the following command to introspect your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This command reads the `DATABASE_URL` environment variable, connects to your database, and introspects the database schema. It then translates the database schema from SQL into a data model in your Prisma schema.
-
-
-
-After introspection, your Prisma schema will contain models that represent your existing database tables.
-
-## 5. Baseline your database
-
-To use Prisma Migrate with your existing database, you need to [baseline your database](/v6/orm/prisma-migrate/getting-started).
-
-First, create a `migrations` directory:
-
-```bash
-mkdir -p prisma/migrations/0_init
-```
-
-Next, generate the migration file with `prisma migrate diff`:
-
-```npm
-npx prisma migrate diff --from-empty --to-schema prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
-```
-
-Review the generated migration file to ensure it matches your database schema.
-
-Then, mark the migration as applied:
-
-```npm
-npx prisma migrate resolve --applied 0_init
-```
-
-You now have a baseline for your current database schema.
-
-## 6. Generate Prisma ORM types
-
-Generate Prisma Client based on your introspected schema:
-
-```npm
-npx prisma generate
-```
-
-This creates a type-safe Prisma Client tailored to your database schema in the `generated/prisma` directory.
-
-## 7. Instantiate Prisma Client
-
-Create a utility file to instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPg } from "@prisma/adapter-pg";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 8. Query your database
-
-Now you can use Prisma Client to query your database. Create a `script.ts` file:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Example: Fetch all records from a table
- // Replace 'user' with your actual model name
- const allUsers = await prisma.user.findMany();
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-## 9. Evolve your schema
-
-To make changes to your database schema:
-
-### 9.1. Update your Prisma schema file
-
-Update your Prisma schema file to reflect the changes you want to make to your database schema. For example, add a new model:
-
-```prisma title="prisma/schema.prisma"
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-```
-
-### 9.2. Create and apply a migration:
-
-```npm
-npx prisma migrate dev --name your_migration_name
-```
-
-This command will:
-
-- Create a new SQL migration file
-- Apply the migration to your database
-- Regenerate Prisma Client
-
-## 10. Explore your data
-
-Explore the options suggested by [CockroachDB](https://www.cockroachlabs.com/blog/cockroachdb-gui-options/) to view and manage your data.
-
-[Prisma Studio](/v6/orm/tools/prisma-studio) does not currently support CockroachDB. Support may be added in a future release. See [Databases supported by Prisma Studio](/v6/orm/tools/prisma-studio#databases-supported-by-prisma-studio) for more information.
-
-## Next steps
-
-## More info
-
-- [CockroachDB database connector](/v6/orm/overview/databases/cockroachdb)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database introspection](/v6/orm/prisma-schema/introspection)
-- [Prisma Migrate](/v6/orm/prisma-migrate/getting-started)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/meta.json b/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/meta.json
deleted file mode 100644
index d0d0a4e667..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/meta.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "title": "Add to Existing Project",
- "pages": [
- "prisma-postgres",
- "sqlite",
- "postgresql",
- "mysql",
- "sql-server",
- "planetscale",
- "cockroachdb",
- "mongodb"
- ]
-}
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/mongodb.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/mongodb.mdx
deleted file mode 100644
index e6f9b156b6..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/mongodb.mdx
+++ /dev/null
@@ -1,322 +0,0 @@
----
-title: MongoDB
-description: Add Prisma ORM to an existing TypeScript project with MongoDB and learn database introspection and querying.
-url: /v6/prisma-orm/add-to-existing-project/mongodb
-metaTitle: How to add Prisma ORM to an existing project using MongoDB (15 min)
-metaDescription: Add Prisma ORM to an existing TypeScript project with MongoDB and learn database introspection and querying.
----
-
-[MongoDB](https://www.mongodb.com/) is a popular document-based NoSQL database known for its flexibility, scalability, and developer-friendly features. In this guide, you will learn how to add Prisma ORM to an existing TypeScript project, connect it to MongoDB, introspect your existing database schema, and start querying with type-safe Prisma Client.
-
-:::warning[MongoDB support for Prisma ORM v7]
-
-**MongoDB support for Prisma ORM v7 is coming in the near future.** In the meantime, please use **Prisma ORM v6.19** (the latest v6 release) when working with MongoDB.
-
-This guide uses Prisma ORM v6.19 to ensure full compatibility with MongoDB.
-
-:::
-
-:::tip
-
-If you're migrating to Prisma ORM from Mongoose, see our [Migrate from Mongoose guide](/v6/guides/migrate-from-mongoose).
-
-:::
-
-## Prerequisites
-
-In order to successfully complete this guide, you need:
-
-- [Node.js](https://nodejs.org/en/) installed on your machine (see [system requirements](/v6/orm/more/upgrades/to-v7#minimum-supported-nodejs--typescript-versions) for officially supported versions)
-- An existing TypeScript project with a `package.json` file
-- Access to a MongoDB 4.2+ server with a replica set deployment. We recommend using [MongoDB Atlas](https://www.mongodb.com/cloud/atlas).
-
-:::warning
-
-The MongoDB database connector uses transactions to support nested writes. Transactions **requires** a [replica set](https://www.mongodb.com/docs/manual/tutorial/deploy-replica-set/) deployment. The easiest way to deploy a replica set is with [Atlas](https://www.mongodb.com/docs/atlas/getting-started/). It's free to get started.
-
-:::
-
-Make sure you have your database [connection URL](/v6/orm/reference/connection-urls) (that includes your authentication credentials) at hand!
-
-:::note
-
-If your project contains multiple directories with `package.json` files (e.g., `frontend`, `backend`, etc.), note that Prisma ORM is specifically designed for use in the API/backend layer. To set up Prisma, navigate to the appropriate backend directory containing the relevant `package.json` file and configure Prisma there.
-
-:::
-
-## 1. Set up Prisma ORM
-
-Navigate to your existing project directory and install the required dependencies:
-
-```npm
-npm install prisma@6.19 @types/node --save-dev
-```
-
-```npm
-npm install @prisma/client@6.19 dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-:::info[Why Prisma v6.19?]
-
-This is the latest stable version of Prisma ORM v6 that fully supports MongoDB. MongoDB support for Prisma ORM v7 is coming soon.
-
-You can also install `prisma@6` and `@prisma/client@6` to automatically get the latest v6 release.
-
-:::
-
-## 2. Initialize Prisma ORM
-
-Set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider mongodb --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection configuration
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- engine: "classic",
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Add `dotenv` to `prisma.config.ts` so that Prisma can load environment variables from your `.env` file:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- engine: "classic",
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mongodb"
- url = env("DATABASE_URL")
-}
-```
-
-## 3. Connect your database
-
-Update the `.env` file with your MongoDB connection URL:
-
-```bash title=".env"
-DATABASE_URL="mongodb+srv://username:password@cluster.mongodb.net/mydb"
-```
-
-For MongoDB Atlas, the connection URL format is:
-
-```
-mongodb+srv://USERNAME:PASSWORD@CLUSTER.mongodb.net/DATABASE
-```
-
-Self-hosted MongoDB connection URL format:
-
-```
-mongodb://USERNAME:PASSWORD@HOST:PORT/DATABASE
-```
-
-Connection URL components:
-
-- **`USERNAME`**: Your database user name
-- **`PASSWORD`**: Your database user password
-- **`HOST`**: The host where [`mongod`](https://www.mongodb.com/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod) or [`mongos`](https://www.mongodb.com/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos) is running
-- **`PORT`**: The port where your database server is running (typically `27017`)
-- **`DATABASE`**: The name of your database
-
-:::tip
-
-For MongoDB Atlas, you can manually append the database name to the connection URL, as Atlas doesn't include it by default.
-
-:::
-
-### Troubleshooting connection issues
-
-#### `Error in connector: SCRAM failure: Authentication failed.`
-
-If you see the `Error in connector: SCRAM failure: Authentication failed.` error message, you can specify the source database for the authentication by [adding](https://github.com/prisma/prisma/discussions/9994#discussioncomment-1562283) `?authSource=admin` to the end of the connection string.
-
-#### `Raw query failed. Error code 8000 (AtlasError): empty database name not allowed.`
-
-If you see the `Raw query failed. Code: unknown. Message: Kind: Command failed: Error code 8000 (AtlasError): empty database name not allowed.` error message, be sure to append the database name to the database URL. You can find more info in this [GitHub issue](https://github.com/prisma/web/issues/5562).
-
-## 4. Introspect your database
-
-Run the following command to introspect your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This command:
-
-- Reads the `DATABASE_URL` from your `.env` file
-- Connects to your MongoDB database
-- Samples documents in your collections to infer the schema
-- Generates Prisma models in your `schema.prisma` file
-
-
-
-:::info
-
-**MongoDB introspection limitations:** Prisma introspects MongoDB by sampling documents. You may need to manually:
-
-- Add relation fields using the `@relation` attribute
-- Adjust field types if the sampling didn't capture all variations
-- Add indexes and constraints not detected during introspection
-
-:::
-
-## 5. Generate Prisma ORM types
-
-Generate Prisma Client based on your introspected schema:
-
-```npm
-npx prisma generate
-```
-
-This creates a type-safe Prisma Client tailored to your database schema in the `generated/prisma` directory.
-
-## 6. Instantiate Prisma Client
-
-Create a utility file to instantiate Prisma Client:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaClient } from "../generated/prisma/client";
-
-const prisma = new PrismaClient();
-
-export { prisma };
-```
-
-## 7. Query your database
-
-Now you can use Prisma Client to query your database. Create a `script.ts` file:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Example: Fetch all records from a collection
- // Replace 'user' with your actual model name
- const allUsers = await prisma.user.findMany();
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-## 8. Evolve your schema
-
-MongoDB doesn't support migrations like relational databases. Instead, use `db push` to sync schema changes:
-
-### 8.1. Update your Prisma schema file
-
-Modify your Prisma schema file with the changes you want. For example, add a new model:
-
-```prisma title="prisma/schema.prisma"
-model Post { // [!code ++]
- id String @id @default(auto()) @map("_id") @db.ObjectId // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId String @db.ObjectId // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-
-model User { // [!code ++]
- id String @id @default(auto()) @map("_id") @db.ObjectId // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-```
-
-:::info
-
-In MongoDB, the `id` field is mapped to `_id` and uses `@db.ObjectId` type. Relations use `String` type with `@db.ObjectId` annotation.
-
-:::
-
-### 8.2. Push the changes to your database
-
-```npm
-npx prisma db push
-```
-
-This command:
-
-- Applies schema changes to your MongoDB database
-- Automatically regenerates Prisma Client
-
-:::info[Why `db push` instead of migrations?]
-
-MongoDB uses a flexible schema model. Prisma Migrate (which creates migration files) is not supported for MongoDB. Always use `prisma db push` to sync your schema changes.
-
-:::
-
-## 9. Explore your data
-
-You can use [MongoDB Atlas](https://www.mongodb.com/cloud/atlas), the MongoDB shell, or MongoDB Compass to view and manage your data.
-
-[Prisma Studio](/v6/orm/tools/prisma-studio) does not currently support MongoDB. Support may be added in a future release. See [Databases supported by Prisma Studio](/v6/orm/tools/prisma-studio#databases-supported-by-prisma-studio) for more information.
-
-## Next steps
-
-## More info
-
-- [MongoDB database connector](/v6/orm/overview/databases/mongodb)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database introspection](/v6/orm/prisma-schema/introspection)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/mysql.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/mysql.mdx
deleted file mode 100644
index cf66a88ed2..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/mysql.mdx
+++ /dev/null
@@ -1,245 +0,0 @@
----
-title: MySQL
-description: 'Add Prisma ORM to an existing TypeScript project with MySQL and learn database introspection, baselining, and querying.'
-url: /v6/prisma-orm/add-to-existing-project/mysql
-metaTitle: How to add Prisma ORM to an existing project using MySQL (15 min)
-metaDescription: 'Add Prisma ORM to an existing TypeScript project with MySQL and learn database introspection, baselining, and querying.'
----
-
-[MySQL](https://www.mysql.com/) is a widely-used open-source relational database management system known for its speed, reliability, and ease of use. In this guide, you will learn how to add Prisma ORM to an existing TypeScript project, connect it to MySQL, introspect your existing database schema, and start querying with type-safe Prisma Client.
-
-## Prerequisites
-
-## 1. Set up Prisma ORM
-
-Navigate to your existing project directory and install the required dependencies:
-
-```npm
-npm install prisma @types/node --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-mariadb dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-mariadb`** - The MySQL/MariaDB driver adapter that connects Prisma Client to your database
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 2. Initialize Prisma ORM
-
-Set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider mysql --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection configuration
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mysql"
-}
-```
-
-## 3. Connect your database
-
-Update the `.env` file with your MySQL connection string details:
-
-```bash title=".env"
-DATABASE_URL="mysql://username:password@localhost:3306/mydb"
-DATABASE_USER="username" # [!code ++]
-DATABASE_PASSWORD="password" # [!code ++]
-DATABASE_NAME="mydb" # [!code ++]
-DATABASE_HOST="localhost" # [!code ++]
-DATABASE_PORT=3306 # [!code ++]
-```
-
-Replace the placeholders with your actual database credentials:
-
-- `username`: Your MySQL username
-- `password`: Your MySQL password
-- `localhost:3306`: Your MySQL host and port
-- `mydb`: Your database name
-
-## 4. Introspect your database
-
-Run the following command to introspect your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This command reads the `DATABASE_URL` environment variable, connects to your database, and introspects the database schema. It then translates the database schema from SQL into a data model in your Prisma schema.
-
-
-
-After introspection, your Prisma schema will contain models that represent your existing database tables.
-
-## 5. Baseline your database
-
-To use Prisma Migrate with your existing database, you need to [baseline your database](/v6/orm/prisma-migrate/getting-started).
-
-First, create a `migrations` directory:
-
-```bash
-mkdir -p prisma/migrations/0_init
-```
-
-Next, generate the migration file with `prisma migrate diff`:
-
-```npm
-npx prisma migrate diff --from-empty --to-schema prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
-```
-
-Review the generated migration file to ensure it matches your database schema.
-
-Then, mark the migration as applied:
-
-```npm
-npx prisma migrate resolve --applied 0_init
-```
-
-You now have a baseline for your current database schema.
-
-## 6. Generate Prisma ORM types
-
-Generate Prisma Client based on your introspected schema:
-
-```npm
-npx prisma generate
-```
-
-This creates a type-safe Prisma Client tailored to your database schema in the `generated/prisma` directory.
-
-## 7. Instantiate Prisma Client
-
-Create a utility file to instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaMariaDb } from "@prisma/adapter-mariadb";
-import { PrismaClient } from "../generated/prisma/client";
-
-const adapter = new PrismaMariaDb({
- host: process.env.DATABASE_HOST,
- user: process.env.DATABASE_USER,
- password: process.env.DATABASE_PASSWORD,
- database: process.env.DATABASE_NAME,
- connectionLimit: 5,
-});
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 8. Query your database
-
-Now you can use Prisma Client to query your database. Create a `script.ts` file:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Example: Fetch all records from a table
- // Replace 'user' with your actual model name
- const allUsers = await prisma.user.findMany();
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-## 9. Evolve your schema
-
-To make changes to your database schema:
-
-### 9.1. Update your Prisma schema file
-
-Update your Prisma schema file to reflect the changes you want to make to your database schema. For example, add a new model:
-
-```prisma title="prisma/schema.prisma"
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-```
-
-### 9.2. Create and apply a migration:
-
-```npm
-npx prisma migrate dev --name your_migration_name
-```
-
-This command will:
-
-- Create a new SQL migration file
-- Apply the migration to your database
-- Regenerate Prisma Client
-
-## 10. Explore your data with Prisma Studio
-
-## Next steps
-
-## More info
-
-- [MySQL database connector](/v6/orm/overview/databases/mysql)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database introspection](/v6/orm/prisma-schema/introspection)
-- [Prisma Migrate](/v6/orm/prisma-migrate/getting-started)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/planetscale.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/planetscale.mdx
deleted file mode 100644
index 2f1d64b491..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/planetscale.mdx
+++ /dev/null
@@ -1,223 +0,0 @@
----
-title: PlanetScale
-description: Add Prisma ORM to an existing TypeScript project with PlanetScale MySQL and learn database introspection and querying.
-url: /v6/prisma-orm/add-to-existing-project/planetscale
-metaTitle: How to add Prisma ORM to an existing project using PlanetScale MySQL (15 min)
-metaDescription: Add Prisma ORM to an existing TypeScript project with PlanetScale MySQL and learn database introspection and querying.
----
-
-[PlanetScale](https://planetscale.com) is a serverless database platform. This guide covers **PlanetScale MySQL**, which is built on Vitess and offers database branching, non-blocking schema changes, and automatic backups. In this guide, you will learn how to add Prisma ORM to an existing TypeScript project, connect it to PlanetScale MySQL, introspect your existing database schema, and start querying with type-safe Prisma Client.
-
-:::note
-
-PlanetScale also offers PostgreSQL databases. If you're using **PlanetScale PostgreSQL**, follow the [Add to existing PostgreSQL project guide](/v6/prisma-orm/add-to-existing-project/postgresql) instead.
-
-:::
-
-## Prerequisites
-
-## 1. Set up Prisma ORM
-
-Navigate to your existing project directory and install the required dependencies:
-
-```npm
-npm install prisma @types/node --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-planetscale undici dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-planetscale`** - The PlanetScale driver adapter that connects Prisma Client to your database
-- **`undici`** - A fast HTTP/1.1 client required by the PlanetScale adapter
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 2. Initialize Prisma ORM
-
-Set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider mysql --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection configuration
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mysql"
- relationMode = "prisma"
-}
-```
-
-:::info
-
-PlanetScale requires `relationMode = "prisma"` because it doesn't support foreign key constraints.
-
-:::
-
-## 3. Connect your database
-
-Update the `.env` file with your PlanetScale connection URL:
-
-```bash title=".env"
-DATABASE_URL="mysql://username:password@host.connect.psdb.cloud/mydb?sslaccept=strict"
-```
-
-You can find your connection string in the PlanetScale dashboard.
-
-## 4. Introspect your database
-
-Run the following command to introspect your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This command reads the `DATABASE_URL` environment variable, connects to your database, and introspects the database schema. It then translates the database schema from SQL into a data model in your Prisma schema.
-
-
-
-After introspection, your Prisma schema will contain models that represent your existing database tables.
-
-## 5. Generate Prisma ORM types
-
-Generate Prisma Client based on your introspected schema:
-
-```npm
-npx prisma generate
-```
-
-This creates a type-safe Prisma Client tailored to your database schema in the `generated/prisma` directory.
-
-## 6. Instantiate Prisma Client
-
-Create a utility file to instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPlanetScale } from "@prisma/adapter-planetscale";
-import { PrismaClient } from "../generated/prisma/client";
-import { fetch as undiciFetch } from "undici";
-
-const adapter = new PrismaPlanetScale({ url: process.env.DATABASE_URL, fetch: undiciFetch });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 7. Query your database
-
-Now you can use Prisma Client to query your database. Create a `script.ts` file:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Example: Fetch all records from a table
- // Replace 'user' with your actual model name
- const allUsers = await prisma.user.findMany();
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-## 8. Evolve your schema
-
-PlanetScale uses a branching workflow instead of traditional migrations. To make changes to your database schema:
-
-### 8.1. Update your Prisma schema file
-
-Update your Prisma schema file to reflect the changes you want to make to your database schema. For example, add a new model:
-
-```prisma title="prisma/schema.prisma"
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-```
-
-### 8.2. Push the changes to your development branch:
-
-```npm
-npx prisma db push
-```
-
-This command will:
-
-- Apply the schema changes to your PlanetScale database
-- Regenerate Prisma Client
-
-:::info
-
-For production deployments, use PlanetScale's [branching workflow](https://planetscale.com/docs/concepts/branching) to create deploy requests.
-
-:::
-
-## 9. Explore your data with Prisma Studio
-
-## Next steps
-
-## More info
-
-- [PlanetScale database connector](/v6/orm/overview/databases/planetscale)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database introspection](/v6/orm/prisma-schema/introspection)
-- [PlanetScale branching workflow](https://planetscale.com/docs/concepts/branching)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/postgresql.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/postgresql.mdx
deleted file mode 100644
index 15253192f5..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/postgresql.mdx
+++ /dev/null
@@ -1,237 +0,0 @@
----
-title: PostgreSQL
-description: 'Add Prisma ORM to an existing TypeScript project with PostgreSQL and learn database introspection, baselining, and querying.'
-url: /v6/prisma-orm/add-to-existing-project/postgresql
-metaTitle: How to add Prisma ORM to an existing project using PostgreSQL (15 min)
-metaDescription: 'Add Prisma ORM to an existing TypeScript project with PostgreSQL and learn database introspection, baselining, and querying.'
----
-
-[PostgreSQL](https://www.postgresql.org/) is a popular open-source relational database known for its reliability, feature robustness, and performance. In this guide, you will learn how to add Prisma ORM to an existing TypeScript project, connect it to PostgreSQL, introspect your existing database schema, and start querying with type-safe Prisma Client.
-
-## Prerequisites
-
-## 1. Set up Prisma ORM
-
-Navigate to your existing project directory and install the required dependencies:
-
-```npm
-npm install prisma @types/node @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
-- **`pg`** - The node-postgres database driver
-- **`@types/pg`** - TypeScript type definitions for node-postgres
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 2. Initialize Prisma ORM
-
-Set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider postgresql --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection configuration
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-```
-
-## 3. Connect your database
-
-Update the `.env` file with your PostgreSQL connection URL:
-
-```bash title=".env"
-DATABASE_URL="postgresql://user:password@localhost:5432/mydb?schema=public"
-```
-
-The [format of the connection URL](/v6/orm/reference/connection-urls) for PostgreSQL looks as follows:
-
-```
-postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=SCHEMA
-```
-
-## 4. Introspect your database
-
-Run the following command to introspect your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This command reads the `DATABASE_URL` environment variable, connects to your database, and introspects the database schema. It then translates the database schema from SQL into a data model in your Prisma schema.
-
-
-
-After introspection, your Prisma schema will contain models that represent your existing database tables.
-
-## 5. Baseline your database
-
-To use Prisma Migrate with your existing database, you need to [baseline your database](/v6/orm/prisma-migrate/getting-started).
-
-First, create a `migrations` directory:
-
-```bash
-mkdir -p prisma/migrations/0_init
-```
-
-Next, generate the migration file with `prisma migrate diff`:
-
-```npm
-npx prisma migrate diff --from-empty --to-schema prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
-```
-
-Review the generated migration file to ensure it matches your database schema.
-
-Then, mark the migration as applied:
-
-```npm
-npx prisma migrate resolve --applied 0_init
-```
-
-You now have a baseline for your current database schema.
-
-## 6. Generate Prisma ORM types
-
-Generate Prisma Client based on your introspected schema:
-
-```npm
-npx prisma generate
-```
-
-This creates a type-safe Prisma Client tailored to your database schema in the `generated/prisma` directory.
-
-## 7. Instantiate Prisma Client
-
-Create a utility file to instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPg } from "@prisma/adapter-pg";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 8. Query your database
-
-Now you can use Prisma Client to query your database. Create a `script.ts` file:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Example: Fetch all records from a table
- // Replace 'user' with your actual model name
- const allUsers = await prisma.user.findMany();
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-## 9. Evolve your schema
-
-To make changes to your database schema:
-
-### 9.1. Update your Prisma schema file
-
-Update your Prisma schema file to reflect the changes you want to make to your database schema. For example, add a new model:
-
-```prisma title="prisma/schema.prisma"
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-```
-
-### 9.2. Create and apply a migration:
-
-```npm
-npx prisma migrate dev --name your_migration_name
-```
-
-This command will:
-
-- Create a new SQL migration file
-- Apply the migration to your database
-- Regenerate Prisma Client
-
-## 10. Explore your data with Prisma Studio
-
-## Next steps
-
-## More info
-
-- [PostgreSQL database connector](/v6/orm/overview/databases/postgresql)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database introspection](/v6/orm/prisma-schema/introspection)
-- [Prisma Migrate](/v6/orm/prisma-migrate/getting-started)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/prisma-postgres.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/prisma-postgres.mdx
deleted file mode 100644
index 45ac3fbb55..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/prisma-postgres.mdx
+++ /dev/null
@@ -1,240 +0,0 @@
----
-title: Prisma Postgres
-description: 'Add Prisma ORM to an existing TypeScript project with Prisma Postgres and learn database introspection, baselining, and querying.'
-url: /v6/prisma-orm/add-to-existing-project/prisma-postgres
-metaTitle: How to add Prisma ORM to an existing project using Prisma Postgres (15 min)
-metaDescription: 'Add Prisma ORM to an existing TypeScript project with Prisma Postgres and learn database introspection, baselining, and querying.'
----
-
-[Prisma Postgres](/v6/postgres) is a fully managed PostgreSQL database that scales to zero and integrates smoothly with both Prisma ORM and Prisma Studio. In this guide, you will learn how to add Prisma ORM to an existing TypeScript project, connect it to Prisma Postgres, introspect your existing database schema, and start querying with type-safe Prisma Client.
-
-## Prerequisites
-
-## 1. Set up Prisma ORM
-
-Navigate to your existing project directory and install the required dependencies:
-
-```npm
-npm install prisma @types/node @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
-- **`pg`** - The node-postgres database driver
-- **`@types/pg`** - TypeScript type definitions for node-postgres
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 2. Initialize Prisma ORM
-
-Set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider postgresql --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection configuration
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-```
-
-## 3. Connect your database
-
-Update the `.env` file with your Prisma Postgres connection URL:
-
-```bash title=".env"
-DATABASE_URL="postgresql://user:password@host:5432/database?schema=public"
-```
-
-Replace the placeholder values with your actual Prisma Postgres connection details.
-
-## 4. Introspect your database
-
-Run the following command to introspect your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This command reads the `DATABASE_URL` environment variable, connects to your database, and introspects the database schema. It then translates the database schema from SQL into a data model in your Prisma schema.
-
-
-
-After introspection, your Prisma schema will contain models that represent your existing database tables.
-
-## 5. Baseline your database
-
-To use Prisma Migrate with your existing database, you need to [baseline your database](/v6/orm/prisma-migrate/getting-started).
-
-First, create a `migrations` directory:
-
-```bash
-mkdir -p prisma/migrations/0_init
-```
-
-Next, generate the migration file with `prisma migrate diff`:
-
-```npm
-npx prisma migrate diff --from-empty --to-schema prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
-```
-
-Review the generated migration file to ensure it matches your database schema.
-
-Then, mark the migration as applied:
-
-```npm
-npx prisma migrate resolve --applied 0_init
-```
-
-You now have a baseline for your current database schema.
-
-## 6. Generate Prisma ORM types
-
-Generate Prisma Client based on your introspected schema:
-
-```npm
-npx prisma generate
-```
-
-This creates a type-safe Prisma Client tailored to your database schema in the `generated/prisma` directory.
-
-## 7. Instantiate Prisma Client
-
-Create a utility file to instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPg } from "@prisma/adapter-pg";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-:::tip
-
-If you need to query your database via HTTP from an edge runtime (Cloudflare Workers, Vercel Edge Functions, etc.), use the [Prisma Postgres serverless driver](/v6/postgres/database/serverless-driver#use-with-prisma-orm).
-
-:::
-
-## 8. Query your database
-
-Now you can use Prisma Client to query your database. Create a `script.ts` file:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Example: Fetch all records from a table
- // Replace 'user' with your actual model name
- const allUsers = await prisma.user.findMany();
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-## 9. Evolve your schema
-
-To make changes to your database schema:
-
-### 9.1. Update your Prisma schema file
-
-Update your Prisma schema file to reflect the changes you want to make to your database schema. For example, add a new model:
-
-```prisma title="prisma/schema.prisma"
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-```
-
-### 9.2. Create and apply a migration:
-
-```npm
-npx prisma migrate dev --name your_migration_name
-```
-
-This command will:
-
-- Create a new SQL migration file
-- Apply the migration to your database
-- Regenerate Prisma Client
-
-## 10. Explore your data with Prisma Studio
-
-## Next steps
-
-## More info
-
-- [Prisma Postgres documentation](/v6/postgres)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database introspection](/v6/orm/prisma-schema/introspection)
-- [Prisma Migrate](/v6/orm/prisma-migrate/getting-started)
-- [Cache your queries](/v6/postgres/database/caching#setting-up-caching-in-prisma-postgres)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/sql-server.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/sql-server.mdx
deleted file mode 100644
index 57d98dd0c2..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/sql-server.mdx
+++ /dev/null
@@ -1,255 +0,0 @@
----
-title: SQL Server
-description: 'Add Prisma ORM to an existing TypeScript project with SQL Server and learn database introspection, baselining, and querying.'
-url: /v6/prisma-orm/add-to-existing-project/sql-server
-metaTitle: How to add Prisma ORM to an existing project using SQL Server (15 min)
-metaDescription: 'Add Prisma ORM to an existing TypeScript project with SQL Server and learn database introspection, baselining, and querying.'
----
-
-[SQL Server](https://www.microsoft.com/en-us/sql-server) is Microsoft's enterprise relational database management system known for its performance, security, and integration with Microsoft tools. In this guide, you will learn how to add Prisma ORM to an existing TypeScript project, connect it to SQL Server, introspect your existing database schema, and start querying with type-safe Prisma Client.
-
-## Prerequisites
-
-## 1. Set up Prisma ORM
-
-Navigate to your existing project directory and install the required dependencies:
-
-```npm
-npm install prisma @types/node @types/mssql --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-mssql dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-mssql`** - The SQL Server driver adapter that connects Prisma Client to your database
-- **`dotenv`** - Loads environment variables from your `.env` file
-- **`@types/mssql`** - TypeScript type definitions for mssql
-
-## 2. Initialize Prisma ORM
-
-Set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider sqlserver --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection configuration
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "sqlserver"
-}
-```
-
-## 3. Connect your database
-
-Update the `.env` file with your SQL Server connection string details:
-
-```bash title=".env"
-DATABASE_URL="sqlserver://localhost:1433;database=mydb;user=username;password=password;encrypt=true"
-DB_USER="username" # [!code ++]
-DB_PASSWORD="password" # [!code ++]
-DB_NAME="mydb" # [!code ++]
-HOST="localhost" # [!code ++]
-```
-
-Replace the placeholders with your actual database credentials:
-
-- `localhost:1433`: Your SQL Server host and port
-- `mydb`: Your database name
-- `username`: Your SQL Server username
-- `password`: Your SQL Server password
-
-## 4. Introspect your database
-
-Run the following command to introspect your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This command reads the `DATABASE_URL` environment variable, connects to your database, and introspects the database schema. It then translates the database schema from SQL into a data model in your Prisma schema.
-
-
-
-After introspection, your Prisma schema will contain models that represent your existing database tables.
-
-## 5. Baseline your database
-
-To use Prisma Migrate with your existing database, you need to [baseline your database](/v6/orm/prisma-migrate/getting-started).
-
-First, create a `migrations` directory:
-
-```bash
-mkdir -p prisma/migrations/0_init
-```
-
-Next, generate the migration file with `prisma migrate diff`:
-
-```npm
-npx prisma migrate diff --from-empty --to-schema prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
-```
-
-Review the generated migration file to ensure it matches your database schema.
-
-Then, mark the migration as applied:
-
-```npm
-npx prisma migrate resolve --applied 0_init
-```
-
-You now have a baseline for your current database schema.
-
-## 6. Generate Prisma ORM types
-
-Generate Prisma Client based on your introspected schema:
-
-```npm
-npx prisma generate
-```
-
-This creates a type-safe Prisma Client tailored to your database schema in the `generated/prisma` directory.
-
-## 7. Instantiate Prisma Client
-
-Create a utility file to instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaMssql } from "@prisma/adapter-mssql";
-import { PrismaClient } from "../generated/prisma/client";
-
-const sqlConfig = {
- user: process.env.DB_USER,
- password: process.env.DB_PASSWORD,
- database: process.env.DB_NAME,
- server: process.env.HOST,
- pool: {
- max: 10,
- min: 0,
- idleTimeoutMillis: 30000,
- },
- options: {
- encrypt: true, // for azure
- trustServerCertificate: false, // change to true for local dev / self-signed certs
- },
-};
-
-const adapter = new PrismaMssql(sqlConfig);
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 8. Query your database
-
-Now you can use Prisma Client to query your database. Create a `script.ts` file:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Example: Fetch all records from a table
- // Replace 'user' with your actual model name
- const allUsers = await prisma.user.findMany();
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-## 9. Evolve your schema
-
-To make changes to your database schema:
-
-### 9.1. Update your Prisma schema file
-
-Update your Prisma schema file to reflect the changes you want to make to your database schema. For example, add a new model:
-
-```prisma title="prisma/schema.prisma"
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-```
-
-### 9.2. Create and apply a migration:
-
-```npm
-npx prisma migrate dev --name your_migration_name
-```
-
-This command will:
-
-- Create a new SQL migration file
-- Apply the migration to your database
-- Regenerate Prisma Client
-
-## 10. Explore your data with Prisma Studio
-
-## Next steps
-
-## More info
-
-- [SQL Server database connector](/v6/orm/overview/databases/sql-server)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database introspection](/v6/orm/prisma-schema/introspection)
-- [Prisma Migrate](/v6/orm/prisma-migrate/getting-started)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/sqlite.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/sqlite.mdx
deleted file mode 100644
index d28f175c12..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/add-to-existing-project/sqlite.mdx
+++ /dev/null
@@ -1,283 +0,0 @@
----
-title: SQLite
-description: 'Add Prisma ORM to an existing TypeScript project with SQLite and learn database introspection, baselining, and querying.'
-url: /v6/prisma-orm/add-to-existing-project/sqlite
-metaTitle: How to add Prisma ORM to an existing project using SQLite (15 min)
-metaDescription: 'Add Prisma ORM to an existing TypeScript project with SQLite and learn database introspection, baselining, and querying.'
----
-
-[SQLite](https://sqlite.org) is a lightweight, file-based database that's perfect for development, prototyping, and small applications. It requires no setup and stores data in a local file. In this guide, you will learn how to add Prisma ORM to an existing TypeScript project, connect it to SQLite, introspect your existing database schema, and start querying with type-safe Prisma Client.
-
-## Prerequisites
-
-## 1. Set up Prisma ORM
-
-Navigate to your existing project directory and install the required dependencies:
-
-```npm
-npm install prisma @types/node @types/better-sqlite3 --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-better-sqlite3 dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-better-sqlite3`** - The SQLite driver adapter that connects Prisma Client to your database
-- **`@types/better-sqlite3`** - TypeScript type definitions for better-sqlite3
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 2. Initialize Prisma ORM
-
-Set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider sqlite --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection configuration
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "sqlite"
-}
-```
-
-A `.env` file should be created with the following value:
-
-```text title=".env"
-DATABASE_URL="file:./dev.db"
-```
-
-## 3. Connect your database
-
-Update the `.env` file to point to your existing SQLite database file:
-
-```bash title=".env"
-DATABASE_URL="file:./path/to/your/database.db"
-```
-
-## 4. Introspect your database
-
-Run the following command to introspect your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This command reads the `DATABASE_URL` environment variable, connects to your database, and introspects the database schema. It then translates the database schema from SQL into a data model in your Prisma schema.
-
-
-
-After introspection, your Prisma schema will contain models that represent your existing database tables.
-
-## 5. Baseline your database
-
-To use Prisma Migrate with your existing database, you need to [baseline your database](/v6/orm/prisma-migrate/getting-started).
-
-First, create a `migrations` directory:
-
-```bash
-mkdir -p prisma/migrations/0_init
-```
-
-Next, generate the migration file with `prisma migrate diff`:
-
-```npm
-npx prisma migrate diff --from-empty --to-schema prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
-```
-
-Review the generated migration file to ensure it matches your database schema.
-
-Then, mark the migration as applied:
-
-```npm
-npx prisma migrate resolve --applied 0_init
-```
-
-You now have a baseline for your current database schema.
-
-## 6. Generate Prisma ORM types
-
-Generate Prisma Client based on your introspected schema:
-
-```npm
-npx prisma generate
-```
-
-This creates a type-safe Prisma Client tailored to your database schema in the `generated/prisma` directory.
-
-## 7. Instantiate Prisma Client
-
-Create a utility file to instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaBetterSqlite3({ url: connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-:::tip[Using SQLite with Bun]
-Bun doesn't support the native SQLite driver that `better-sqlite3` relies on (see the [`node:sqlite` reference](https://bun.com/reference/node/sqlite)). When targeting Bun, use the `@prisma/adapter-libsql` adapter instead:
-
-```ts
-import "dotenv/config";
-import { PrismaLibSql } from "@prisma/adapter-libsql";
-import { PrismaClient } from "../generated/prisma/client";
-
-const adapter = new PrismaLibSql({
- url: process.env.DATABASE_URL ?? "",
-});
-
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-:::
-
-## 8. Query your database
-
-Now you can use Prisma Client to query your database. Create a `script.ts` file:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Example: Fetch all records from a table
- // Replace 'user' with your actual model name
- const allUsers = await prisma.user.findMany();
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-## 9. Evolve your schema
-
-To make changes to your database schema:
-
-### 9.1. Update your Prisma schema file
-
-Update your Prisma schema file to reflect the changes you want to make to your database schema. For example, add a new model:
-
-```prisma title="prisma/schema.prisma"
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-```
-
-### 9.2. Create and apply a migration:
-
-```npm
-npx prisma migrate dev --name your_migration_name
-```
-
-This command will:
-
-- Create a new SQL migration file
-- Apply the migration to your database
-- Regenerate Prisma Client
-
-## 10. Explore your data with Prisma Studio
-
-:::note[SQLite requirements for Prisma Studio]
-
-- File paths must have a `file:` protocol right now in the database url for SQLite
-- **Node.js 22.5+**: Works out of the box with the built-in `node:sqlite` module
- - May require `NODE_OPTIONS=--experimental-sqlite` environment variable
-- **Node.js 20**: Requires installing `better-sqlite3` as a dependency
- - If using pnpm 10+ with `pnpx`, you'll need the [`--allow-build=better-sqlite3`](https://pnpm.io/cli/dlx#--allow-build) flag
-- **Deno >= 2.2**: Supported via [built-in SQLite module](https://docs.deno.com/api/node/sqlite/)
-- **Bun**: Support for Prisma Studio with SQLite is coming soon and is not available yet
-
-:::
-
-:::tip[Using `npx` with `better-sqlite3`]
-
-If you don't have `node:sqlite` available in your runtime or prefer not to install `better-sqlite3` as a hard dependency (it adds ~10MB), you can use `npx` to temporarily install the required packages:
-
-```npm
-npx -p better-sqlite3 -p prisma prisma studio --url file:./path/to/your/database.db
-```
-
-This command:
-
-- Temporarily installs `better-sqlite3` without adding it to your project dependencies
-- Runs Prisma Studio with the specified SQLite database file
-- Avoids the 10MB overhead of `better-sqlite3` in your project
-
-:::
-
-## Next steps
-
-## More info
-
-- [SQLite database connector](/v6/orm/overview/databases/sqlite)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database introspection](/v6/orm/prisma-schema/introspection)
-- [Prisma Migrate](/v6/orm/prisma-migrate/getting-started)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/meta.json b/apps/docs/content/docs.v6/(index)/prisma-orm/meta.json
deleted file mode 100644
index 1ee958a0a6..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Prisma ORM",
- "defaultOpen": true,
- "pages": ["quickstart", "add-to-existing-project"]
-}
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/cockroachdb.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/cockroachdb.mdx
deleted file mode 100644
index d0550be9ab..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/cockroachdb.mdx
+++ /dev/null
@@ -1,255 +0,0 @@
----
-title: CockroachDB
-description: Create a new TypeScript project from scratch by connecting Prisma ORM to CockroachDB and generating a Prisma Client for database access.
-url: /v6/prisma-orm/quickstart/cockroachdb
-metaTitle: 'Quickstart: Prisma ORM with CockroachDB (10 min)'
-metaDescription: Create a new TypeScript project from scratch by connecting Prisma ORM to CockroachDB and generating a Prisma Client for database access.
----
-
-[CockroachDB](https://www.cockroachlabs.com) is a distributed SQL database built for cloud applications. In this guide, you will learn how to set up a new TypeScript project from scratch, connect it to CockroachDB using Prisma ORM, and generate a Prisma Client for easy, type-safe access to your database.
-
-## Prerequisites
-
-You also need:
-
-- A [CockroachDB](https://www.cockroachlabs.com/) database
-- Database connection string from CockroachDB
-
-## 1. Create a new project
-
-## 2. Install required dependencies
-
-Install the packages needed for this quickstart:
-
-```npm
-npm install prisma @types/node @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database (CockroachDB is PostgreSQL-compatible)
-- **`pg`** - The node-postgres database driver
-- **`@types/pg`** - TypeScript type definitions for node-postgres
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 3. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 4. Initialize Prisma ORM
-
-You can now invoke the Prisma CLI by prefixing it with `npx`:
-
-```npm
-npx prisma
-```
-
-Next, set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider cockroachdb --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection and schema models
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "cockroachdb"
-}
-```
-
-Update your `.env` file with your CockroachDB connection string:
-
-```text title=".env"
-DATABASE_URL="postgresql://username:password@host:26257/mydb?sslmode=require"
-```
-
-Replace with your actual CockroachDB connection string from your cluster dashboard.
-
-## 5. Define your data model
-
-Open `prisma/schema.prisma` and add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "cockroachdb"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId Int // [!code ++]
-} // [!code ++]
-```
-
-## 6. Create and apply your first migration
-
-Create your first migration to set up the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-This command creates the database tables based on your schema.
-
-Now run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 7. Instantiate Prisma Client
-
-Now that you have all the dependencies installed, you can instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPg } from "@prisma/adapter-pg";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 8. Write your first query
-
-Create a `script.ts` file to test your setup:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Create a new user with a post
- const user = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: {
- title: "Hello World",
- content: "This is my first post!",
- published: true,
- },
- },
- },
- include: {
- posts: true,
- },
- });
- console.log("Created user:", user);
-
- // Fetch all users with their posts
- const allUsers = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-You should see the created user and all users printed to the console!
-
-## 9. Explore your data
-
-Explore the options suggested by [CockroachDB](https://www.cockroachlabs.com/blog/cockroachdb-gui-options/) to view and manage your data.
-
-[Prisma Studio](/v6/orm/tools/prisma-studio) does not currently support CockroachDB. Support may be added in a future release. See [Databases supported by Prisma Studio](/v6/orm/tools/prisma-studio#databases-supported-by-prisma-studio) for more information.
-
-## Next steps
-
-## More info
-
-- [CockroachDB database connector](/v6/orm/overview/databases/cockroachdb)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/meta.json b/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/meta.json
deleted file mode 100644
index c7c3975061..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/meta.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "title": "Quickstart",
- "pages": [
- "prisma-postgres",
- "sqlite",
- "postgresql",
- "mysql",
- "sql-server",
- "planetscale",
- "cockroachdb",
- "mongodb"
- ]
-}
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/mongodb.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/mongodb.mdx
deleted file mode 100644
index 6ce4c00fda..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/mongodb.mdx
+++ /dev/null
@@ -1,311 +0,0 @@
----
-title: MongoDB
-description: Create a new TypeScript project from scratch by connecting Prisma ORM to MongoDB and generating a Prisma Client for database access.
-url: /v6/prisma-orm/quickstart/mongodb
-metaTitle: 'Quickstart: Prisma ORM with MongoDB (10 min)'
-metaDescription: Create a new TypeScript project from scratch by connecting Prisma ORM to MongoDB and generating a Prisma Client for database access.
----
-
-[MongoDB](https://www.mongodb.com) is a popular NoSQL document database. In this guide, you will learn how to set up a new TypeScript project from scratch, connect it to MongoDB using Prisma ORM, and generate a Prisma Client for easy, type-safe access to your database.
-
-:::warning[MongoDB support for Prisma ORM v7]
-
-**MongoDB support for Prisma ORM v7 is coming in the near future.** In the meantime, please use **Prisma ORM v6.19** (the latest v6 release) when working with MongoDB.
-
-This guide uses Prisma ORM v6.19 to ensure full compatibility with MongoDB.
-
-:::
-
-## Prerequisites
-
-- Node.js installed in your system [with the supported version](/v6/orm/more/upgrades/to-v7#minimum-supported-nodejs--typescript-versions)
-- A [MongoDB](https://www.mongodb.com/) database accessible via connection string
-
-## 1. Create a new project
-
-## 2. Install required dependencies
-
-Install the packages needed for this quickstart:
-
-```npm
-npm install prisma@6.19 @types/node --save-dev
-```
-
-```npm
-npm install @prisma/client@6.19 dotenv
-```
-
-:::info[Why Prisma v6.19?]
-
-This is the latest stable version of Prisma ORM v6 that fully supports MongoDB. MongoDB support for Prisma ORM v7 is coming soon.
-
-You can also install `prisma@6` and `@prisma/client@6` to automatically get the latest v6 release.
-
-:::
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db push`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-:::note
-
-MongoDB doesn't require driver adapters since Prisma ORM connects directly to MongoDB.
-
-:::
-
-## 3. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 4. Initialize Prisma ORM
-
-You can now invoke the Prisma CLI by prefixing it with `npx`:
-
-```npm
-npx prisma
-```
-
-Next, set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider mongodb --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file for your database connection and schema models
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-:::note
-
-Prisma Client will be generated in the `generated/prisma/` directory when you run `npx prisma generate` later in this guide.
-
-:::
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- engine: "classic",
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Add `dotenv` to `prisma.config.ts` so that Prisma can load environment variables from your `.env` file:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- engine: "classic",
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mongodb"
- url = env("DATABASE_URL")
-}
-```
-
-Update your `.env` file with your MongoDB connection string:
-
-```text title=".env"
-DATABASE_URL="mongodb+srv://username:password@cluster.mongodb.net/mydb"
-```
-
-:::tip
-
-Replace `username`, `password`, `cluster`, and `mydb` with your actual MongoDB credentials and database name. You can get your connection string from [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) or your MongoDB deployment.
-
-:::
-
-## 5. Define your data model
-
-Open `prisma/schema.prisma` and add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mongodb"
- url = env("DATABASE_URL")
-}
-
-model User { // [!code ++]
- id String @id @default(auto()) @map("_id") @db.ObjectId // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id String @id @default(auto()) @map("_id") @db.ObjectId // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId String @db.ObjectId // [!code ++]
-} // [!code ++]
-```
-
-## 6. Push your schema to MongoDB
-
-MongoDB doesn't support migrations like relational databases. Instead, use `db push` to sync your schema:
-
-```npm
-npx prisma db push
-```
-
-This command:
-
-- Creates the collections in MongoDB based on your schema
-- Automatically generates Prisma Client
-
-:::info
-
-Unlike relational databases, MongoDB uses a flexible schema. The `db push` command ensures your Prisma schema is reflected in your database without creating migration files.
-
-:::
-
-## 7. Instantiate Prisma Client
-
-Now that you have all the dependencies installed, you can instantiate Prisma Client:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaClient } from "../generated/prisma/client";
-
-const prisma = new PrismaClient();
-
-export { prisma };
-```
-
-## 8. Write your first query
-
-Create a `script.ts` file to test your setup:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Create a new user with a post
- const user = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: {
- title: "Hello World",
- content: "This is my first post!",
- published: true,
- },
- },
- },
- include: {
- posts: true,
- },
- });
- console.log("Created user:", user);
-
- // Fetch all users with their posts
- const allUsers = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-You should see the created user and all users printed to the console!
-
-## 9. Explore your data
-
-You can use [MongoDB Atlas](https://www.mongodb.com/cloud/atlas), the MongoDB shell, or MongoDB Compass to view and manage your data.
-
-[Prisma Studio](/v6/orm/tools/prisma-studio) does not currently support MongoDB. Support may be added in a future release. See [Databases supported by Prisma Studio](/v6/orm/tools/prisma-studio#databases-supported-by-prisma-studio) for more information.
-
-## Next steps
-
-## Troubleshooting
-
-### `Error in connector: SCRAM failure: Authentication failed.`
-
-If you see the `Error in connector: SCRAM failure: Authentication failed.` error message, you can specify the source database for the authentication by [adding](https://github.com/prisma/prisma/discussions/9994#discussioncomment-1562283) `?authSource=admin` to the end of the connection string.
-
-### `Raw query failed. Error code 8000 (AtlasError): empty database name not allowed.`
-
-If you see the `Raw query failed. Code: unknown. Message: Kind: Command failed: Error code 8000 (AtlasError): empty database name not allowed.` error message, be sure to append the database name to the database URL. You can find more info in this [GitHub issue](https://github.com/prisma/web/issues/5562).
-
-## More info
-
-- [MongoDB database connector](/v6/orm/overview/databases/mongodb)
-- [MongoDB data modeling patterns](/v6/orm/overview/databases/mongodb#type-mapping-between-mongodb-and-the-prisma-schema)
-- [MongoDB deployment considerations](/v6/orm/overview/databases/mongodb#differences-to-connectors-for-relational-databases)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/mysql.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/mysql.mdx
deleted file mode 100644
index fd99c562a8..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/mysql.mdx
+++ /dev/null
@@ -1,268 +0,0 @@
----
-title: MySQL
-description: Create a new TypeScript project from scratch by connecting Prisma ORM to MySQL and generating a Prisma Client for database access.
-url: /v6/prisma-orm/quickstart/mysql
-metaTitle: 'Quickstart: Prisma ORM with MySQL (10 min)'
-metaDescription: Create a new TypeScript project from scratch by connecting Prisma ORM to MySQL and generating a Prisma Client for database access.
----
-
-[MySQL](https://www.mysql.com) is a popular open-source relational database. In this guide, you will learn how to set up a new TypeScript project from scratch, connect it to MySQL using Prisma ORM, and generate a Prisma Client for easy, type-safe access to your database.
-
-:::note
-
-This guide also applies to **MariaDB**, which is MySQL-compatible.
-
-:::
-
-## Prerequisites
-
-You also need:
-
-- A [MySQL](https://www.mysql.com/) database server running and accessible
-- Database connection details (host, port, username, password, database name)
-
-## 1. Create a new project
-
-## 2. Install required dependencies
-
-Install the packages needed for this quickstart:
-
-```npm
-npm install prisma @types/node --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-mariadb dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-mariadb`** - The MySQL/MariaDB driver adapter that connects Prisma Client to your database
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 3. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 4. Initialize Prisma ORM
-
-You can now invoke the Prisma CLI by prefixing it with `npx`:
-
-```npm
-npx prisma
-```
-
-Next, set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider mysql --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection and schema models
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mysql"
-}
-```
-
-Update your `.env` file with your MySQL connection string details:
-
-```bash title=".env"
-DATABASE_URL="mysql://username:password@localhost:3306/mydb"
-DATABASE_USER="username" # [!code ++]
-DATABASE_PASSWORD="password" # [!code ++]
-DATABASE_NAME="mydb" # [!code ++]
-DATABASE_HOST="localhost" # [!code ++]
-DATABASE_PORT=3306 # [!code ++]
-```
-
-Replace the placeholders with your actual database credentials:
-
-- `username`: Your MySQL username
-- `password`: Your MySQL password
-- `localhost:3306`: Your MySQL host and port
-- `mydb`: Your database name
-
-## 5. Define your data model
-
-Open `prisma/schema.prisma` and add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mysql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? @db.Text // [!code ++]
- published Boolean @default(false) // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId Int // [!code ++]
-} // [!code ++]
-```
-
-## 6. Create and apply your first migration
-
-Create your first migration to set up the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-This command creates the database tables based on your schema.
-
-Now run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 7. Instantiate Prisma Client
-
-Now that you have all the dependencies installed, you can instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaMariaDb } from "@prisma/adapter-mariadb";
-import { PrismaClient } from "../generated/prisma/client";
-
-const adapter = new PrismaMariaDb({
- host: process.env.DATABASE_HOST,
- user: process.env.DATABASE_USER,
- password: process.env.DATABASE_PASSWORD,
- database: process.env.DATABASE_NAME,
- connectionLimit: 5,
-});
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 8. Write your first query
-
-Create a `script.ts` file to test your setup:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- const user = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: {
- title: "Hello World",
- content: "This is my first post!",
- published: true,
- },
- },
- },
- include: {
- posts: true,
- },
- });
- console.log("Created user:", user);
-
- // Fetch all users with their posts
- const allUsers = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-You should see the created user and all users printed to the console!
-
-## 9. Explore your data with Prisma Studio
-
-## Next steps
-
-## More info
-
-- [MySQL database connector](/v6/orm/overview/databases/mysql)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/planetscale.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/planetscale.mdx
deleted file mode 100644
index fbdf42e1a1..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/planetscale.mdx
+++ /dev/null
@@ -1,292 +0,0 @@
----
-title: PlanetScale
-description: Create a new TypeScript project from scratch by connecting Prisma ORM to PlanetScale MySQL and generating a Prisma Client for database access.
-url: /v6/prisma-orm/quickstart/planetscale
-metaTitle: 'Quickstart: Prisma ORM with PlanetScale MySQL (10 min)'
-metaDescription: Create a new TypeScript project from scratch by connecting Prisma ORM to PlanetScale MySQL and generating a Prisma Client for database access.
----
-
-[PlanetScale](https://planetscale.com) is a serverless database platform. This guide covers **PlanetScale MySQL**. In this guide, you will learn how to set up a new TypeScript project from scratch, connect it to PlanetScale MySQL using Prisma ORM, and generate a Prisma Client for easy, type-safe access to your database.
-
-:::note
-
-PlanetScale also offers PostgreSQL databases. If you're using **PlanetScale PostgreSQL**, follow the [PostgreSQL quickstart guide](/v6/prisma-orm/quickstart/postgresql) instead.
-
-:::
-
-## Prerequisites
-
-You also need:
-
-- A [PlanetScale](https://planetscale.com) database
-- Database connection string from PlanetScale
-
-## 1. Create a new project
-
-## 2. Install required dependencies
-
-Install the packages needed for this quickstart:
-
-```npm
-npm install prisma @types/node --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-planetscale undici dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-planetscale`** - The PlanetScale driver adapter that connects Prisma Client to your database
-- **`undici`** - A fast HTTP/1.1 client required by the PlanetScale adapter
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 3. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 4. Initialize Prisma ORM
-
-You can now invoke the Prisma CLI by prefixing it with `npx`:
-
-```npm
-npx prisma
-```
-
-Next, set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider mysql --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection and schema models
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mysql"
-}
-```
-
-Update your schema to include `relationMode = "prisma"` for PlanetScale:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mysql"
- relationMode = "prisma"
-}
-```
-
-Update your `.env` file with your PlanetScale connection string:
-
-```text title=".env"
-DATABASE_URL="mysql://username:password@host.connect.psdb.cloud/mydb?sslaccept=strict"
-```
-
-Replace with your actual PlanetScale connection string from your database dashboard.
-
-## 5. Define your data model
-
-Open `prisma/schema.prisma` and add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mysql"
- relationMode = "prisma"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? @db.Text // [!code ++]
- published Boolean @default(false) // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId Int // [!code ++]
-
- @@index([authorId]) // [!code ++]
-} // [!code ++]
-```
-
-:::note
-
-Note the `@@index([authorId])` on the `Post` model. PlanetScale requires indexes on foreign keys when using `relationMode = "prisma"`.
-
-:::
-
-## 6. Push your schema to PlanetScale
-
-PlanetScale uses a branching workflow instead of traditional migrations. Push your schema directly:
-
-```npm
-npx prisma db push
-```
-
-This command creates the database tables based on your schema.
-
-Now run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 7. Instantiate Prisma Client
-
-Now that you have all the dependencies installed, you can instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPlanetScale } from "@prisma/adapter-planetscale";
-import { PrismaClient } from "../generated/prisma/client";
-import { fetch as undiciFetch } from "undici";
-
-const adapter = new PrismaPlanetScale({ url: process.env.DATABASE_URL, fetch: undiciFetch });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 8. Write your first query
-
-Create a `script.ts` file to test your setup:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Create a new user with a post
- const user = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: {
- title: "Hello World",
- content: "This is my first post!",
- published: true,
- },
- },
- },
- include: {
- posts: true,
- },
- });
- console.log("Created user:", user);
-
- // Fetch all users with their posts
- const allUsers = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-You should see the created user and all users printed to the console!
-
-## 9. Explore your data with Prisma Studio
-
-Prisma Studio is a visual editor for your database. Launch it with:
-
-```shell
-npx prisma studio
-```
-
-This opens a web interface where you can view and edit your data.
-
-:::info[Supported databases]
-
-Prisma Studio currently supports PostgreSQL, MySQL, and SQLite. For more details, see [Databases supported by Prisma Studio](/studio#supported-databases).
-
-:::
-
-## Next steps
-
-## More info
-
-- [PlanetScale database connector](/v6/orm/overview/databases/planetscale)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/postgresql.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/postgresql.mdx
deleted file mode 100644
index 4a4e5d81b3..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/postgresql.mdx
+++ /dev/null
@@ -1,270 +0,0 @@
----
-title: PostgreSQL
-description: Create a new TypeScript project from scratch by connecting Prisma ORM to PostgreSQL and generating a Prisma Client for database access.
-url: /v6/prisma-orm/quickstart/postgresql
-metaTitle: 'Quickstart: Prisma ORM with PostgreSQL (10 min)'
-metaDescription: Create a new TypeScript project from scratch by connecting Prisma ORM to PostgreSQL and generating a Prisma Client for database access.
----
-
-[PostgreSQL](https://www.postgresql.org) is a powerful, open-source relational database. In this guide, you will learn how to set up a new TypeScript project from scratch, connect it to PostgreSQL using Prisma ORM, and generate a Prisma Client for easy, type-safe access to your database.
-
-## Prerequisites
-
-You also need:
-
-- A [PostgreSQL](https://www.postgresql.org/) database server running and accessible
-- Database connection details (host, port, username, password, database name)
-
-:::tip[Need a PostgreSQL database?]
-
-If you don't already have a PostgreSQL database, follow the quickstart to set up a production-ready [Prisma Postgres](/v6/prisma-orm/quickstart/prisma-postgres) database with Prisma ORM in a new project.
-
-:::
-
-## 1. Create a new project
-
-## 2. Install required dependencies
-
-Install the packages needed for this quickstart:
-
-```npm
-npm install prisma @types/node @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
-- **`pg`** - The node-postgres database driver
-- **`@types/pg`** - TypeScript type definitions for node-postgres
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 3. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 4. Initialize Prisma ORM
-
-You can now invoke the Prisma CLI by prefixing it with `npx`:
-
-```npm
-npx prisma
-```
-
-Next, set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider postgresql --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection and schema models
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-```
-
-Update your `.env` file with your PostgreSQL connection string:
-
-```text title=".env"
-DATABASE_URL="postgresql://username:password@localhost:5432/mydb?schema=public"
-```
-
-Replace the placeholders with your actual database credentials:
-
-- `username`: Your PostgreSQL username
-- `password`: Your PostgreSQL password
-- `localhost:5432`: Your PostgreSQL host and port
-- `mydb`: Your database name
-
-## 5. Define your data model
-
-Open `prisma/schema.prisma` and add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId Int // [!code ++]
-} // [!code ++]
-```
-
-## 6. Create and apply your first migration
-
-Create your first migration to set up the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-This command creates the database tables based on your schema.
-
-Now run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 7. Instantiate Prisma Client
-
-Now that you have all the dependencies installed, you can instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPg } from "@prisma/adapter-pg";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 8. Write your first query
-
-Create a `script.ts` file to test your setup:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Create a new user with a post
- const user = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: {
- title: "Hello World",
- content: "This is my first post!",
- published: true,
- },
- },
- },
- include: {
- posts: true,
- },
- });
- console.log("Created user:", user);
-
- // Fetch all users with their posts
- const allUsers = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-You should see the created user and all users printed to the console!
-
-## 9. Explore your data with Prisma Studio
-
-## Next steps
-
-You've successfully set up Prisma ORM. Here's what you can explore next:
-
-- **Learn more about Prisma Client**: Explore the [Prisma Client API](/orm/prisma-client/setup-and-configuration/introduction) for advanced querying, filtering, and relations
-- **Database migrations**: Learn about [Prisma Migrate](/orm/prisma-migrate) for evolving your database schema
-- **Performance optimization**: Discover [query optimization techniques](/orm/prisma-client/queries/advanced/query-optimization-performance)
-- **Build a full application**: Check out our [framework guides](/guides) to integrate Prisma ORM with Next.js, Express, and more
-- **Join the community**: Connect with other developers on [Discord](https://pris.ly/discord)
-
-## More info
-
-- [PostgreSQL database connector](/v6/orm/overview/databases/postgresql)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/prisma-postgres.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/prisma-postgres.mdx
deleted file mode 100644
index d7009d7758..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/prisma-postgres.mdx
+++ /dev/null
@@ -1,252 +0,0 @@
----
-title: Prisma Postgres
-description: Create a new TypeScript project from scratch by connecting Prisma ORM to Prisma Postgres and generating a Prisma Client for database access.
-url: /v6/prisma-orm/quickstart/prisma-postgres
-metaTitle: 'Quickstart: Prisma ORM with Prisma Postgres (5 min)'
-metaDescription: Create a new TypeScript project from scratch by connecting Prisma ORM to Prisma Postgres and generating a Prisma Client for database access.
----
-
-[Prisma Postgres](/v6/postgres) is a fully managed PostgreSQL database that scales to zero and integrates smoothly with both Prisma ORM and Prisma Studio. In this guide, you will learn how to set up a new TypeScript project from scratch, connect it to Prisma Postgres using Prisma ORM, and generate a Prisma Client for easy, type-safe access to your database.
-
-## Prerequisites
-
-## 1. Create a new project
-
-## 2. Install required dependencies
-
-Install the packages needed for this quickstart:
-
-```npm
-npm install prisma @types/node @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
-- **`pg`** - The node-postgres database driver
-- **`@types/pg`** - TypeScript type definitions for node-postgres
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 3. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 4. Initialize Prisma ORM and create a Prisma Postgres database
-
-You can now invoke the Prisma CLI by prefixing it with `npx`:
-
-```npm
-npx prisma
-```
-
-Next, set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --db --output ../generated/prisma
-```
-
-:::info
-
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database.
-
-:::
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection and schema models
-- Creates a new Prisma Postgres database (when using `--db` flag)
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-```
-
-## 5. Define your data model
-
-Open `prisma/schema.prisma` and add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId Int // [!code ++]
-} // [!code ++]
-```
-
-## 6. Create and apply your first migration
-
-Create your first migration to set up the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-This command creates the database tables based on your schema.
-
-Now run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 7. Instantiate Prisma Client
-
-Now that you have all the dependencies installed, you can instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPg } from "@prisma/adapter-pg";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-:::tip
-
-If you need to query your database via HTTP from an edge runtime (Cloudflare Workers, Vercel Edge Functions, etc.), use the [Prisma Postgres serverless driver](/v6/postgres/database/serverless-driver#use-with-prisma-orm).
-
-:::
-
-## 8. Write your first query
-
-Create a `script.ts` file to test your setup:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Create a new user with a post
- const user = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: {
- title: "Hello World",
- content: "This is my first post!",
- published: true,
- },
- },
- },
- include: {
- posts: true,
- },
- });
- console.log("Created user:", user);
-
- // Fetch all users with their posts
- const allUsers = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-You should see the created user and all users printed to the console!
-
-## 9. Explore your data with Prisma Studio
-
-## Next steps
-
-## More info
-
-- [Prisma Postgres documentation](/v6/postgres)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections)
-- [Cache your queries](/v6/postgres/database/caching#setting-up-caching-in-prisma-postgres)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/sql-server.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/sql-server.mdx
deleted file mode 100644
index 036a7c3f8d..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/sql-server.mdx
+++ /dev/null
@@ -1,275 +0,0 @@
----
-title: SQL Server
-description: Create a new TypeScript project from scratch by connecting Prisma ORM to SQL Server and generating a Prisma Client for database access.
-url: /v6/prisma-orm/quickstart/sql-server
-metaTitle: 'Quickstart: Prisma ORM with SQL Server (10 min)'
-metaDescription: Create a new TypeScript project from scratch by connecting Prisma ORM to SQL Server and generating a Prisma Client for database access.
----
-
-[Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server) is an enterprise-grade relational database. In this guide, you will learn how to set up a new TypeScript project from scratch, connect it to SQL Server using Prisma ORM, and generate a Prisma Client for easy, type-safe access to your database.
-
-## Prerequisites
-
-You also need:
-
-- A [Microsoft SQL Server](https://learn.microsoft.com/en-us/sql/?view=sql-server-ver16) database
- - [Microsoft SQL Server on Linux for Docker](/v6/orm/overview/databases/sql-server/sql-server-docker)
- - [Microsoft SQL Server on Windows (local)](/v6/orm/overview/databases/sql-server/sql-server-local)
-- Database connection details (host, port, username, password, database name)
-
-## 1. Create a new project
-
-## 2. Install required dependencies
-
-Install the packages needed for this quickstart:
-
-```npm
-npm install prisma @types/node @types/mssql --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-mssql dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-mssql`** - The SQL Server driver adapter that connects Prisma Client to your database
-- **`@types/mssql`** - TypeScript type definitions for mssql
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 3. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 4. Initialize Prisma ORM
-
-You can now invoke the Prisma CLI by prefixing it with `npx`:
-
-```npm
-npx prisma
-```
-
-Next, set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider sqlserver --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection and schema models
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "sqlserver"
-}
-```
-
-Update your `.env` file with your SQL Server connection string details:
-
-```bash title=".env"
-DATABASE_URL="sqlserver://localhost:1433;database=mydb;user=username;password=password;encrypt=true"
-DB_USER="username" # [!code ++]
-DB_PASSWORD="password" # [!code ++]
-DB_NAME="mydb" # [!code ++]
-HOST="localhost" # [!code ++]
-```
-
-Replace the placeholders with your actual database credentials:
-
-- `localhost:1433`: Your SQL Server host and port
-- `mydb`: Your database name
-- `username`: Your SQL Server username
-- `password`: Your SQL Server password
-
-## 5. Define your data model
-
-Open `prisma/schema.prisma` and add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "sqlserver"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId Int // [!code ++]
-} // [!code ++]
-```
-
-## 6. Create and apply your first migration
-
-Create your first migration to set up the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-This command creates the database tables based on your schema.
-
-Now run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 7. Instantiate Prisma Client
-
-Now that you have all the dependencies installed, you can instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaMssql } from "@prisma/adapter-mssql";
-import { PrismaClient } from "../generated/prisma/client";
-
-const sqlConfig = {
- user: process.env.DB_USER,
- password: process.env.DB_PASSWORD,
- database: process.env.DB_NAME,
- server: process.env.HOST,
- pool: {
- max: 10,
- min: 0,
- idleTimeoutMillis: 30000,
- },
- options: {
- encrypt: true, // for azure
- trustServerCertificate: false, // change to true for local dev / self-signed certs
- },
-};
-
-const adapter = new PrismaMssql(sqlConfig);
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-## 8. Write your first query
-
-Create a `script.ts` file to test your setup:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Create a new user with a post
- const user = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: {
- title: "Hello World",
- content: "This is my first post!",
- published: true,
- },
- },
- },
- include: {
- posts: true,
- },
- });
- console.log("Created user:", user);
-
- // Fetch all users with their posts
- const allUsers = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-You should see the created user and all users printed to the console!
-
-## 9. Explore your data with Prisma Studio
-
-## Next steps
-
-## More info
-
-- [SQL Server database connector](/v6/orm/overview/databases/sql-server)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/sqlite.mdx b/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/sqlite.mdx
deleted file mode 100644
index 263ef82b41..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-orm/quickstart/sqlite.mdx
+++ /dev/null
@@ -1,296 +0,0 @@
----
-title: SQLite
-description: Create a new TypeScript project from scratch by connecting Prisma ORM to SQLite and generating a Prisma Client for database access.
-url: /v6/prisma-orm/quickstart/sqlite
-metaTitle: 'Quickstart: Prisma ORM with SQLite (5 min)'
-metaDescription: Create a new TypeScript project from scratch by connecting Prisma ORM to SQLite and generating a Prisma Client for database access.
----
-
-[SQLite](https://sqlite.org) is a lightweight, file-based database that's perfect for development, prototyping, and small applications. It requires no setup and stores data in a local file.
-
-In this guide, you will learn how to set up a new TypeScript project from scratch, connect it to SQLite using Prisma ORM, and generate a Prisma Client for easy, type-safe access to your database.
-
-## Prerequisites
-
-## 1. Create a new project
-
-## 2. Install required dependencies
-
-Install the packages needed for this quickstart:
-
-```npm
-npm install prisma @types/node @types/better-sqlite3 -D
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-better-sqlite3 dotenv
-```
-
-:::note[pnpm users with SQLite]
-If using pnpm 10+ with `pnpx`, you'll need the [`--allow-build=better-sqlite3`](https://pnpm.io/cli/dlx#--allow-build) flag when running Prisma Studio due to SQLite's native dependency requirements.
-:::
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-better-sqlite3`** - The SQLite driver adapter that connects Prisma Client to your database
-- **`@types/better-sqlite3`** - TypeScript type definitions for better-sqlite3
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 3. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 4. Initialize Prisma ORM
-
-You can now invoke the Prisma CLI by prefixing it with `npx`:
-
-```npm
-npx prisma
-```
-
-Next, set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --datasource-provider sqlite --output ../generated/prisma
-```
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection and schema models
-- Creates a `.env` file in the root directory for environment variables
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "sqlite"
-}
-```
-
-A `.env` file should be created with the following value:
-
-```text title=".env"
-DATABASE_URL="file:./dev.db"
-```
-
-## 5. Define your data model
-
-Open `prisma/schema.prisma` and add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "sqlite"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId Int // [!code ++]
-} // [!code ++]
-```
-
-## 6. Create and apply your first migration
-
-Create your first migration to set up the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-This command creates the database tables based on your schema.
-
-Now run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 7. Instantiate Prisma Client
-
-Now that you have all the dependencies installed, you can instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaBetterSqlite3({ url: connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-:::tip[Using SQLite with Bun]
-When targeting Bun, use the `@prisma/adapter-libsql` adapter instead of `@prisma/adapter-better-sqlite3`. Bun doesn’t support the native SQLite driver that `better-sqlite3` relies on (see the [`node:sqlite` reference](https://bun.com/reference/node/sqlite)). Instantiate Prisma Client like so:
-
-```ts
-import "dotenv/config";
-import { PrismaLibSql } from "@prisma/adapter-libsql";
-import { PrismaClient } from "../generated/prisma/client";
-
-const adapter = new PrismaLibSql({
- url: process.env.DATABASE_URL ?? "",
-});
-
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-:::
-
-## 8. Write your first query
-
-Create a `script.ts` file to test your setup:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Create a new user with a post
- const user = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: {
- title: "Hello World",
- content: "This is my first post!",
- published: true,
- },
- },
- },
- include: {
- posts: true,
- },
- });
- console.log("Created user:", user);
-
- // Fetch all users with their posts
- const allUsers = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-You should see the created user and all users printed to the console!
-
-## 9. Explore your data with Prisma Studio
-
-:::note[SQLite requirements for Prisma Studio]
-
-- File paths must have a `file:` protocol right now in the database url for SQLite
-- **Node.js 22.5+**: Works out of the box with the built-in `node:sqlite` module
- - May require `NODE_OPTIONS=--experimental-sqlite` environment variable
-- **Node.js 20**: Requires installing `better-sqlite3` as a dependency
- - If using pnpm 10+ with `pnpx`, you'll need the [`--allow-build=better-sqlite3`](https://pnpm.io/cli/dlx#--allow-build) flag
-- **Deno >= 2.2**: Supported via [built-in SQLite module](https://docs.deno.com/api/node/sqlite/)
-- **Bun**: Support for Prisma Studio with SQLite is coming soon and is not available yet
-
-:::
-
-:::tip[Using `npx` with `better-sqlite3`]
-
-If you don't have `node:sqlite` available in your runtime or prefer not to install `better-sqlite3` as a hard dependency (it adds ~10MB), you can use `npx` to temporarily install the required packages:
-
-```npm
-npx -p better-sqlite3 -p prisma prisma studio --url file:./dev.db
-```
-
-This command:
-
-- Temporarily installs `better-sqlite3` without adding it to your project dependencies
-- Runs Prisma Studio with the specified SQLite database file
-- Avoids the 10MB overhead of `better-sqlite3` in your project
-
-:::
-
-## Next steps
-
-## More info
-
-- [SQLite database connector](/v6/orm/overview/databases/sqlite)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/from-the-cli.mdx b/apps/docs/content/docs.v6/(index)/prisma-postgres/from-the-cli.mdx
deleted file mode 100644
index d12d9d8a13..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/from-the-cli.mdx
+++ /dev/null
@@ -1,524 +0,0 @@
----
-title: From the CLI
-description: Start building a Prisma application with a Prisma Postgres database from the CLI
-url: /v6/prisma-postgres/from-the-cli
-metaTitle: From the CLI
-metaDescription: Start building a Prisma application with a Prisma Postgres database from the CLI
----
-
-This page provides a step-by-step guide for Prisma Postgres after setting it up with `prisma init --db`:
-
-1. Set up a TypeScript app with Prisma ORM
-1. Migrate the schema of your database
-1. Query your database from TypeScript
-
-## Prerequisites
-
-This guide assumes you set up [Prisma Postgres](/v6/postgres) instance with `prisma init --db`:
-
-```npm
-npx prisma@latest init --db
-```
-
-```text no-copy wrap
-✓ Select an authentication method Google
-Authenticating to Prisma Platform via browser.
-
-Visit the following URL in your browser to authenticate:
-https://console.prisma.io/auth/cli?state=eyJjb6ll...
-
-Successfully authenticated as jon@doe.com.
-Let's set up your Prisma Postgres database!
-✓ Select your region: ap-southeast-1 - Asia Pacific (Singapore)
-✓ Enter a project name: My Prisma Project
-✓ Success! Your Prisma Postgres database is ready ✅
-
-We found an existing schema.prisma file in your current project directory.
-
---- Database URL ---
-
-Connect Prisma ORM to your Prisma Postgres database with this URL:
-
---- Next steps ---
-
-Go to https://pris.ly/ppg-init for detailed instructions.
-
-1. Install the Postgres adapter
-npm install @prisma/adapter-pg
-
-...and add it to your Prisma Client instance:
-
-import { PrismaClient } from "./generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
-
-2. Apply migrations
-Run the following command to create and apply a migration:
-npx prisma migrate dev
-
-3. Manage your data
-View and edit your data locally by running this command:
-npx prisma studio
-
-...or online in Console:
-https://console.prisma.io/$path
-
-4. Send queries from your app
-If you already have an existing app with Prisma ORM, you can now run it and it will send queries against your newly created Prisma Postgres instance.
-
-5. Learn more
-For more info, visit the Prisma Postgres docs: https://pris.ly/ppg-docs
-```
-
-Once this command terminated:
-
-- You're logged into Prisma Data Platform.
-- A new Prisma Postgres instance was created.
-- The `prisma/` folder was created with an empty `schema.prisma` file.
-- The `DATABASE_URL` env var was set in a `.env` file.
-- The `prisma.config.ts` file was created with the default configuration.
-
-## 1. Organize your project directory
-
-:::note
-
-If you ran the `prisma init --db` command inside a folder where you want your project to live, you can skip this step and [proceed to the next section](/v6/prisma-postgres/from-the-cli#2-set-up-your-project).
-
-:::
-
-If you ran the command outside your intended project directory (e.g., in your home folder or another location), you need to move the generated `prisma` folder and the `.env` file into a dedicated project directory.
-
-Create a new folder (e.g. `hello-prisma`) where you want your project to live and move the necessary files into it:
-
-```bash
-mkdir hello-prisma
-mv .env ./hello-prisma/
-mv prisma ./hello-prisma/
-```
-
-Navigate into your project folder:
-
-```bash
-cd ./hello-prisma
-```
-
-Now that your project is in the correct location, continue with the setup.
-
-## 2. Set up your project
-
-### 2.1. Set up TypeScript
-
-Initialize a TypeScript project and add the Prisma CLI as a development dependency:
-
-```npm
-npm init -y
-```
-
-```npm
-npm install typescript tsx @types/node @types/pg -D
-```
-
-This creates a `package.json` file with an initial setup for your TypeScript app.
-
-Next, initialize TypeScript with a `tsconfig.json` file in the project:
-
-```npm
-npx tsc --init
-```
-
-### 2.2. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-### 2.3. Set up Prisma ORM
-
-Install the required dependencies to use Prisma Postgres:
-
-```npm
-npm install prisma --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma migrate` and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
-- **`pg`** - The node-postgres database driver
-- **`@types/pg`** - TypeScript type definitions for node-postgres
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-### 2.4. Review the generated prisma.config.ts
-
-The `prisma init --db` command automatically created a `prisma.config.ts` file that looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.5. Create a script to query the database
-
-Create an `index.ts` file in the root directory, this will be used to query your application with Prisma ORM:
-
-```bash
-touch index.ts
-```
-
-## 3. Migrate the database schema
-
-Update your `prisma/schema.prisma` file to include the `User` and `Post` models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User {
- id Int @id @default(autoincrement())
- email String @unique
- name String?
- posts Post[]
-}
-
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean @default(false)
- author User @relation(fields: [authorId], references: [id])
- authorId Int
-}
-```
-
-After adding the models, migrate your database using [Prisma Migrate](/v6/orm/prisma-migrate/getting-started):
-
-```npm
-npx prisma migrate dev --name init
-```
-
-This command creates the database tables based on your schema.
-
-Now run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 4. Send queries with Prisma ORM
-
-### 4.1. Instantiate Prisma Client
-
-Create a `lib/prisma.ts` file to instantiate Prisma Client with the driver adapter:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPg } from "@prisma/adapter-pg";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-:::tip
-
-If you need to query your database via HTTP from an edge runtime (Cloudflare Workers, Vercel Edge Functions, etc.), use the [Prisma Postgres serverless driver](/v6/postgres/database/serverless-driver#use-with-prisma-orm).
-
-:::
-
-### 4.2. Write your first query
-
-Paste the following boilerplate into `index.ts`:
-
-```ts title="index.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // ... you will write your Prisma ORM queries here
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-This code contains a `main` function that's invoked at the end of the script. It also instantiates `PrismaClient` which you'll use to send queries to your database.
-
-### 4.3. Create a new `User` record
-
-Let's start with a small query to create a new `User` record in the database and log the resulting object to the console. Add the following code to your `index.ts` file:
-
-```ts title="index.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- const user = await prisma.user.create({
- // [!code ++]
- data: {
- // [!code ++]
- name: "Alice", // [!code ++]
- email: "alice@prisma.io", // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- console.log(user); // [!code ++]
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Next, execute the script with the following command:
-
-```npm
-npx tsx index.ts
-```
-
-```text no-copy
-{ id: 1, email: 'alice@prisma.io', name: 'Alice' }
-```
-
-Great job, you just created your first database record with Prisma Postgres! 🎉
-
-### 4.4. Retrieve all `User` records
-
-Prisma ORM offers various queries to read data from your database. In this section, you'll use the `findMany` query that returns _all_ the records in the database for a given model.
-
-Delete the previous Prisma ORM query and add the new `findMany` query instead:
-
-```ts title="index.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- const users = await prisma.user.findMany(); // [!code ++]
- console.log(users); // [!code ++]
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Execute the script again:
-
-```npm
-npx tsx index.ts
-```
-
-```text no-copy
-[{ id: 1, email: 'alice@prisma.io', name: 'Alice' }]
-```
-
-Notice how the single `User` object is now enclosed with square brackets in the console. That's because the `findMany` returned an array with a single object inside.
-
-### 4.5. Explore relation queries
-
-One of the main features of Prisma ORM is the ease of working with [relations](/v6/orm/prisma-schema/data-model/relations). In this section, you'll learn how to create a `User` and a `Post` record in a nested write query. Afterwards, you'll see how you can retrieve the relation from the database using the `include` option.
-
-First, adjust your script to include the nested query:
-
-```ts title="index.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- const user = await prisma.user.create({
- // [!code ++]
- data: {
- // [!code ++]
- name: "Bob", // [!code ++]
- email: "bob@prisma.io", // [!code ++]
- posts: {
- // [!code ++]
- create: [
- // [!code ++]
- {
- // [!code ++]
- title: "Hello World", // [!code ++]
- published: true, // [!code ++]
- }, // [!code ++]
- {
- // [!code ++]
- title: "My second post", // [!code ++]
- content: "This is still a draft", // [!code ++]
- }, // [!code ++]
- ], // [!code ++]
- }, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- console.log(user); // [!code ++]
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the query by executing the script again:
-
-```npm
-npx tsx index.ts
-```
-
-```text no-copy
-{ id: 2, email: 'bob@prisma.io', name: 'Bob' }
-```
-
-In order to also retrieve the `Post` records that belong to a `User`, you can use the `include` option via the `posts` relation field:
-
-```ts title="index.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- const usersWithPosts = await prisma.user.findMany({
- // [!code ++]
- include: {
- // [!code ++]
- posts: true, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- console.dir(usersWithPosts, { depth: null }); // [!code ++]
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script again to see the results of the nested read query:
-
-```npm
-npx tsx index.ts
-```
-
-```text no-copy
-[
- { id: 1, email: 'alice@prisma.io', name: 'Alice', posts: [] },
- {
- id: 2,
- email: 'bob@prisma.io',
- name: 'Bob',
- posts: [
- {
- id: 1,
- title: 'Hello World',
- content: null,
- published: true,
- authorId: 2
- },
- {
- id: 2,
- title: 'My second post',
- content: 'This is still a draft',
- published: false,
- authorId: 2
- }
- ]
- }
-]
-```
-
-This time, you're seeing two `User` objects being printed. Both of them have a `posts` field (which is empty for `"Alice"` and populated with two `Post` objects for `"Bob"`) that represents the `Post` records associated with them.
-
-## Next steps
-
-You just got your feet wet with a basic Prisma Postgres setup. If you want to explore more complex queries, such as [adding caching functionality](/v6/postgres/database/caching#setting-up-caching-in-prisma-postgres), check out the official [Quickstart](/v6/prisma-orm/quickstart/prisma-postgres).
-
-### View and edit data in Prisma Studio
-
-Prisma ORM comes with a built-in GUI to view and edit the data in your database. You can open it using the following command:
-
-```npm
-npx prisma studio --config ./prisma.config.ts
-```
-
-With Prisma Postgres, you can also directly use Prisma Studio inside the [Console](https://console.prisma.io) by selecting the **Studio** tab in your project.
-
-### Build a fullstack app with Next.js
-
-Learn how to use Prisma Postgres in a fullstack app:
-
-- [Build a fullstack app with Next.js 15](/v6/guides/nextjs)
-- [Next.js 15 example app](https://github.com/prisma/nextjs-prisma-postgres-demo) (including authentication)
-
-### Explore ready-to-run examples
-
-Check out the [`prisma-examples`](https://github.com/prisma/prisma-examples/) repository on GitHub to see how Prisma ORM can be used with your favorite library. The repo contains examples with Express, NestJS, GraphQL as well as fullstack examples with Next.js and Vue.js, and a lot more.
-
-These examples use SQLite by default but you can follow the instructions in the project README to switch to Prisma Postgres in a few simple steps.
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/import-from-existing-database-mysql.mdx b/apps/docs/content/docs.v6/(index)/prisma-postgres/import-from-existing-database-mysql.mdx
deleted file mode 100644
index 0ef8bda5de..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/import-from-existing-database-mysql.mdx
+++ /dev/null
@@ -1,209 +0,0 @@
----
-title: Import from MySQL
-description: Learn how to import data from an existing MySQL database into Prisma Postgres.
-url: /v6/prisma-postgres/import-from-existing-database-mysql
-metaTitle: Import from existing MySQL database into Prisma Postgres
-metaDescription: Learn how to import data from an existing MySQL database into Prisma Postgres.
----
-
-This guide provides step-by-step instructions for importing data from an existing MySQL database into Prisma Postgres.
-
-You can accomplish this migration in four steps:
-
-1. Create a new Prisma Postgres database.
-1. Connect directly to a Prisma Postgres instance using a [direct connection](/v6/postgres/database/direct-connections).
-1. Migrate your MySQL data to Prisma Postgres using [pgloader](https://pgloader.io/).
-1. Configure your Prisma project for Prisma Postgres.
-
-## Prerequisites
-
-- The connection URL to your existing MySQL database.
-- A [Prisma Data Platform](https://console.prisma.io) account.
-- Node.js 18+ installed.
-- [pgloader](https://pgloader.io/) installed.
-
-:::info[Make sure your PostgreSQL tools match the Prisma Postgres version]
-
-Prisma Postgres runs PostgreSQL 17. Your `pgloader` and any other PostgreSQL tools you use need to be compatible with PostgreSQL 17.
-
-:::
-
-We recommend attempting this migration in a separate git development branch.
-
-## 1. Create a new Prisma Postgres database
-
-Follow these steps to create a new Prisma Postgres database:
-
-1. Log in to [Prisma Data Platform](https://console.prisma.io/) and open the Console.
-1. In a [workspace](/v6/platform/about#workspace) of your choice, click the **New project** button.
-1. Type a name for your project in the **Name** field, e.g. **hello-ppg**.
-1. In the **Prisma Postgres** section, click the **Get started** button.
-1. In the **Region** dropdown, select the region that's closest to your current location, e.g. **US East (N. Virginia)**.
-1. Click the **Create project** button.
-
-Once your database was provisioned, find your direct Prisma Postgres connection string:
-
-1. Navigate to your active Prisma Postgres instance.
-1. Click the **API Keys** tab in the project's sidenav.
-1. Click the **Create API key** button.
-1. In the popup, provide a **Name** for the API key and click **Create**.
-1. Copy the connection string starting with `postgres://`, this is your direct connection string.
-
-Save the connection string, you'll need it in the next step.
-
-## 2. Prepare your direct connection string
-
-In this step, you'll use the [direct connection string](/v6/postgres/database/direct-connections) you obtained in step 1 to connect to your Prisma Postgres instance.
-
-Your direct connection string should look like this:
-
-```text
-postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require
-```
-
-You'll use this connection string in the next step when configuring pgloader.
-
-## 3. Migrate your MySQL data to Prisma Postgres using pgloader
-
-Now that you have an active connection to your Prisma Postgres instance, you'll use [pgloader](https://pgloader.io/) to export data from your MySQL database to Prisma Postgres.
-
-Open a separate terminal window and create a `config.load` file:
-
-```bash
-touch config.load
-```
-
-Open the `config.load` file in your preferred text editor and copy-paste the following configuration:
-
-```text title="config.load"
-LOAD DATABASE
- FROM mysql://username:password@host:PORT/database_name
- INTO postgres://__USER__:__PASSWORD__@db.prisma.io:5432/?sslmode=require
-
-WITH quote identifiers, -- preserve table/column name case by quoting them
- include drop,
- create tables,
- create indexes,
- reset sequences
-
-ALTER SCHEMA 'database_name' RENAME TO 'public';
-```
-
-Make sure to update the following details in the `config.load` file:
-
-- `FROM` url (MySQL database URL):
- - Replace `username`, `password`, `host`, `PORT`, and `database_name` with the actual connection details for your MySQL database.
- - Ensure that your connection string includes `useSSL=true` if SSL is required, for example: `mysql://username:password@host:PORT/database_name?useSSL=true`. Note that when using PlanetScale, appending `sslaccept=strict` will not work.
-- `INTO` url (Postgres database URL):
- - Update this with your direct connection string from above, replacing the `__USER__` and `__PASSWORD__` placeholders.
-- Update the `database_name` in `ALTER SCHEMA 'database_name' RENAME TO 'public';` to exactly match the `database_name` in your MySQL connection string.
-
-After saving the configuration file with your updated credentials, in the same terminal window, execute the following command:
-
-```bash
-pgloader config.load
-```
-
-You should see a log similar to this, which confirms the successful migration of your data:
-
-```bash
-LOG report summary reset
- table name errors rows bytes total time
-------------------------- --------- --------- --------- --------------
- fetch meta data 0 9 2.546s
- Create Schemas 0 0 0.325s
- Create SQL Types 0 0 0.635s
- Create tables 0 6 5.695s
- Set Table OIDs 0 3 0.328s
-------------------------- --------- --------- --------- --------------
- public.post 0 8 0.5 kB 4.255s
- public."user" 0 4 0.1 kB 2.775s
-public._prisma_migrations 0 1 0.2 kB 4.278s
-------------------------- --------- --------- --------- --------------
- COPY Threads Completion 0 4 5.095s
- Index Build Completion 0 5 9.601s
- Create Indexes 0 5 4.116s
- Reset Sequences 0 2 4.540s
- Primary Keys 0 3 2.917s
- Create Foreign Keys 0 1 1.121s
- Create Triggers 0 0 0.651s
- Install Comments 0 0 0.000s
-------------------------- --------- --------- --------- --------------
- Total import time ✓ 13 0.8 kB 28.042s
-```
-
-If you see output like this, it means your data has been successfully exported to your Prisma Postgres instance.
-
-:::note
-
-You also can use [Prisma Studio](/v6/postgres/integrations/viewing-data#viewing-and-editing-data-in-prisma-studio) and verify whether the migration was successful:
-
-```npm
-npx prisma studio
-```
-
-:::
-
-## 4. Configure your Prisma project for Prisma Postgres
-
-After migrating your data, you need to set up your Prisma project to work with Prisma Postgres. The steps differ depending on whether you were already using Prisma ORM.
-
-### If you **were not** previously using Prisma ORM
-
-Initialize Prisma in your project by running `npx prisma init` in your project directory. This creates a `prisma` folder with a `schema.prisma` file and `.env` file (if not already present).
-
-In the generated `.env` file, update `DATABASE_URL` to match your Prisma Postgres direct connection string that you received in [step 1](/v6/prisma-postgres/import-from-existing-database-mysql#1-create-a-new-prisma-postgres-database):
-
-```bash title=".env" no-copy
-DATABASE_URL="postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require"
-```
-
-[Introspect](/v6/orm/prisma-schema/introspection) your newly migrated database by running:
-
-```npm
-npx prisma db pull
-```
-
-This command updates your `schema.prisma` file with models representing your migrated tables, so you can start using [Prisma Client](/v6/orm/prisma-client/setup-and-configuration/introduction) to query your data or [Prisma Migrate](/v6/orm/prisma-migrate/getting-started) to manage future changes.
-
-Congratulations! You've successfully migrated your MySQL database to Prisma Postgres and configured your Prisma project. Your migration tutorial is now complete.
-
-:::note
-
-For a comprehensive guide on getting started with Prisma and Prisma Postgres, see [start from scratch with Prisma and Prisma Postgres](/v6/prisma-orm/quickstart/prisma-postgres).
-
-:::
-
-### If you **were** already using Prisma ORM
-
-In your `schema.prisma` file, change the `provider` in the `datasource` block from `mysql` to `postgresql`:
-
-```prisma title="schema.prisma"
-datasource db {
- provider = "mysql" // [!code --]
- provider = "postgres" // [!code ++]
-}
-```
-
-In the generated `.env` file, update `DATABASE_URL` to match your Prisma Postgres direct connection string that you received in [step 1](/v6/prisma-postgres/import-from-existing-database-mysql#1-create-a-new-prisma-postgres-database):
-
-```bash title=".env" no-copy
-DATABASE_URL="postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require"
-```
-
-Introspect your newly migrated Prisma Postgres database and generate Prisma Client:
-
-```npm
-npx prisma db pull
-```
-
-This command refreshes your Prisma models based on the new database schema.
-
-If you were using [Prisma Migrate](/v6/orm/prisma-migrate/getting-started) before:
-
-- Delete your existing `migrations` folder in the `prisma` directory.
-- [Baseline your database](/v6/orm/prisma-migrate/workflows/baselining#baselining-a-database) to begin creating new migrations.
-
-Congratulations! You've successfully migrated your MySQL database to Prisma Postgres and configured your Prisma project. Your migration tutorial is now complete.
-
-If you encounter any issues during the migration, please don't hesitate to reach out to us on [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=conclusion) or via [X](https://pris.ly/x?utm_source=docs&utm_medium=conclusion).
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/import-from-existing-database-postgresql.mdx b/apps/docs/content/docs.v6/(index)/prisma-postgres/import-from-existing-database-postgresql.mdx
deleted file mode 100644
index d41ab26648..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/import-from-existing-database-postgresql.mdx
+++ /dev/null
@@ -1,193 +0,0 @@
----
-title: Import from PostgreSQL
-description: Learn how to import data from an existing PostgreSQL database into Prisma Postgres.
-url: /v6/prisma-postgres/import-from-existing-database-postgresql
-metaTitle: Import from existing Postgres database into Prisma Postgres
-metaDescription: Learn how to import data from an existing PostgreSQL database into Prisma Postgres.
----
-
-This guide provides step-by-step instructions for importing data from an existing PostgreSQL database into Prisma Postgres.
-
-You can accomplish this migration in three steps:
-
-1. Create a new Prisma Postgres database.
-1. Export your existing data via `pg_dump`.
-1. Import the previously exported data into Prisma Postgres via `pg_restore`.
-
-In the third step, you will be using a [direct connection](/v6/postgres/database/direct-connections) to securely connect to your Prisma Postgres database to run `pg_restore`.
-
-## Prerequisites
-
-- The connection URL to your existing PostgreSQL database
-- A [Prisma Data Platform](https://console.prisma.io) account
-- Node.js 18+ installed
-- PostgreSQL CLI Tools (`pg_dump`, `pg_restore`) for creating and restoring backups
-
-:::info[Make sure your PostgreSQL tools match the Prisma Postgres version]
-
-Prisma Postgres runs PostgreSQL 17. Your `pg_dump` and `pg_restore` tools need to be version 17 to ensure compatibility. You can check your version by running `pg_dump --version` or `pg_restore --version`.
-
-:::
-
-## 1. Create a new Prisma Postgres database
-
-Follow these steps to create a new Prisma Postgres database:
-
-1. Log in to [Prisma Data Platform](https://console.prisma.io/) and open the Console.
-1. In a [workspace](/v6/platform/about#workspace) of your choice, click the **New project** button.
-1. Type a name for your project in the **Name** field, e.g. **hello-ppg**.
-1. In the **Prisma Postgres** section, click the **Get started** button.
-1. In the **Region** dropdown, select the region that's closest to your current location, e.g. **US East (N. Virginia)**.
-1. Click the **Create project** button.
-
-Once your database is provisioned, obtain your direct connection string:
-
-1. Navigate to your active Prisma Postgres instance.
-1. Click the **API Keys** tab in the project's sidenav.
-1. Click the **Create API key** button.
-1. In the popup, provide a **Name** for the API key and click **Create**.
-1. Copy the connection string starting with `postgres://`, this is your direct connection string.
-
-Save the connection string, you'll need it in step 3.
-
-## 2. Export data from your existing database
-
-In this step, you're going to export the data from your existing database and store it in a `.bak` file on your local machine.
-
-Make sure to have the connection URL for your existing database ready, it should be [structured](/v6/orm/overview/databases/postgresql#connection-url) like this:
-
-```text
-postgresql://USER:PASSWORD@HOST:PORT/DATABASE
-```
-
-Expand below for provider-specific instructions that help you determine the right connection string:
-
-
-Neon
-
-
-
-- Make sure to select non-pooled connection string by switching off the **Connection pooling** toggle.
-- The `sslmode` has to be set to `require` and appended to your Neon database url for the command to work.
-- The connection URL should look similar to this:
- ```text
- postgresql://USER:PASSWORD@YOUR-NEON-HOST/DATABASE?sslmode=require
- ```
-
-
-
-
-Supabase
-
-- Use a database connection URL that uses [Supavisor session mode](https://supabase.com/docs/guides/database/connecting-to-postgres#supavisor-session-mode).
-- The connection URL should look similar to this:
- ```text
- postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-ca-central-1.pooler.supabase.com:5432/postgres
- ```
-
-
-
-Next, run the following command to export the data of your PostgreSQL database (replace the `__DATABASE_URL__` placeholder with your actual database connection URL):
-
-```bash
-pg_dump \
- -Fc \
- -v \
- -d __DATABASE_URL__ \
- -n public \
- -f db_dump.bak
-```
-
-Here's a quick overview of the CLI options that were used for this command:
-
-- `-Fc`: Uses the custom format for backups, recommended for `pg_restore`
-- `-v`: Runs `pg_dump` in verbose mode
-- `-d`: Specifies the database connection string
-- `-n`: Specifies the target PostgreSQL schema
-- `-f`: Specifies the output name for the backup file
-
-Running this command will create a backup file named `db_dump.bak` which you will use to restore the data into your Prisma Postgres database in the next step.
-
-## 3. Import data into Prisma Postgres
-
-In this section, you'll use your [direct connection string](/v6/postgres/database/direct-connections) to connect to your Prisma Postgres instance and import data via `pg_restore`.
-
-Your direct connection string from step 1 should look like this:
-
-```text
-postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require
-```
-
-Use the backup file from **Step 2** to restore data into your Prisma Postgres database with `pg_restore` by running this command (replace `__USER__`, `__PASSWORD__` with the values from your direct connection string):
-
-```bash
-pg_restore \
- -h db.prisma.io \
- -p 5432 \
- -U __USER__ \
- -d postgres \
- -v \
- ./db_dump.bak \
-&& echo "-complete-"
-```
-
-When prompted, enter the `__PASSWORD__` from your direct connection string.
-
-:::tip
-
-You can also use the full connection string format:
-
-```bash
-pg_restore \
- -d "postgres://USER:PASSWORD@db.prisma.io:5432/postgres?sslmode=require" \
- -v \
- ./db_dump.bak \
-&& echo "-complete-"
-```
-
-:::
-
-Once the command completes execution, you will have successfully imported the data from your existing PostgreSQL database into Prisma Postgres 🎉
-
-To validate that the import worked, you can use [Prisma Studio](/v6/postgres/integrations/viewing-data#viewing-and-editing-data-in-prisma-studio). Either open it in the [Platform Console](https://console.prisma.io) by clicking the **Studio** tab in the left-hand sidenav in your project or run this command to launch Prisma Studio locally:
-
-```npm
-npx prisma studio
-```
-
-## 4. Update your application code to query Prisma Postgres
-
-### Scenario A: You are already using Prisma ORM
-
-If you're already using Prisma ORM, you need to update your database connection URL to point to your new Prisma Postgres instance.
-
-Update the `DATABASE_URL` in your `.env` file to match your Prisma Postgres direct connection string from step 1:
-
-```bash title=".env"
-DATABASE_URL="postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require"
-```
-
-Then, re-generate Prisma Client so that the updated environment variable takes effect:
-
-```npm
-npx prisma generate
-```
-
-Once this is done, you can run your application and it should work as before.
-
-:::tip
-
-For a complete guide on setting up Prisma ORM with Prisma Postgres from scratch, including driver adapter configuration and best practices, see the [Prisma ORM with Prisma Postgres quickstart](/v6/prisma-orm/quickstart/prisma-postgres).
-
-:::
-
-### Scenario B: You are not yet using Prisma ORM
-
-If you are not yet using Prisma ORM, you'll need to go through the following steps to use Prisma Postgres from your application:
-
-1. Install the Prisma CLI and other required dependencies in your project
-1. Introspect the database to generate a Prisma schema
-1. Generate Prisma Client
-1. Update the queries in your application to use Prisma ORM
-
-You can find the detailed step-by-step instructions for this process in this guide: [Add Prisma ORM to an existing project](/v6/prisma-orm/add-to-existing-project/prisma-postgres).
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/index.mdx b/apps/docs/content/docs.v6/(index)/prisma-postgres/index.mdx
deleted file mode 100644
index 4270dd79c6..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/index.mdx
+++ /dev/null
@@ -1,13 +0,0 @@
----
-title: Prisma Postgres
-description: 'Get started with Prisma ORM and your favorite database. Learn about data modeling, migrations and querying.'
-url: /v6/prisma-postgres
-metaTitle: Prisma Postgres
-metaDescription: 'Get started with Prisma ORM and your favorite database. Learn about data modeling, migrations and querying.'
----
-
-## Getting started
-
-- [Quickstart](/v6/prisma-postgres/quickstart/prisma-orm) - Start a new project with Prisma Postgres
-- [From the CLI](/v6/prisma-postgres/from-the-cli) - Create databases from the command line
-- [Add to existing project](/v6/prisma-orm/add-to-existing-project/prisma-postgres) - Connect an existing Prisma project
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/meta.json b/apps/docs/content/docs.v6/(index)/prisma-postgres/meta.json
deleted file mode 100644
index 9196473e5f..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/meta.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "title": "Prisma Postgres",
- "defaultOpen": true,
- "pages": [
- "index",
- "from-the-cli",
- "import-from-existing-database-postgresql",
- "import-from-existing-database-mysql",
- "quickstart"
- ]
-}
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/drizzle-orm.mdx b/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/drizzle-orm.mdx
deleted file mode 100644
index da036b4457..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/drizzle-orm.mdx
+++ /dev/null
@@ -1,194 +0,0 @@
----
-title: Drizzle ORM
-description: Get started with Drizzle ORM and Prisma Postgres.
-url: /v6/prisma-postgres/quickstart/drizzle-orm
-metaTitle: 'Quickstart: Drizzle ORM with Prisma Postgres (10 min)'
-metaDescription: Get started with Drizzle ORM and Prisma Postgres.
----
-
-[Drizzle ORM](https://orm.drizzle.team) is a TypeScript ORM. In this guide, you'll learn how to connect Drizzle ORM to [Prisma Postgres](/v6/postgres).
-
-## Prerequisites
-
-- Node.js version 16 or higher
-- TypeScript version 5.0 or higher
-
-## 1. Create a new project
-
-Create a new directory for your project and initialize it with npm:
-
-```npm
-mkdir drizzle-quickstart
-cd drizzle-quickstart
-npm init -y
-```
-
-Install TypeScript and initialize it:
-
-```npm
-npm install --save-dev typescript
-```
-
-```npm
-npx tsc --init
-```
-
-In your `package.json`, set the `type` to `module`:
-
-```json title="package.json"
-{
- // ...
- "type": "module" // [!code ++]
- // ...
-}
-```
-
-## 2. Create a Prisma Postgres database
-
-You can create a Prisma Postgres database using the `create-db` CLI tool. Follow these steps to create your Prisma Postgres database:
-
-```npm
-npx create-db
-```
-
-Then the CLI tool should output:
-
-```bash
-┌ 🚀 Creating a Prisma Postgres database
-│
-│ Provisioning a temporary database in us-east-1...
-│
-│ It will be automatically deleted in 24 hours, but you can claim it.
-│
-◇ Database created successfully!
-│
-│
-● Database Connection
-│
-│
-│ Connection String:
-│
-│ postgresql://hostname:password@db.prisma.io:5432/postgres?sslmode=require
-│
-│
-◆ Claim Your Database
-│
-│ Keep your database for free:
-│
-│ https://create-db.prisma.io/claim?CLAIM_CODE
-│
-│ Database will be deleted on 11/18/2025, 1:55:39 AM if not claimed.
-│
-└
-```
-
-Create a `.env` file and add the connection string from the output:
-
-```text title=".env"
-DATABASE_URL="postgresql://hostname:password@db.prisma.io:5432/postgres?sslmode=require"
-```
-
-:::warning
-
-**Never commit `.env` files to version control.** Add `.env` to your `.gitignore` file to keep credentials secure.
-
-:::
-
-The database created is temporary and will be deleted in 24 hours unless claimed. Claiming moves the database into your [Prisma Data Platform](https://console.prisma.io) account. Visit the claim URL from the output to keep your database.
-
-:::note
-
-To learn more about the `create-db` CLI tool, see the [create-db documentation](/v6/postgres/introduction/npx-create-db).
-
-:::
-
-## 3. Install dependencies
-
-Install Drizzle ORM and the PostgreSQL driver:
-
-```npm
-npm install drizzle-orm pg dotenv
-```
-
-```npm
-npm install --save-dev drizzle-kit @types/pg tsx
-```
-
-**Package breakdown:**
-
-- `drizzle-orm`: The lightweight TypeScript ORM
-- `pg`: PostgreSQL driver for Node.js
-- `dotenv`: Loads environment variables from `.env` file
-- `drizzle-kit`: CLI tool for migrations and schema management
-- `@types/pg`: TypeScript type definitions for the pg driver
-- `tsx`: TypeScript execution engine for running `.ts` files directly
-
-## 4. Run a query
-
-Create a `src/script.ts` file:
-
-```typescript title="src/script.ts"
-import "dotenv/config";
-import { drizzle } from "drizzle-orm/node-postgres";
-import { Pool } from "pg";
-
-const pool = new Pool({
- connectionString: process.env.DATABASE_URL,
-});
-
-const db = drizzle({ client: pool });
-
-async function main() {
- const result = await db.execute("select 1");
- console.log("Query result:", result);
-}
-
-main()
- .then(async () => {
- await pool.end();
- console.log("Connection closed");
- })
- .catch(async (error) => {
- console.error("Error:", error);
- await pool.end();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx src/script.ts
-```
-
-You should receive output similar to:
-
-```bash
-Query result: Result {
- command: 'SELECT',
- rowCount: 1,
- oid: null,
- rows: [ { '?column?': 1 } ],
- fields: [
- Field {
- name: '?column?',
- tableID: 0,
- columnID: 0,
- dataTypeID: 23,
- dataTypeSize: 4,
- dataTypeModifier: -1,
- format: 'text'
- }
- ],
- _parsers: [ [Function: parseInteger] ],
- _types: { getTypeParser: [Function: getTypeParser] },
- RowCtor: null,
- rowAsArray: false,
- _prebuiltEmptyResultObject: { '?column?': null }
-}
-Connection closed
-```
-
-## Next steps
-
-You've successfully connected Drizzle ORM to Prisma Postgres! For more advanced features like schemas, migrations, and queries, see the [Drizzle ORM documentation](https://orm.drizzle.team/docs/get-started).
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/kysely.mdx b/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/kysely.mdx
deleted file mode 100644
index e9a5ccd856..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/kysely.mdx
+++ /dev/null
@@ -1,270 +0,0 @@
----
-title: Kysely
-description: Get started with Kysely and Prisma Postgres by creating a type-safe SQL query builder for your database.
-url: /v6/prisma-postgres/quickstart/kysely
-metaTitle: 'Quickstart: Kysely with Prisma Postgres (10 min)'
-metaDescription: Get started with Kysely and Prisma Postgres by creating a type-safe SQL query builder for your database.
----
-
-[Kysely](https://kysely.dev) is a type-safe TypeScript SQL query builder that provides TypeScript support and a fluent API for building SQL queries. In this guide, you'll learn how to connect Kysely to [Prisma Postgres](/v6/postgres) and start querying your database with full type safety.
-
-## Prerequisites
-
-- Node.js version 14 or higher
-- TypeScript version 4.6 or higher (5.4+ recommended for improved type inference, 5.9+ for better compilation performance)
-- Strict mode enabled in your `tsconfig.json` for Kysely's type safety
-
-## 1. Create a new project
-
-Create a new directory for your project and initialize it with npm:
-
-```npm
-mkdir kysely-quickstart
-cd kysely-quickstart
-npm init -y
-```
-
-Install TypeScript and initialize it:
-
-```npm
-npm install --save-dev typescript
-```
-
-```npm
-npx tsc --init
-```
-
-## 2. Configure TypeScript
-
-Kysely requires TypeScript's strict mode for proper type safety. Update your `tsconfig.json` file:
-
-```json title="tsconfig.json"
-{
- // ...
- "compilerOptions": {
- // ...
- "strict": true, // [!code ++]
- "allowImportingTsExtensions": true, // [!code ++]
- "noEmit": true // [!code ++]
- // ...
- }
- // ...
-}
-```
-
-:::note
-
-The `strict: true` setting is **required** for Kysely's type safety to work correctly.
-
-:::
-
-In your `package.json`, set the `type` to `module`:
-
-```json
-{
- // ...
- "type": "module" // [!code ++]
- // ...
-}
-```
-
-## 3. Create a Prisma Postgres database
-
-You can create a Prisma Postgres database using the `create-db` CLI tool. Follow these steps to create your Prisma Postgres database:
-
-```npm
-npx create-db
-```
-
-Then the CLI tool should output:
-
-```bash
-┌ 🚀 Creating a Prisma Postgres database
-│
-│ Provisioning a temporary database in us-east-1...
-│
-│ It will be automatically deleted in 24 hours, but you can claim it.
-│
-◇ Database created successfully!
-│
-│
-● Database Connection
-│
-│
-│ Connection String:
-│
-│ postgresql://hostname:password@db.prisma.io:5432/postgres?sslmode=require
-│
-│
-◆ Claim Your Database
-│
-│ Keep your database for free:
-│
-│ https://create-db.prisma.io/claim?CLAIM_CODE
-│
-│ Database will be deleted on 11/18/2025, 1:55:39 AM if not claimed.
-│
-└
-```
-
-Create a `.env` file and add the connection string from the output:
-
-```text title=".env"
-DATABASE_URL="postgresql://hostname:password@db.prisma.io:5432/postgres?sslmode=require"
-```
-
-:::warning
-
-**Never commit `.env` files to version control.** Add `.env` to your `.gitignore` file to keep credentials secure.
-
-:::
-
-The database created is temporary and will be deleted in 24 hours unless claimed. Claiming moves the database into your [Prisma Data Platform](https://console.prisma.io) account. Visit the claim URL from the output to keep your database.
-
-:::note
-
-To learn more about the `create-db` CLI tool, see the [create-db documentation](/v6/postgres/introduction/npx-create-db).
-
-:::
-
-## 4. Install dependencies
-
-Install Kysely and the PostgreSQL driver:
-
-```npm
-npm install kysely pg dotenv
-```
-
-```npm
-npm install --save-dev @types/pg tsx
-```
-
-**Package breakdown:**
-
-- `kysely`: The type-safe SQL query builder
-- `pg`: PostgreSQL driver for Node.js (required by Kysely's PostgresDialect)
-- `dotenv`: Loads environment variables from `.env` file
-- `@types/pg`: TypeScript type definitions for the pg driver
-- `tsx`: TypeScript execution engine for running `.ts` files directly
-
-## 5. Define database types
-
-Create a `src/types.ts` file to define your database schema types:
-
-```typescript title="src/types.ts"
-import type { Generated } from "kysely";
-
-export interface Database {
- users: UsersTable;
-}
-
-export interface UsersTable {
- id: Generated;
- email: string;
- name: string | null;
-}
-```
-
-## 6. Configure database connection
-
-Create a `src/database.ts` file to instantiate Kysely with your Prisma Postgres connection:
-
-```typescript title="src/database.ts"
-import "dotenv/config";
-import type { Database } from "./types.ts";
-import { Pool } from "pg";
-import { Kysely, PostgresDialect } from "kysely";
-
-// Parse DATABASE_URL into connection parameters
-function parseConnectionString(url: string) {
- const parsed = new URL(url);
- return {
- host: parsed.hostname,
- port: parseInt(parsed.port),
- user: parsed.username,
- password: parsed.password,
- database: parsed.pathname.slice(1), // Remove leading '/'
- };
-}
-
-const connectionParams = parseConnectionString(process.env.DATABASE_URL!);
-
-const dialect = new PostgresDialect({
- pool: new Pool({
- ...connectionParams,
- ssl: true,
- max: 10,
- }),
-});
-
-// Database interface is passed to Kysely's constructor, and from now on, Kysely
-// knows your database structure.
-// Dialect is passed to Kysely's constructor, and from now on, Kysely knows how
-// to communicate with your database.
-export const db = new Kysely({
- dialect,
-});
-```
-
-## 7. Run queries
-
-Create a `src/script.ts` file:
-
-```typescript title="src/script.ts"
-import { db } from "./database.ts";
-
-async function main() {
- // Create the users table
- await db.schema
- .createTable("users")
- .ifNotExists()
- .addColumn("id", "serial", (col) => col.primaryKey())
- .addColumn("email", "varchar(255)", (col) => col.notNull().unique())
- .addColumn("name", "varchar(255)")
- .execute();
-
- // Insert a user
- const user = await db
- .insertInto("users")
- .values({
- email: "alice@prisma.io",
- name: "Alice",
- })
- .returningAll()
- .executeTakeFirstOrThrow();
-
- console.log("Created user:", user);
-
- // Query all users
- const users = await db.selectFrom("users").selectAll().execute();
-
- console.log("All users:", users);
-}
-
-main()
- .then(async () => {
- await db.destroy();
- })
- .catch(async (error) => {
- console.error("Error:", error);
- await db.destroy();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx src/script.ts
-```
-
-You should receive the following output:
-
-```bash
-Created user: { id: 1, email: 'alice@prisma.io', name: 'Alice' }
-All users: [ { id: 1, email: 'alice@prisma.io', name: 'Alice' } ]
-```
-
-## Next steps
-
-You've successfully connected Kysely to Prisma Postgres! For more advanced features like schemas, migrations, and complex queries, see the [Kysely documentation](https://kysely.dev/docs/intro).
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/meta.json b/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/meta.json
deleted file mode 100644
index bbfa7c4d52..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/meta.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "title": "Quickstart",
- "pages": ["prisma-orm", "kysely", "drizzle-orm", "typeorm"]
-}
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/prisma-orm.mdx b/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/prisma-orm.mdx
deleted file mode 100644
index 16599db3e1..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/prisma-orm.mdx
+++ /dev/null
@@ -1,245 +0,0 @@
----
-title: Prisma ORM
-description: Create a new TypeScript project from scratch by connecting Prisma ORM to Prisma Postgres and generating a Prisma Client for database access.
-url: /v6/prisma-postgres/quickstart/prisma-orm
-metaTitle: 'Quickstart: Prisma ORM with Prisma Postgres (5 min)'
-metaDescription: Create a new TypeScript project from scratch by connecting Prisma ORM to Prisma Postgres and generating a Prisma Client for database access.
----
-
-[Prisma Postgres](/v6/postgres) is a fully managed PostgreSQL database that scales to zero and integrates smoothly with both Prisma ORM and Prisma Studio. In this guide, you will learn how to set up a new TypeScript project from scratch, connect it to Prisma Postgres using Prisma ORM, and generate a Prisma Client for easy, type-safe access to your database.
-
-## Prerequisites
-
-## 1. Create a new project
-
-## 2. Install required dependencies
-
-Install the packages needed for this quickstart:
-
-```npm
-npm install prisma @types/node --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv
-```
-
-Here's what each package does:
-
-- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
-- **`@prisma/client`** - The Prisma Client library for querying your database
-- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
-- **`dotenv`** - Loads environment variables from your `.env` file
-
-## 3. Configure ESM support
-
-Update `tsconfig.json` for ESM compatibility:
-
-```json title="tsconfig.json"
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true,
- "ignoreDeprecations": "6.0"
- }
-}
-```
-
-Update `package.json` to enable ESM:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 4. Initialize Prisma ORM and create a Prisma Postgres database
-
-Next, set up your Prisma ORM project by creating your [Prisma Schema](/v6/orm/prisma-schema/overview) file with the following command:
-
-```npm
-npx prisma init --db --output ../generated/prisma
-```
-
-:::info
-
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database.
-
-:::
-
-This command does a few things:
-
-- Creates a `prisma/` directory with a `schema.prisma` file containing your database connection and schema models
-- Creates a new Prisma Postgres database (when using `--db` flag)
-- Creates a `.env` file in the root directory for environment variables
-- Generates the Prisma Client in the `generated/prisma/` directory
-- Creates a `prisma.config.ts` file for Prisma configuration
-
-The generated `prisma.config.ts` file looks like this:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-The generated schema uses [the ESM-first `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with a custom output path:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-```
-
-## 5. Define your data model
-
-Open `prisma/schema.prisma` and add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId Int // [!code ++]
-} // [!code ++]
-```
-
-## 6. Create and apply your first migration
-
-Create your first migration to set up the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-This command creates the database tables based on your schema.
-
-Now run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 7. Instantiate Prisma Client
-
-Now that you have all the dependencies installed, you can instantiate Prisma Client. You need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
-
-```typescript title="lib/prisma.ts"
-import "dotenv/config";
-import { PrismaPg } from "@prisma/adapter-pg";
-import { PrismaClient } from "../generated/prisma/client";
-
-const connectionString = `${process.env.DATABASE_URL}`;
-
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
-
-export { prisma };
-```
-
-:::tip
-
-If you need to query your database via HTTP from an edge runtime (Cloudflare Workers, Vercel Edge Functions, etc.), use the [Prisma Postgres serverless driver](/v6/postgres/database/serverless-driver#use-with-prisma-orm).
-
-:::
-
-## 8. Write your first query
-
-Create a `script.ts` file to test your setup:
-
-```typescript title="script.ts"
-import { prisma } from "./lib/prisma";
-
-async function main() {
- // Create a new user with a post
- const user = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: {
- title: "Hello World",
- content: "This is my first post!",
- published: true,
- },
- },
- },
- include: {
- posts: true,
- },
- });
- console.log("Created user:", user);
-
- // Fetch all users with their posts
- const allUsers = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- console.log("All users:", JSON.stringify(allUsers, null, 2));
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the script:
-
-```npm
-npx tsx script.ts
-```
-
-You should see the created user and all users printed to the console!
-
-## 9. Explore your data with Prisma Studio
-
-## Next steps
-
-## More info
-
-- [Prisma Postgres documentation](/v6/postgres)
-- [Prisma Config reference](/v6/orm/reference/prisma-config-reference)
-- [Database connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections)
-- [Cache your queries](/v6/postgres/database/caching#setting-up-caching-in-prisma-postgres)
diff --git a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/typeorm.mdx b/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/typeorm.mdx
deleted file mode 100644
index 2629a20c81..0000000000
--- a/apps/docs/content/docs.v6/(index)/prisma-postgres/quickstart/typeorm.mdx
+++ /dev/null
@@ -1,176 +0,0 @@
----
-title: TypeORM
-description: Get started with TypeORM and Prisma Postgres by connecting your TypeScript ORM to a managed PostgreSQL database.
-url: /v6/prisma-postgres/quickstart/typeorm
-metaTitle: 'Quickstart: TypeORM with Prisma Postgres (10 min)'
-metaDescription: Get started with TypeORM and Prisma Postgres by connecting your TypeScript ORM to a managed PostgreSQL database.
----
-
-[TypeORM](https://typeorm.io) is a TypeScript ORM. In this guide, you'll learn how to connect TypeORM to [Prisma Postgres](/v6/postgres).
-
-## Prerequisites
-
-- Node.js version 16 or higher
-- TypeScript version 4.5 or higher
-
-## 1. Generate a TypeORM project
-
-Use the TypeORM CLI to generate a starter project:
-
-```npm
-npx typeorm init --name typeorm-quickstart --database postgres
-```
-
-This command will generate a new project with the following structure:
-
-```
-typeorm-quickstart
-├── src
-│ ├── entity
-│ │ └── User.ts # Sample entity
-│ ├── migration # Migrations folder
-│ ├── data-source.ts # Data source configuration
-│ └── index.ts # Application entry point
-├── .gitignore
-├── package.json
-├── README.md
-└── tsconfig.json
-```
-
-## 2. Install dependencies
-
-Navigate to the project directory and install dependencies:
-
-```npm
-cd typeorm-quickstart
-npm install
-```
-
-Install dotenv to load environment variables:
-
-```npm
-npm install dotenv
-```
-
-## 3. Create a Prisma Postgres database
-
-You can create a Prisma Postgres database using the `create-db` CLI tool. Follow these steps to create your Prisma Postgres database:
-
-```npm
-npx create-db
-```
-
-Then the CLI tool should output:
-
-```bash
-┌ 🚀 Creating a Prisma Postgres database
-│
-│ Provisioning a temporary database in us-east-1...
-│
-│ It will be automatically deleted in 24 hours, but you can claim it.
-│
-◇ Database created successfully!
-│
-│
-● Database Connection
-│
-│
-│ Connection String:
-│
-│ postgresql://hostname:password@db.prisma.io:5432/postgres?sslmode=require
-│
-│
-◆ Claim Your Database
-│
-│ Keep your database for free:
-│
-│ https://create-db.prisma.io/claim?CLAIM_CODE
-│
-│ Database will be deleted on 11/18/2025, 1:55:39 AM if not claimed.
-│
-└
-```
-
-Create a `.env` file and add the connection string from the output:
-
-```text title=".env"
-DATABASE_URL="postgresql://hostname:password@db.prisma.io:5432/postgres?sslmode=require"
-```
-
-:::warning
-
-**Never commit `.env` files to version control.** Add `.env` to your `.gitignore` file to keep credentials secure.
-
-:::
-
-The database created is temporary and will be deleted in 24 hours unless claimed. Claiming moves the database into your [Prisma Data Platform](https://console.prisma.io) account. Visit the claim URL from the output to keep your database.
-
-:::note
-
-To learn more about the `create-db` CLI tool, see the [create-db documentation](/v6/postgres/introduction/npx-create-db).
-
-:::
-
-## 4. Configure database connection
-
-Update the `src/data-source.ts` file to use your Prisma Postgres connection:
-
-```typescript title="src/data-source.ts"
-import "reflect-metadata";
-import "dotenv/config"; // [!code ++]
-import { DataSource } from "typeorm";
-import { User } from "./entity/User";
-
-// Parse DATABASE_URL into connection parameters // [!code ++]
-function parseConnectionString(url: string) {
- // [!code ++]
- const parsed = new URL(url); // [!code ++]
- return {
- // [!code ++]
- host: parsed.hostname, // [!code ++]
- port: parseInt(parsed.port), // [!code ++]
- username: parsed.username, // [!code ++]
- password: parsed.password, // [!code ++]
- database: parsed.pathname.slice(1), // Remove leading '/' // [!code ++]
- }; // [!code ++]
-} // [!code ++]
-
-const connectionParams = parseConnectionString(process.env.DATABASE_URL!); // [!code ++]
-
-export const AppDataSource = new DataSource({
- type: "postgres",
- host: "localhost", // [!code --]
- port: 5432, // [!code --]
- username: "test", // [!code --]
- password: "test", // [!code --]
- database: "test", // [!code --]
- ...connectionParams, // [!code ++]
- ssl: true, // [!code ++]
- synchronize: true,
- logging: false,
- entities: [User],
- migrations: [],
- subscribers: [],
-});
-```
-
-## 5. Run the application
-
-Start the application:
-
-```npm
-npm start
-```
-
-You should see output indicating the connection was successful and a new user was inserted into the database:
-
-```bash
-Inserting a new user into the database...
-Saved a new user with id: 1
-Loading users from the database...
-Loaded users: [ User { id: 1, firstName: 'Timber', lastName: 'Saw', age: 25 } ]
-```
-
-## Next steps
-
-You've successfully connected TypeORM to Prisma Postgres! For more advanced features like entities, migrations, and queries, see the [TypeORM documentation](https://typeorm.io/docs/getting-started).
diff --git a/apps/docs/content/docs.v6/accelerate/api-reference.mdx b/apps/docs/content/docs.v6/accelerate/api-reference.mdx
deleted file mode 100644
index c3de72e55f..0000000000
--- a/apps/docs/content/docs.v6/accelerate/api-reference.mdx
+++ /dev/null
@@ -1,232 +0,0 @@
----
-title: API Reference
-description: API reference documentation for Accelerate.
-url: /v6/accelerate/api-reference
-metaTitle: 'Accelerate: API Reference'
-metaDescription: API reference documentation for Accelerate.
----
-
-The Accelerate API reference documentation is based on the following schema:
-
-```prisma
-model User {
- id Int @id @default(autoincrement())
- name String?
- email String @unique
-}
-```
-
-All example are based on the `User` model.
-
-## `cacheStrategy`
-
-With the Accelerate extension for Prisma Client, you can use the `cacheStrategy` parameter for model queries and use the [`ttl`](/v6/postgres/database/caching#time-to-live-ttl) and [`swr`](/v6/postgres/database/caching#stale-while-revalidate-swr) parameters to define a cache strategy for Accelerate. The Accelerate extension requires that you install Prisma Client version `4.10.0`.
-
-### Options
-
-The `cacheStrategy` parameter takes an option with the following keys:
-
-| Option | Example | Type | Required | Description |
-| ------ | ---------- | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `swr` | `60` | `Int` | No | The stale-while-revalidate time in seconds. |
-| `ttl` | `60` | `Int` | No | The time-to-live time in seconds. |
-| `tags` | `["user"]` | `String[]` | No | The `tag` serves as a variable to control the invalidation of specific queries within your application. It is an optional array of strings to [invalidate](/v6/accelerate/api-reference#accelerateinvalidate) the cache, with each tag containing only alphanumeric characters and underscores, and a maximum length of 64 characters. |
-
-|
-
-### Examples
-
-Add a caching strategy to the query, defining a 60-second stale-while-revalidate (SWR) value, a 60-second time-to-live (TTL) value, and a cache tag of `"emails_with_alice"`:
-
-```ts highlight=7:11;normal
-await prisma.user.findMany({
- where: {
- email: {
- contains: "alice@prisma.io",
- },
- },
- cacheStrategy: {
- // [!code highlight]
- swr: 60, // [!code highlight]
- ttl: 60, // [!code highlight]
- tags: ["emails_with_alice"], // [!code highlight]
- }, // [!code highlight]
-});
-```
-
-### Supported Prisma Client operations
-
-The following is a list of all read query operations that support `cacheStrategy`:
-
-- [`findUnique()`](/v6/orm/reference/prisma-client-reference#findunique)
-- [`findUniqueOrThrow()`](/v6/orm/reference/prisma-client-reference#finduniqueorthrow)
-- [`findFirst()`](/v6/orm/reference/prisma-client-reference#findfirst)
-- [`findFirstOrThrow()`](/v6/orm/reference/prisma-client-reference#findfirstorthrow)
-- [`findMany()`](/v6/orm/reference/prisma-client-reference#findmany)
-- [`count()`](/v6/orm/reference/prisma-client-reference#count)
-- [`aggregate()`](/v6/orm/reference/prisma-client-reference#aggregate)
-- [`groupBy()`](/v6/orm/reference/prisma-client-reference#groupby)
-
-The `cacheStrategy` parameter is not supported on any write operations, such as `create()`.
-
-## `withAccelerateInfo`
-
-Any query that supports the `cacheStrategy` can append `withAccelerateInfo()` to wrap the response data and include additional information about the Accelerate response.
-
-To retrieve the status of the response, use:
-
-```ts
-const { data, info } = await prisma.user
- .count({
- cacheStrategy: { ttl: 60, swr: 600 },
- where: { myField: "value" },
- })
- .withAccelerateInfo();
-
-console.dir(info);
-```
-
-Notice the `info` property of the response object. This is where the request information is stored.
-
-### Return type
-
-The `info` object is of type `AccelerateInfo` and follows the interface below:
-
-```ts
-interface AccelerateInfo {
- cacheStatus: "ttl" | "swr" | "miss" | "none";
- lastModified: Date;
- region: string;
- requestId: string;
- signature: string;
-}
-```
-
-| Property | Type | Description |
-| -------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `cacheStatus` | `"ttl" \| "swr" \| "miss" \| "none" ` | The cache status of the response.
`ttl` indicates a cache hit within the `ttl` duration and no database query was executed
`swr` indicates a cache hit within the `swr` duration and the data is being refreshed by Accelerate in the background
`miss` indicates that both `ttl` and `swr` have expired and the database query was executed by the request
`none` indicates that no cache strategy was specified and the database query was executed by the request
|
-| `lastModified` | `Date` | The date the response was last refreshed. |
-| `region` | `String` | The data center region that received the request. |
-| `requestId` | `String` | Unique identifier of the request. Useful for troubleshooting. |
-| `signature` | `String` | The unique signature of the Prisma operation. |
-
-## `$accelerate.invalidate`
-
-You can invalidate the cache using the [`$accelerate.invalidate` API](/v6/accelerate).
-
-:::note
-
-To invalidate cached query results on-demand, a paid plan is required. Each plan has specific limits on the number of cache tag-based invalidations allowed per day, though there are no limits on calling the `$accelerate.invalidate` API itself. See our [pricing for more details](https://www.prisma.io/pricing#accelerate).
-
-:::
-
-### Example
-
-To invalidate the query below:
-
-```ts
-await prisma.user.findMany({
- where: {
- email: {
- contains: "alice@prisma.io",
- },
- },
- cacheStrategy: {
- swr: 60,
- ttl: 60,
- tags: ["emails_with_alice"], // [!code highlight]
- },
-});
-```
-
-You need to provide the cache tag in the `$accelerate.invalidate` API:
-
-```ts
-try {
- await prisma.$accelerate.invalidate({
- // [!code highlight]
- tags: ["emails_with_alice"], // [!code highlight]
- }); // [!code highlight]
-} catch (e) {
- if (e instanceof Prisma.PrismaClientKnownRequestError) {
- // The .code property can be accessed in a type-safe manner
- if (e.code === "P6003") {
- console.log("The cache invalidation rate limit has been reached. Please try again later.");
- }
- }
- throw e;
-}
-```
-
-:::note
-You can invalidate up to 5 tags per call.
-:::
-
-## `$accelerate.invalidateAll`
-
-You can invalidate the entire cache using the `$accelerate.invalidateAll` API.
-
-### Example
-
-To invalidate the query below:
-
-```ts
-await prisma.user.findMany({
- where: {
- email: {
- contains: "alice@prisma.io",
- },
- },
- cacheStrategy: {
- swr: 60,
- ttl: 60,
- tags: ["emails_with_alice"], // [!code highlight]
- },
-});
-```
-
-Just call the `$accelerate.invalidateAll` API:
-
-```ts
-try {
- await prisma.$accelerate.invalidateAll(); // [!code highlight]
-} catch (e) {
- if (e instanceof Prisma.PrismaClientKnownRequestError) {
- if (e.code === "P6003") {
- console.log("The cache invalidation rate limit has been reached. Please try again later.");
- }
- }
- throw e;
-}
-```
-
-### Why use `$accelerate.invalidateAll`?
-
-This method offers better editor support (e.g. IntelliSense) than alternatives like `invalidate("all")`.
-
-:::warning
-
-This clears cache for the entire environment—use with care.
-
-:::
-
-## Providing a Custom Fetch Implementation
-
-Starting from Accelerate version `2.0.0`, you can provide a custom implementation of the fetch function when extending the Prisma Client with Accelerate. This allows you greater flexibility and control over how HTTP requests are handled within your application.
-
-To pass a custom fetch implementation, you can use the following pattern:
-
-```ts
-const myFetch = (input: URL, init?: RequestInit): Promise => {
- // Your custom fetch logic here
- return fetch(input, init);
-};
-
-const prisma = new PrismaClient().$extends(withAccelerate({ fetch: myFetch }));
-```
-
-## Errors
-
-Prisma Accelerate-related errors start with `P6xxx`.
-
-You can find the full error code reference for Prisma Accelerate [here](/v6/orm/reference/error-reference#prisma-accelerate).
diff --git a/apps/docs/content/docs.v6/accelerate/caching.mdx b/apps/docs/content/docs.v6/accelerate/caching.mdx
deleted file mode 100644
index eecf0ba009..0000000000
--- a/apps/docs/content/docs.v6/accelerate/caching.mdx
+++ /dev/null
@@ -1,11 +0,0 @@
----
-title: Caching queries in Prisma Accelerate
-description: Learn everything you need to know to use Accelerate's global database caching.
-url: /v6/accelerate/caching
-metaTitle: 'Accelerate: Caching'
-metaDescription: Learn everything you need to know to use Accelerate's global database caching.
----
-
-Prisma Accelerate provides global caching for read queries using TTL, Stale-While-Revalidate (SWR), or a combination of both. It's included as part of Prisma Postgres, but can also be used with your own database by enabling Accelerate in the [Prisma Data Platform](https://console.prisma.io?utm_source=docs) and [configuring it with your database](/v6/accelerate/getting-started).
-
-This content has moved — learn more on the updated [Caching in Accelerate](/v6/postgres/database/caching) page.
diff --git a/apps/docs/content/docs.v6/accelerate/compare.mdx b/apps/docs/content/docs.v6/accelerate/compare.mdx
deleted file mode 100644
index d4e1079117..0000000000
--- a/apps/docs/content/docs.v6/accelerate/compare.mdx
+++ /dev/null
@@ -1,95 +0,0 @@
----
-title: Compare Accelerate
-description: Learn how Prisma Accelerate compares to other connection poolers like pgbouncer.
-url: /v6/accelerate/compare
-metaTitle: Comparing Prisma Accelerate to other connection pooling options
-metaDescription: Learn how Prisma Accelerate compares to other connection poolers like pgbouncer.
----
-
-Prisma Accelerate supports products that serve a global audience, with a global caching system and connection pool that spans multiple regions, providing consistent access to data with low latency no matter where your user (or your database) is located in the world.
-
-The managed connection pool is designed to support serverless infrastructure, capable of handling high volumes of connections and adapting to traffic spikes with ease.
-
-Explore how Prisma Accelerate compares to other global cache and connection pool solutions on the market, and discover what sets it apart.
-
-## What makes Accelerate unique?
-
-Prisma Accelerate is chosen and loved by many for a number of key reasons which make Accelerate unique:
-
-- [**Query-Level policies**](/v6/accelerate/compare#accelerate-global-cache): Accelerate is the only solution that offers query-level cache policies, allowing you to control the cache strategy for each query specifically. It is common to have some values that need to be cached for a long time, others that need caching for a short time, and some that should not be cached at all. With Accelerate you can do this, and even set different cache strategies per query.
-- [**Global by default**](/v6/accelerate/compare#accelerate-global-cache): Accelerate is globally distributed by default. You never need to worry about where a user is located with respect to your database location.
-- [**Fully managed**](/v6/accelerate/compare#management): You don't need to manage a server or worry about uptime. Accelerate is fully managed for you.
-- [**Auto-scaling**](/v6/accelerate/compare#performance): Accelerate automatically adjusts resources to match workload demands, providing fast and consistent performance during traffic spikes.
-
-## Accelerate global cache
-
-Prisma Accelerate offers a powerful global cache, so you can serve data to your users at the edge — the closest point to where the users are located — no matter where your database is hosted. This not only speeds up the experience for users, but also reduces read load on your database as well by avoiding roundtrips.
-
-| | Accelerate | Hyperdrive | PlanetScale Boost |
-| ----------------------------------- | ---------- | ---------- | ----------------- |
-| **Fully Managed** | ✅ | ✅ | ✅ |
-| **Globally distributed edge infra** | ✅ | ✅ | ✅ |
-| **Control cache policy from code** | ✅ | ❌ | ❌ |
-| **Query-level cache policies** | ✅ | ❌ | ❌ |
-| **Postgres compatible** | ✅ | ✅ | ❌ |
-| **MySQL compatible** | ✅ | ❌ | ✅ |
-| **MongoDB compatible** | ✅ | ❌ | ❌ |
-| **Automatic cache updates** | ❌ | ❌ | ✅ |
-
-**Why are these important?**
-
-- Since Accelerate extends the Prisma client, you can control caching policies directly from your codebase with just an extra line of code. Integration is seamless. Here is an example using [the stale-while-revalidating caching strategy](/v6/postgres/database/caching#stale-while-revalidate-swr):
- ```jsx
- await prisma.user.findMany({
- cacheStrategy: {
- swr: 60,
- },
- });
- ```
-- Query level cache policies are critical for serious applications, so that you can control which queries are cached, and the characteristics of the policy. You may want certain data in your app to be cached for several days, other data to be cached for a just a few minutes, and other data to be not cached at all. This is only possible with Prisma Accelerate.
-- Authenticating with an API key can be a helpful security measure, allowing you to decouple database credentials from application secrets. Easily rotate API keys as often as you like, without needing any credential changes in your database
-- Automatic cache updates means that the cache is automatically updated when a change in the database occurs. With Accelerate, you are in control of how the cache is invalidated, using [various caching strategies](/v6/postgres/database/caching).
-
-## Accelerate connection pool
-
-Prisma Accelerate includes a globally hosted connection pooler, which allows you to handle peak loads without any problem. Using a connection pool is important especially for serverless infrastructure, which by nature is not able to control connection volume to the database on its own. Prisma Accelerate offers a fully managed, globally colocated option, which auto scales to support any workload.
-
-### Management
-
-| | Accelerate | pgbouncer | pgcat | Digital Ocean (pgbouncer) | Neon (pgbouncer) | Supavisor | Hyperdrive |
-| ------------------------------ | ---------- | --------- | ----- | ------------------------- | ---------------- | --------- | ---------- |
-| **Fully managed** | ✅ | ❌ | ❌ | 🟠 | ✅ | ❌ | ✅ |
-| **Globally distributed** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
-| **Integrated with ORM client** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
-| **Redundancy** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
-
-**Why are these important?**
-
-- If you decide to manage a connection pooler yourself (eg. using pgbouncer or pgcat) you will also be responsible for managing its uptime. If the server crashes, your application may be down until you recover it. Accelerate, as a fully managed solution will be recovered for you transparently, in the unlikely case of any infrastructure issue.
-- The hosted pgbouncer option on Digital Ocean is semi-managed, you will need to set it up in your Digital Ocean account, and ensure it is running smoothly at all times.
-- Redundancy is helpful in the unlikely scenario that your connection pool service goes down. With Accelerate, it is automatically and seamlessly handed over to another server and recovered without any interruption.
-
-### Performance
-
-| | Accelerate | pgbouncer | pgcat | Digital Ocean (pgbouncer) | Neon (pgbouncer) | Supavisor | Hyperdrive |
-| ------------------------------- | ---------- | --------- | ----- | ------------------------- | ---------------- | --------- | ---------- |
-| **Auto scaling** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
-| **Globally distributed** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
-| **Optimized queries over HTTP** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
-| **Isolated compute** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
-
-**Why are these important?**
-
-- Accelerate will automatically scale up and down to suit your application workload, meaning you'll never run out of compute resource. Additionally, this provides important redundancy to protect against any single compute instance failing — in the unlikely event of an instance going down, Accelerate will automatically spawn a new instance.
-- Cross-region TCP handshakes between the application server and PgBouncer or the database are costly and time-consuming. If connections are reused only at the PgBouncer layer, the TCP handshake and connection setup still consume unnecessary time on every single request, which undermines the efficiency of connection reuse. Prisma Accelerate improves this by leveraging HTTP, which is more efficient for connection management. It reduces the overhead associated with TCP handshakes, resulting in faster, more responsive interactions between your application and the database.
-- Never worry about 'noisy neighbors' with isolated compute resources. Other customers never impact on your own performance.
-
-### Database Support
-
-| | Accelerate | pgbouncer | pgcat | Digital Ocean (pgbouncer) | Neon (pgbouncer) | Supavisor | Hyperdrive |
-| --------------- | ---------- | --------- | ----- | ------------------------- | ---------------- | --------- | ---------- |
-| **PostgreSQL** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
-| **MySQL** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
-| **PlanetScale** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
-| **CockroachDB** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
-| **MongoDB** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
diff --git a/apps/docs/content/docs.v6/accelerate/connection-pooling.mdx b/apps/docs/content/docs.v6/accelerate/connection-pooling.mdx
deleted file mode 100644
index 68a0c6bd4b..0000000000
--- a/apps/docs/content/docs.v6/accelerate/connection-pooling.mdx
+++ /dev/null
@@ -1,10 +0,0 @@
----
-title: Connection Pooling
-description: Learn about everything you need to know to use Accelerate's connection pooling.
-url: /v6/accelerate/connection-pooling
-metaTitle: 'Prisma Accelerate: Connection Pooling'
-metaDescription: Learn about everything you need to know to use Accelerate's connection pooling.
----
-
-Accelerate provides built-in connection pooling to efficiently manage database connections. It's included as part of [Prisma Postgres](/v6/postgres), but you can also use it with your own database by enabling Accelerate in the [Prisma Data Platform](https://console.prisma.io?utm_source=docs) and [connecting it to your database](/v6/accelerate/getting-started).
-This page has moved, connection pooling in Prisma Accelerate is now documented in the [Prisma Postgres section](/v6/postgres/database/connection-pooling).
diff --git a/apps/docs/content/docs.v6/accelerate/evaluating.mdx b/apps/docs/content/docs.v6/accelerate/evaluating.mdx
deleted file mode 100644
index 4d21c1a969..0000000000
--- a/apps/docs/content/docs.v6/accelerate/evaluating.mdx
+++ /dev/null
@@ -1,224 +0,0 @@
----
-title: Evaluating
-description: Learn about evaluating Prisma Accelerate.
-url: /v6/accelerate/evaluating
-metaTitle: 'Accelerate: Evaluating'
-metaDescription: Learn about evaluating Prisma Accelerate.
----
-
-Prisma Accelerate optimizes database interactions through advanced connection pooling and global edge caching. Its connection pooler is available in 16 regions and helps applications load-balance and scale database requests based on demand.
-
-Considering the information above, we recommend evaluating Accelerate with high volume to see it perform under load.
-
-## How Accelerate's connection pool optimizes performance under load
-
-Prisma Accelerate employs a dynamic, serverless connection pooling infrastructure. When a request is made, a connection pool is quickly provisioned for the project in the region assigned while configuring Prisma Accelerate. This connection pool remains active, serving many additional requests while reusing established database connections. The connection pool will disconnect after a period of inactivity, so it’s important to evaluate Prisma Accelerate with a consistent stream of traffic.
-
-**Key Benefits:**
-
-- **Optimized Query Performance:** The serverless connection pooler adapts to the query load, ensuring the database connections are managed efficiently during peak demand.
-
- > Prisma Accelerate’s connection pooler cannot improve the performance of queries in the database. In scenarios where query performance is an issue, we recommend optimizing the Prisma query, applying indexes, or utilizing Accelerate’s edge caching.
-
-- **Maximize Connection Reuse:** Executing a consistent volume of queries helps maintain active instances of Accelerate connection poolers. This increases connection reuse, ensuring faster response times for subsequent queries.
-
-By understanding and harnessing this mechanism, you can ensure that your database queries perform consistently and efficiently at scale.
-
-## Evaluating Prisma Accelerate connection pooling performance
-
-Below you will find an example of how to evaluate Prisma Accelerate using a sample model:
-
-```prisma
-model Notes {
- id Int @id @default(autoincrement())
- title String
- createdAt DateTime @default(now())
- updatedAt DateTime? @updatedAt
-}
-```
-
-```typescript
-import { PrismaClient } from "@prisma/client";
-import { withAccelerate } from "@prisma/extension-accelerate";
-
-const prisma = new PrismaClient().$extends(withAccelerate());
-
-function calculateStatistics(numbers: number[]): {
- average: number;
- p50: number;
- p75: number;
- p99: number;
-} {
- if (numbers.length === 0) {
- throw new Error("The input array is empty.");
- }
-
- // Sort the array in ascending order
- numbers.sort((a, b) => a - b);
-
- const sum = numbers.reduce((acc, num) => acc + num, 0);
- const count = numbers.length;
-
- const average = sum / count;
- const p50 = getPercentile(numbers, 50);
- const p75 = getPercentile(numbers, 75);
- const p99 = getPercentile(numbers, 99);
-
- return { average, p50, p75, p99 };
-}
-
-function getPercentile(numbers: number[], percentile: number): number {
- if (percentile <= 0 || percentile >= 100) {
- throw new Error("Percentile must be between 0 and 100.");
- }
-
- const index = (percentile / 100) * (numbers.length - 1);
- if (Number.isInteger(index)) {
- // If the index is an integer, return the corresponding value
- return numbers[index];
- } else {
- // If the index is not an integer, interpolate between two adjacent values
- const lowerIndex = Math.floor(index);
- const upperIndex = Math.ceil(index);
- const lowerValue = numbers[lowerIndex];
- const upperValue = numbers[upperIndex];
- const interpolationFactor = index - lowerIndex;
- return lowerValue + (upperValue - lowerValue) * interpolationFactor;
- }
-}
-
-async function main() {
- const timings = [];
-
- // fire a query before going to the loop
- await prisma.notes.findMany({
- take: 20,
- });
-
- // we recommend evaluationg Prisma Accelerate with a large loop
- const LOOP_LENGTH = 10000;
-
- for (let i = 0; i < LOOP_LENGTH; i++) {
- const start = Date.now();
- await prisma.notes.findMany({
- take: 20,
- });
-
- timings.push(Date.now() - start);
- }
-
- const statistics = calculateStatistics(timings);
- console.log("Average:", statistics.average);
- console.log("P50:", statistics.p50);
- console.log("P75:", statistics.p75);
- console.log("P99:", statistics.p99);
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch((e) => {
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-## Evaluating Prisma Accelerate caching performance
-
-Prisma Accelerate’s edge cache is also optimized for a high volume of queries. The cache automatically optimizes for repeated queries. As a result, the cache hit rate will increase as the query frequency does. Adding a query result to the cache is also non-blocking, so a short burst of queries might not utilize the cache or a sustained load.
-
-To evaluate Accelerate’s edge caching, you can modify the above script with the below:
-
-```typescript
-import { PrismaClient } from "@prisma/client";
-import { withAccelerate } from "@prisma/extension-accelerate";
-
-const prisma = new PrismaClient().$extends(withAccelerate());
-
-function calculateStatistics(numbers: number[]): {
- average: number;
- p50: number;
- p75: number;
- p99: number;
-} {
- if (numbers.length === 0) {
- throw new Error("The input array is empty.");
- }
-
- // Sort the array in ascending order
- numbers.sort((a, b) => a - b);
-
- const sum = numbers.reduce((acc, num) => acc + num, 0);
- const count = numbers.length;
-
- const average = sum / count;
- const p50 = getPercentile(numbers, 50);
- const p75 = getPercentile(numbers, 75);
- const p99 = getPercentile(numbers, 99);
-
- return { average, p50, p75, p99 };
-}
-
-function getPercentile(numbers: number[], percentile: number): number {
- if (percentile <= 0 || percentile >= 100) {
- throw new Error("Percentile must be between 0 and 100.");
- }
-
- const index = (percentile / 100) * (numbers.length - 1);
- if (Number.isInteger(index)) {
- // If the index is an integer, return the corresponding value
- return numbers[index];
- } else {
- // If the index is not an integer, interpolate between two adjacent values
- const lowerIndex = Math.floor(index);
- const upperIndex = Math.ceil(index);
- const lowerValue = numbers[lowerIndex];
- const upperValue = numbers[upperIndex];
- const interpolationFactor = index - lowerIndex;
- return lowerValue + (upperValue - lowerValue) * interpolationFactor;
- }
-}
-
-async function main() {
- const timings = [];
-
- // fire a query before going to the loop
- await prisma.notes.findMany({
- take: 20,
- cacheStrategy: {
- ttl: 30,
- },
- });
-
- // we recommend evaluating Prisma Accelerate with a large loop
- const LOOP_LENGTH = 10000;
-
- for (let i = 0; i < LOOP_LENGTH; i++) {
- const start = Date.now();
- await prisma.notes.findMany({
- take: 20,
- cacheStrategy: {
- ttl: 30,
- },
- });
-
- timings.push(Date.now() - start);
- }
-
- const statistics = calculateStatistics(timings);
- console.log("Average:", statistics.average);
- console.log("P50:", statistics.p50);
- console.log("P75:", statistics.p75);
- console.log("P99:", statistics.p99);
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch((e) => {
- await prisma.$disconnect();
- process.exit(1);
- });
-```
diff --git a/apps/docs/content/docs.v6/accelerate/examples.mdx b/apps/docs/content/docs.v6/accelerate/examples.mdx
deleted file mode 100644
index b3a2f92a80..0000000000
--- a/apps/docs/content/docs.v6/accelerate/examples.mdx
+++ /dev/null
@@ -1,20 +0,0 @@
----
-title: Prisma Accelerate examples
-description: Check out ready-to-run examples for Prisma Accelerate.
-url: /v6/accelerate/examples
-metaTitle: 'Prisma Accelerate: Examples'
-metaDescription: Check out ready-to-run examples for Prisma Accelerate.
----
-
-Here is a list of ready-to-run example projects that demonstrate how to use Prisma Accelerate:
-
-| Demo | Description |
-| ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
-| [`nextjs-starter`](https://github.com/prisma/prisma-examples/tree/latest/accelerate/nextjs-starter) | A Next.js project using Prisma Accelerate's caching and connection pooling |
-| [`svelte-starter`](https://github.com/prisma/prisma-examples/tree/latest/accelerate/svelte-starter) | A SvelteKit project using Prisma Accelerate's caching and connection pooling |
-| [`solidstart-starter`](https://github.com/prisma/prisma-examples/tree/latest/accelerate/solidstart-starter) | A Solidstart project using Prisma Accelerate's caching and connection pooling |
-| [`remix-starter`](https://github.com/prisma/prisma-examples/tree/latest/accelerate/remix-starter) | A Remix project using Prisma Accelerate's caching and connection pooling |
-| [`nuxt-starter`](https://github.com/prisma/prisma-examples/tree/latest/accelerate/nuxtjs-starter) | A Nuxt.js project using Prisma Accelerate's caching and connection pooling |
-| [`astro-starter`](https://github.com/prisma/prisma-examples/tree/latest/accelerate/astro-starter) | An Astro project using Prisma Accelerate's caching and connection pooling |
-| [`accelerate-hacker-news`](https://github.com/prisma/prisma-examples/tree/latest/accelerate/accelerate-hacker-news) | A simple Hacker News clone built with Prisma Accelerate, demonstrating the use of on-demand cache invalidation |
-| [`prisma-accelerate-invalidation`](https://github.com/prisma/prisma-accelerate-invalidation) | An app demonstrating how long it takes to invalidate a cached query result using on-demand cache invalidation. |
diff --git a/apps/docs/content/docs.v6/accelerate/faq.mdx b/apps/docs/content/docs.v6/accelerate/faq.mdx
deleted file mode 100644
index 699d09ab37..0000000000
--- a/apps/docs/content/docs.v6/accelerate/faq.mdx
+++ /dev/null
@@ -1,221 +0,0 @@
----
-title: Accelerate FAQ
-description: Frequently asked questions about Accelerate.
-url: /v6/accelerate/faq
-metaTitle: 'Accelerate: FAQ'
-metaDescription: Frequently asked questions about Accelerate.
----
-
-## When should I enable static IP for Prisma Accelerate?
-
-Enable static IP for Accelerate when your security setup requires IP allowlisting or if you're implementing firewalls that only permit access from trusted IPs, ensuring controlled and secure database connections.
-
-
-
-Learn more on [how to enable static IP for Accelerate in the Platform Console](/v6/accelerate/static-ip).
-
-:::info
-**What is a static IP?**
-
-A static IP address is an IPv4 or an IPv6 address that is fixed. Unlike dynamic IP addresses, which can change unpredictably, traffic from static IP addresses can be easily identified.
-
-
-:::
-
-> ℹ️ To enable static IP support for Accelerate within your existing or new project environment, your workspace will need to be on our **Pro** or **Business** plans. Take a look at the [pricing page](https://www.prisma.io/pricing#accelerate) for more information.
-
-## Why do I sometimes see unexpected cache behavior?
-
-Accelerate's cache performs best when it observes a higher load from a project. Many cache operations, such as committing data to cache and refreshing stale data, happen asynchronously. When benchmarking Accelerate, we recommend doing so with loops or a load testing approach. This will mimic higher load scenarios better and reduce outliers from low frequency operations.
-
-Prisma operations are sent to Accelerate over HTTP. As a result, the first request to Accelerate must establish an HTTP handshake and may have additional latency as a result. We're exploring ways to reduce this initial request latency in the future.
-
-## What is the pricing of Accelerate?
-
-You can find more details on our [Accelerate pricing page](https://www.prisma.io/pricing)
-
-## VS Code does not recognize the `$extends` method
-
-If you add the Prisma Client extension for Accelerate to an existing project that is currently open in VS Code, the editor might not immediately recognize the `$extends` method.
-
-This might be an issue with the TypeScript server not yet recognizing the regenerated Prisma Client. To resolve this, you need to restart TypeScript.
-
-1. In VS Code, open the Command Palette. You can do so when you press F1 or select **View** > **Command Palette**.
-2. Enter `typescript` and select and run the **TypeScript: Restart TS server** command.
-
-VS Code should now recognize the `$extends` method.
-
-## What regions are Accelerate's cache nodes available in?
-
-Accelerate runs on Cloudflare's network and cache hits are served from Cloudflare's 300+ locations. You can find the regions where Accelerate's cache nodes are available here: [https://www.cloudflare.com/network/](https://www.cloudflare.com/network/).
-
-## What regions is Accelerate's connection pool available in?
-
-When no cache strategy is specified or in the event of a cache miss, the Prisma Client query is routed through Accelerate's connection pool. Currently, queries can be routed through any chosen region among the 16 available locations.
-
-Currently, the list of available regions are:
-
-- Asia Pacific, Mumbai (`ap-south-1`)
-- Asia Pacific, Seoul (`ap-northeast-2`)
-- Asia Pacific, Singapore (`ap-southeast-1`)
-- Asia Pacific, Sydney (`ap-southeast-2`)
-- Asia Pacific, Tokyo (`ap-northeast-1`)
-- Canada, Central (`ca-central-1`)
-- Europe, Frankfurt (`eu-central-1`)
-- Europe, Ireland (`eu-west-1`)
-- Europe, London (`eu-west-2`)
-- Europe, Paris (`eu-west-3`)
-- Europe, Stockholm (`eu-north-1`)
-- South America, Sao Paulo (`sa-east-1`)
-- US East, N. Virginia (`us-east-1`)
-- US East, Ohio (`us-east-2`)
-- US West, N. California (`us-west-1`)
-- US West, Oregon (`us-west-2`)
-
-You can also view the available regions when you're about to set up Accelerate or by visiting the **Settings** tab for Accelerate under the **Region** section in the Prisma Cloud Platform [dashboard](https://pris.ly/pdp).
-
-## How does Accelerate know what region to fetch the cache from?
-
-Under the hood, Accelerate uses Cloudflare, which uses [Anycast](https://www.cloudflare.com/learning/cdn/glossary/anycast-network/) for network addressing and routing. An incoming request will be routed to the nearest data center or "node" in their network that has the capacity to process the request efficiently. To learn more about how this works, we recommend looking into [Anycast](https://www.cloudflare.com/learning/cdn/glossary/anycast-network/).
-
-## How can I invalidate a cache on Accelerate?
-
-You can invalidate the cache on-demand via the [`$accelerate.invalidate` API](/v6/accelerate/api-reference#accelerateinvalidate) if you're on a [paid plan](https://www.prisma.io/pricing#accelerate), or you can invalidate your entire cache, on a project level, a maximum of five times a day. This limit is set based on [your plan](https://www.prisma.io/pricing#accelerate). You can manage this via the Accelerate configuration page.
-
-## What is Accelerate's consistency model?
-
-Accelerate does not have a consistency model. It is not a distributed system where nodes need to reach a consensus (because data is only stored in the cache node(s) closest to the user). However, the data cached in Accelerate's cache nodes doesn't propagate to other nodes, so Accelerate by design doesn't need a consistency model.
-
-Accelerate implements a [read-through caching strategy](https://www.prisma.io/dataguide/managing-databases/introduction-database-caching#read-through) particularly suitable for read-heavy workloads.
-
-The freshness of the data served by the cache depends on the cache strategy defined in your query. Refer to [this section](/v6/postgres/database/caching#selecting-a-cache-strategy) for more information on selecting the right cache strategy for your query.
-
-## How is Accelerate different from other caching tools, such as Redis?
-
-- Accelerate is a _specialized_ cache that allows you to optimize data access in code at the query level with a cache strategy. On the other hand, tools such as Redis and Memcached are _general-purpose_ caches designed to be adaptable and flexible.
-- Accelerate is a managed service that reduces the time, risk, and engineering effort of building and maintaining a cache service.
-- By default, Accelerate is globally distributed, reducing the latency of your queries. Other cache tools would require additional configuration to make them available globally.
-
-## When should I not use Accelerate's caching features?
-
-Accelerate is a global data cache and connection pool that allows you to optimize data access in code at the query level. While caching with Accelerate can greatly boost the performance of your app, it may not always the best choice for your use case.
-
-Accelerate's global cache feature may not be a good fit for your app if:
-
-- Your app is exclusively used within a specific region and both your application server and database are situated in that same region on the same network. For example, database queries will likely be much faster if your application server and database are in the same region and network. However, If your application server is in different regions or networks from your database, Accelerate will speed up your queries because the data will be cached in the closest data center to your application.
-
-- You _only_ need a general-purpose cache. Accelerate is a connection pooler and a _specialized cache_ that only caches your database query responses in code. A general-purpose cache, such as Redis, would allow you to cache data from multiple sources, such as external APIs, which Accelerate currently doesn't support. If general-purpose caching interests you, please share your feedback with us via our [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=inline_text).
-
-- Your application data _always_ needs to be up-to-date on retrieval, making it difficult to establish a reasonable cache strategy.
-
-Even without using Accelerate's global cache, you can still greatly benefit from Accelerate by using its connection pool, especially in serverless or edge functions, where it is difficult to manage and scale database connections. You can learn more about the serverless challenge [here](/v6/orm/prisma-client/setup-and-configuration/databases-connections#the-serverless-challenge).
-
-## Can I use Accelerate with other ORMs/query builders/drivers?
-
-No. We currently do not have any plans for supporting other ORMs/query builders or drivers. However, if you're interested in support for other libraries, feel free to reach out and let us know in our [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=inline_text) community in the `#help-and-questions` channel.
-
-## What is the maximum allowed value for the `ttl` parameter when configuring `cacheStrategy`?
-
-The [Time-to-live](/v6/postgres/database/caching#time-to-live-ttl) (`ttl`) parameter can be set for up to a _year_. However, it's important to note that items within the cache may be evicted if they are not frequently accessed.
-
-Based on our experimentation, we’ve seen cache items persist for around 18 hours. While items may remain in the cache for an extended period if they are actively accessed, there is no guarantee.
-
-> **Note**: Even frequently accessed items may occasionally be evicted from the cache. It's unlikely for an item to survive for up to or longer than a month, regardless of its activity level.
-
-## Why doesn’t Accelerate fall back to the direct connection string during a service disruption?
-
-In the rare event of a service disruption, falling back to a direct connection would bypass the connection pool. This could potentially deplete the database's available connections and cause other issues on the database level.
-
-If there is a service disruption, it's recommended to verify on the [status page](https://pris.ly/data-platform-status). You can reach out to one of Prisma's [support channels](/v6/platform/support) for assistance.
-
-> **Note:** Additionally, it's worth noting that some edge function runtime environments may not support direct connections with Prisma ORM. For further details, refer to our [Edge functions documentation](/v6/orm/prisma-client/deployment/edge/overview).
-
-## Are each of the queries within an interactive transaction counted separately for billing?
-
-Yes, [interactive transactions](/v6/orm/prisma-client/queries/transactions#interactive-transactions) are billed based on the individual operations within the transaction. There is no charge for the start, commit, or rollback of the transaction itself. For example, in the following query, there are two billable queries:
-
-```ts
-await prisma.$transaction(async (tx) => {
- await tx.user.deleteMany({ where: { name: "John Doe" } });
- await tx.user.createMany({ data });
-});
-```
-
-However, when using the [`$transaction` API for sequential client operations](/v6/orm/prisma-client/queries/transactions#sequential-prisma-client-operations), regardless of the number of queries within the array, it counts as only one billable query. For example:
-
-```ts
-await prisma.$transaction([
- prisma.user.deleteMany({ where: { name: "John Doe" } }),
- prisma.user.createMany({ data }),
-]);
-```
-
-If you don't need [interactive transactions](/v6/orm/prisma-client/queries/transactions#interactive-transactions), you can save costs and improve performance by using [sequential operations transactions](/v6/orm/prisma-client/queries/transactions#sequential-prisma-client-operations). Sequential operations transactions perform better on Accelerate because they execute in one round-trip to the database, while interactive transactions require separate round-trips for start, commit, and each individual operation on the transaction.
-
-## Can I increase my Accelerate query duration and response size limits?
-
-Yes, you can increase your Accelerate limits based on your subscription plan. Here are the configurable limits:
-
-| Limit | Free | Starter | Pro Plan | Business Plan |
-| ------------------------------------ | ---------------- | ---------------- | ---------------- | ---------------- |
-| **Query timeout** | Up to 10 seconds | Up to 10 seconds | Up to 20 seconds | Up to 60 seconds |
-| **Interactive transactions timeout** | Up to 15 seconds | Up to 15 seconds | Up to 30 seconds | Up to 90 seconds |
-| **Response size** | Up to 5 MB | Up to 5 MB | Up to 10 MB | Up to 20 MB |
-
-Check the [pricing page](https://www.prisma.io/pricing#accelerate) for more details on the available plans and their corresponding limits.
-
-:::warning
-While you can increase these limits based on your subscription plan, it's _still_ recommended to optimize your database operations. [Learn more in our troubleshooting guide.](/v6/postgres/database/api-reference/error-reference)
-:::
-
-## How long does it take to invalidate a cache query result?
-
-As the cache needs to be cleared globally, it is difficult to provide a specific time frame. However, the cached data is eventually consistent and typically propagates to all PoPs within a few seconds. In very rare cases, it may take longer.
-
-Here is a [demo app](https://pris.ly/test-cache-invalidation) to test the time it takes to invalidate a cache query result.
-
-## What is the difference between **Invalidate** and **Revalidate**?
-
-**Invalidate**: The cache entry is deleted, and new data will be fetched on the next request, causing a cache miss. This removes stale data but may lead to slower responses until the cache is repopulated.
-
-**Revalidate**: The cache entry is updated proactively, ensuring the next request uses fresh data from the cache. This keeps the cache valid and maintains faster response times by avoiding cache misses.
-
-## What is on-demand cache invalidation?
-
-[On-demand cache invalidation](/v6/postgres/database/caching#on-demand-cache-invalidation) lets applications instantly update specific cached data when it changes, instead of waiting for regular cache refresh cycles. This keeps information accurate and up-to-date for users.
-
-## When should I use the cache invalidate API?
-
-The [cache invalidate API](/v6/postgres/database/caching#on-demand-cache-invalidation) is essential when data consistency cannot wait for the cache’s standard expiration or revalidation. Key use cases include:
-
-- **Content updates**: When critical changes occur, such as edits to a published article, product updates, or profile modifications, that need to be visible immediately.
-- **Inventory management**: In real-time applications, like inventory or booking systems, where stock levels, availability, or reservation statuses must reflect the latest information.
-- **High-priority data**: For time-sensitive data, like breaking news or urgent notifications, where it’s essential for users to see the most current information right away.
-
-Using on-demand cache invalidation in these scenarios helps keep only the necessary data refreshed, preserving system performance while ensuring accurate, up-to-date information for users.
-
-## How does Accelerate count queries for billing?
-
-Accelerate counts queries at the Prisma Client invocation level. A single Prisma query may translate into multiple SQL statements under the hood, but it will only count as one query for billing purposes. This ensures straightforward, predictable billing that reflects the Prisma Client usage rather than the complexity of the underlying SQL operations.
-
-Queries are counted regardless of whether they are served from the cache or the database. Even if a query is retrieved from the cache, it still counts toward your query limit.
-
-## How do I switch from GitHub login to email and password login?
-
-If you previously signed up using GitHub and want to switch to email and password login, follow these steps:
-
-### 1. Verify Your GitHub Email Address
-
-- Check the primary email address associated with your GitHub account (e.g., from your GitHub profile or notification settings).
-
-### 2. Create a New Email/Password Account
-
-- Go to the email/password sign-up page.
-- Use the **same email address** linked to your GitHub account to create the new account.
-- Our system will automatically connect your new email/password account to your existing data.
-
-### 3. Test Your Login
-
-- Log out and try logging in with your email and the password you just created.
-
-> **Note**: If you encounter any issues, please contact our support team for help linking your accounts.
diff --git a/apps/docs/content/docs.v6/accelerate/feedback.mdx b/apps/docs/content/docs.v6/accelerate/feedback.mdx
deleted file mode 100644
index e2742de529..0000000000
--- a/apps/docs/content/docs.v6/accelerate/feedback.mdx
+++ /dev/null
@@ -1,9 +0,0 @@
----
-title: Feedback
-description: Learn where to submit feedback about Accelerate.
-url: /v6/accelerate/feedback
-metaTitle: 'Accelerate: Feedback'
-metaDescription: Learn where to submit feedback about Accelerate.
----
-
-You can submit any feedback about Accelerate in our [Discord server](https://pris.ly/discord?utm_source=docs&utm_medium=intro_text).
diff --git a/apps/docs/content/docs.v6/accelerate/getting-started.mdx b/apps/docs/content/docs.v6/accelerate/getting-started.mdx
deleted file mode 100644
index 7284e7ba98..0000000000
--- a/apps/docs/content/docs.v6/accelerate/getting-started.mdx
+++ /dev/null
@@ -1,252 +0,0 @@
----
-title: Getting started with Prisma Accelerate
-description: Learn how to get up and running with Prisma Accelerate.
-url: /v6/accelerate/getting-started
-metaTitle: Getting started with Prisma Accelerate
-metaDescription: Learn how to get up and running with Prisma Accelerate.
----
-
-## Prerequisites
-
-To get started with Accelerate, you will need the following:
-
-- A [Prisma Data Platform account](https://console.prisma.io)
-- A project that uses [Prisma Client](/v6/orm/prisma-client/setup-and-configuration/introduction) `4.16.1` or higher. If your project is using interactive transactions, you need to use `5.1.1` or higher. (We always recommend using the latest version of Prisma.)
-- A hosted PostgreSQL, MySQL/MariaDB, PlanetScale, CockroachDB, or MongoDB database
-
-## 1. Enable Accelerate
-
-Navigate to your Prisma Data Platform project, choose an environment, and enable Accelerate by providing your database connection string and selecting the region nearest your database.
-
-:::note
-
-If you require IP allowlisting or firewall configurations with trusted IP addresses, enable Static IP for enhanced security. Learn more on [how to enable static IP for Accelerate in the Platform Console](/v6/accelerate/static-ip).
-
-:::
-
-## 2. Add Accelerate to your application
-
-### 2.1. Update your database connection string
-
-Once enabled, you'll be prompted to generate a connection string that you'll use to authenticate requests.
-
-Replace your direct database url with your new Accelerate connection string.
-
-```bash title=".env"
-# New Accelerate connection string
-DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=__API_KEY__"
-
-# Previous (direct) database connection string
-# DATABASE_URL="postgresql://user:password@host:port/db_name?schema=public"
-```
-
-Prisma Client reads the `prisma://` URL from `DATABASE_URL` at runtime, while Prisma CLI commands use the connection string defined in `prisma.config.ts`.
-
-Prisma Migrate and Introspection do not work with a `prisma://` connection string. In order to continue using these features add a new variable to the `.env` file named `DIRECT_DATABASE_URL` whose value is the direct database connection string:
-
-```bash title=".env"
-DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=__API_KEY__"
-DIRECT_DATABASE_URL="postgresql://user:password@host:port/db_name?schema=public" # [!code ++]
-```
-
-Then point `prisma.config.ts` to the direct connection string:
-
-```ts title="prisma.config.ts" showLineNumbers
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- datasource: {
- url: env("DIRECT_DATABASE_URL"),
- },
-});
-```
-
-Migrations and introspections will use the `directUrl` connection string rather than the one defined in `url` when this configuration is provided.
-
-> `directUrl` is useful for you to carry out migrations and introspections. However, you don't need `directUrl` to use Accelerate in your application.
-
-:::note
-If you are using Prisma with PostgreSQL, there is no need for `directUrl`, as Prisma Migrate and Introspection work with the `prisma+postgres://` connection string.
-:::
-
-### 2.2. Install the Accelerate Prisma Client extension
-
-:::info
-
-💡 Accelerate requires [Prisma Client](/v6/orm/prisma-client/setup-and-configuration/introduction) version `4.16.1` or higher and [`@prisma/extension-accelerate`](https://www.npmjs.com/package/@prisma/extension-accelerate) version `1.0.0` or higher.
-
-💡 Accelerate extension [`@prisma/extension-accelerate`](https://www.npmjs.com/package/@prisma/extension-accelerate) version `2.0.0` and above requires Node.js version `18` or higher.
-
-:::
-
-Install the latest version of Prisma Client and Accelerate Prisma Client extension
-
-```npm
-npm install @prisma/client@latest @prisma/extension-accelerate
-```
-
-### 2.3. Generate Prisma Client for Accelerate
-
-If you're using Prisma version `5.2.0` or greater, Prisma Client will automatically determine how it should connect to the database depending on the protocol in the database connection string. If the connection string in the `DATABASE_URL` starts with `prisma://`, Prisma Client will try to connect to your database using Prisma Accelerate.
-
-When using Prisma Accelerate in long-running application servers, such as a server deployed on AWS EC2, you can generate the Prisma Client by executing the following command:
-
-```npm
-npx prisma generate
-```
-
-When using Prisma Accelerate in a Serverless or an Edge application, we recommend you to run the following command to generate Prisma Client:
-
-```npm
-npx prisma generate --no-engine
-```
-
-The `--no-engine` flag prevents a Query Engine file from being included in the generated Prisma Client, this ensures the bundle size of your application remains small.
-
-:::warning
-
-If your Prisma version is below `5.2.0`, generate Prisma Client with the `--accelerate` option:
-
-```npm
-npx prisma generate --accelerate
-```
-
-If your Prisma version is below `5.0.0`, generate Prisma Client with the `--data-proxy` option:
-
-```npm
-npx prisma generate --data-proxy
-```
-
-:::
-
-### 2.4. Extend your Prisma Client instance with the Accelerate extension
-
-Add the following to extend your existing Prisma Client instance with the Accelerate extension:
-
-```ts
-import { PrismaClient } from "@prisma/client";
-import { withAccelerate } from "@prisma/extension-accelerate";
-
-const prisma = new PrismaClient({
- accelerateUrl: process.env.DATABASE_URL,
-}).$extends(withAccelerate());
-```
-
-If you are going to deploy to an edge runtime (like Cloudflare Workers, Vercel Edge Functions, Deno Deploy, or Supabase Edge Functions), use our edge client instead:
-
-```ts
-import { PrismaClient } from "@prisma/client/edge";
-import { withAccelerate } from "@prisma/extension-accelerate";
-
-const prisma = new PrismaClient({
- accelerateUrl: process.env.DATABASE_URL,
-}).$extends(withAccelerate());
-```
-
-If VS Code does not recognize the `$extends` method, refer to [this section](/v6/accelerate/faq#vs-code-does-not-recognize-the-extends-method) on how to resolve the issue.
-
-#### Using the Accelerate extension with other extensions
-
-Since [extensions are applied one after another](/v6/orm/prisma-client/client-extensions#conflicts-in-combined-extensions), make sure you apply them in the correct order. Extensions cannot share behavior and the last extension applied takes precedence.
-
-If you are using [Query Insights](/query-insights) in your application, make sure you apply it _before_ the Accelerate extension. For example:
-
-```ts
-const prisma = new PrismaClient({
- accelerateUrl: process.env.DATABASE_URL,
-})
- .$extends(withOptimize())
- .$extends(withAccelerate());
-```
-
-### 2.5. Use Accelerate in your database queries
-
-The `withAccelerate` extension primarily does two things:
-
-- Gives you access to the `cacheStrategy` field within each applicable model method that allows you to define a cache strategy per-query.
-- Routes all of your queries through a connection pooler.
-
-#### No cache strategy to only use connection pool
-
-If you simply want to take advantage of Accelerate's connection pooling feature without applying a cache strategy, you may run your query the same way you would have without Accelerate.
-
-By enabling Accelerate and supplying the Accelerate connection string, your queries now use the connection pooler by default.
-
-#### Define a cache strategy
-
-Update a query with the new `cacheStrategy` property which allows you to define a cache strategy for that specific query:
-
-```ts
-const user = await prisma.user.findMany({
- where: {
- email: {
- contains: "alice@prisma.io",
- },
- },
- cacheStrategy: { swr: 60, ttl: 60 },
-});
-```
-
-In the example above, `swr: 60` and `ttl: 60` means Accelerate will serve cached data for 60 seconds and then another 60 seconds while Accelerate fetches fresh data in the background.
-
-You should now see improved performance for your cached queries.
-
-For information about which strategy best serves your application, see [Select a cache strategy](/v6/postgres/database/caching#selecting-a-cache-strategy).
-
-:::info
-
-As of Prisma version `5.2.0` you can use Prisma Studio with the Accelerate connection string.
-
-:::
-
-#### Invalidate the cache and keep your cached query results up-to-date
-
-If your application requires real-time or near-real-time data, cache invalidation ensures that users see the most current data, even when using a large `ttl` (Time-To-Live) or `swr` (Stale-While-Revalidate) [cache strategy](/v6/postgres/database/caching#cache-strategies). By invalidating your cache, you can bypass extended caching periods to show live data whenever it's needed.
-
-For example, if a dashboard displays customer information and a customer’s contact details change, cache invalidation allows you to refresh only that data instantly, ensuring support staff always see the latest information without waiting for the cache to expire.
-
-To invalidate a cached query result, you can add tags and then use the `$accelerate.invalidate` API.
-
-:::note
-
-On-demand cache invalidation is available with our paid plans. For more details, please see our [pricing](https://www.prisma.io/pricing#accelerate).
-
-:::
-
-To invalidate the query below:
-
-```ts
-await prisma.user.findMany({
- where: {
- email: {
- contains: "alice@prisma.io",
- },
- },
- cacheStrategy: {
- swr: 60,
- ttl: 60,
- tags: ["emails_with_alice"], // [!code highlight]
- },
-});
-```
-
-You need to provide the cache tag in the `$accelerate.invalidate` API:
-
-```ts
-try {
- await prisma.$accelerate.invalidate({
- // [!code highlight]
- tags: ["emails_with_alice"], // [!code highlight]
- }); // [!code highlight]
-} catch (e) {
- if (e instanceof Prisma.PrismaClientKnownRequestError) {
- // The .code property can be accessed in a type-safe manner
- if (e.code === "P6003") {
- console.log("You've reached the cache invalidation rate limit. Please try again shortly.");
- }
- }
- throw e;
-}
-```
diff --git a/apps/docs/content/docs.v6/accelerate/index.mdx b/apps/docs/content/docs.v6/accelerate/index.mdx
deleted file mode 100644
index ac53dae537..0000000000
--- a/apps/docs/content/docs.v6/accelerate/index.mdx
+++ /dev/null
@@ -1,34 +0,0 @@
----
-title: Prisma Accelerate
-description: Prisma Accelerate is a global database cache with built-in connection pooling that helps improve database performance in Serverless and Edge applications.
-url: /v6/accelerate
-metaTitle: Prisma Accelerate
-metaDescription: Prisma Accelerate is a global database cache with built-in connection pooling that helps improve database performance in Serverless and Edge applications.
----
-
-[Prisma Accelerate](https://www.prisma.io/accelerate) is a fully managed global connection pool and caching layer for your existing database, enabling query-level cache policies directly from the Prisma ORM.
-
-With 15+ global regions, the connection pool scales your app for a global audience, particularly for serverless deployments that risk connection timeouts during peak times.
-
-Accelerate's global cache, hosted in 300+ locations, ensures a fast experience for users, regardless of your database's location.
-
-You can configure query-level caching strategies directly in your code with Prisma ORM, making setup and tuning easy.
-
-Together, the connection pool and cache allow you to scale effortlessly and handle traffic spikes without infrastructure concerns.
-
-## Supported databases
-
-Accelerate works with the database you already have, whether it is publicly accessible, or via an IP allowlist.
-
-- PostgreSQL
-- MySQL
-- MariaDB
-- PlanetScale
-- CockroachDB
-- MongoDB
-
-## Getting started
-
-- [Getting started](/v6/accelerate/getting-started) - Set up connection pooling and global caching
-- [Connection pooling](/v6/accelerate/connection-pooling) - Scale your database connections
-- [Caching](/v6/accelerate/caching) - Global database cache with TTL and SWR
diff --git a/apps/docs/content/docs.v6/accelerate/known-limitations.mdx b/apps/docs/content/docs.v6/accelerate/known-limitations.mdx
deleted file mode 100644
index 4ffe4eb5ab..0000000000
--- a/apps/docs/content/docs.v6/accelerate/known-limitations.mdx
+++ /dev/null
@@ -1,42 +0,0 @@
----
-title: Known limitations about Prisma Accelerate
-description: Learn about limitations of Accelerate.
-url: /v6/accelerate/known-limitations
-metaTitle: 'Accelerate: limitations'
-metaDescription: Learn about limitations of Accelerate.
----
-
-Below are descriptions of known limitations when using Accelerate. If you encounter any additional ones, please share them with us via [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=intro_text).
-
-## Cannot cache raw queries
-
-At the moment, it is not possible to cache the responses of [raw queries](/v6/orm/prisma-client/using-raw-sql/raw-queries).
-
-## Not compatible with the fluent API
-
-Client Extensions (which are used in Accelerate) currently do not correctly forward the [fluent API](/v6/orm/prisma-client/queries/relation-queries#fluent-api) types. We hope to get a fix into Client Extensions soon.
-
-## Not compatible with extremely heavy or long-running queries
-
-Accelerate is designed to work with high-performance, low-latency queries. It is not intended for use with extremely heavy or long-running queries that may cause performance issues or resource contention. While limits are configurable, we recommend optimizing your queries to ensure they fit within the recommended guidelines.
-
-For queries that cannot be optimized or pared down, we recommend one of two solutions:
-
-1. **Use the read replica extension**: The Prisma ORM [read replica extension](https://www.npmjs.com/package/@prisma/extension-read-replicas) allows you to set up two different connections: a `primary` and a `replica`. You can set up your Accelerate connection as the `primary` and then a direct connection as the `replica`. Any queries that are resource-intensive or long-running can then be routed to the `replica`, while the `primary` (your Accelerate connection) will handle normal queries. **Please note** that this solution requires you to both set up a direct connection and requires the full generated Prisma Client (i.e. without `--no-engine`).
-
-2. **Separate analytics queries**: Our preferred solution is to separate your analytics queries into a separate application. This separate application can then use a direct connection so that it can run heavy queries without impacting the performance or cost of your Accelerate-powered application.
-
-If you have a use case that requires running extremely heavy or long-running queries and Prisma Accelerate, please reach out to us.
-
-## Not compatible with direct IPv4 addresses in MongoDB connection strings
-
-Accelerate does not support direct IPv4 addresses in MongoDB connection strings. When an IPv4 address is provided, Accelerate converts it to an IPv6 format to route through its NAT gateway. This conversion may cause the connection string to be considered invalid due to the formatting of the port value.
-
-**Workaround**: To resolve this issue, create a DNS record that points to your IPv4 address and use that DNS record in your connection string instead of the direct IP.
-
-### Example
-
-- **IPv4 connection string** (not supported): `mongodb://user:password@192.168.1.100:27017/db_name`
-- **DNS record connection string** (supported): `mongodb://user:password@my-database.example.com:27017/db_name`
-
-For additional details on Accelerate’s IPv6-first design, refer to our [blog post](https://www.prisma.io/blog/accelerate-ipv6-first).
diff --git a/apps/docs/content/docs.v6/accelerate/local-development.mdx b/apps/docs/content/docs.v6/accelerate/local-development.mdx
deleted file mode 100644
index 657f161964..0000000000
--- a/apps/docs/content/docs.v6/accelerate/local-development.mdx
+++ /dev/null
@@ -1,62 +0,0 @@
----
-title: Local development for Prisma Accelerate
-description: Learn how to use Prisma Accelerate in a development environment.
-url: /v6/accelerate/local-development
-metaTitle: 'Accelerate: Local development'
-metaDescription: Learn how to use Prisma Accelerate in a development environment.
----
-
-Prisma Accelerate efficiently scales production traffic with integrated connection pooling and a global database cache.
-
-In development environments, you may want to use a local database to minimize expenses. Furthermore, you may consider extending Prisma Client with the Accelerate client extension once so that you can use a local database in development and a hosted database with Accelerate’s connection pooling and caching enabled. This eliminates the need for conditional logic to switch clients between development and production.
-
-This guide will explain how to use Prisma Accelerate client extension in a development environment with a local database.
-
-## Using Prisma Accelerate client extension in development and production
-
-
-
-
-
-Accelerate does not work with a local database. However, in a development environment, you can still use Prisma Client with the Accelerate client extension. This setup will not provide Accelerate's connection pooling and caching features.
-
-The following steps outline how to use Prisma ORM and Prisma Accelerate with a local PostgreSQL database.
-
-1. Update the `DATABASE_URL` environment variable with your local database's connection string:
-
- ```bash
- DATABASE_URL="postgres://username:password@127.0.0.1:5432/localdb"
- ```
-
-2. Generate a Prisma Client:
-
- ```npm
- npx prisma generate
- ```
-
- > Note: The `--no-engine` flag should only be used in preview and production environments. The command generates Prisma Client artifacts without a [Query Engine](/v6/orm/more/internals/engines) file, which requires an Accelerate connection string.
-
-3. Set up Prisma Client with the Accelerate client extension:
-
- ```typescript
- import { PrismaClient } from "@prisma/client";
- import { withAccelerate } from "@prisma/extension-accelerate";
-
- const prisma = new PrismaClient().$extends(withAccelerate());
- ```
-
- > The extended instance of Prisma Client will use the local database. Hence, Prisma Accelerate will not be used in your development environment to respond to your Prisma Client queries.
-
-
-
-If an Accelerate connection string is used as the `DATABASE_URL` environment variable, Prisma Client will route your queries through Accelerate.
-
-## Using Prisma Accelerate locally in an edge function
-
-When using an edge function, e.g., [Vercel's edge runtime](https://vercel.com/docs/functions/runtimes/edge-runtime), for your development environment, update your Prisma Client import as follows:
-
-```typescript
-import { PrismaClient } from "@prisma/client/edge";
-```
-
-Generally, edge function environments lack native support for existing APIs enabling TCP-based database connections. Prisma Accelerate provides a connection string that allows querying your database over HTTP, a protocol supported in all edge runtimes.
diff --git a/apps/docs/content/docs.v6/accelerate/meta.json b/apps/docs/content/docs.v6/accelerate/meta.json
deleted file mode 100644
index 6fab8f1bfa..0000000000
--- a/apps/docs/content/docs.v6/accelerate/meta.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "title": "Accelerate",
- "root": true,
- "pages": [
- "index",
- "getting-started",
- "caching",
- "connection-pooling",
- "local-development",
- "static-ip",
- "examples",
- "evaluating",
- "compare",
- "troubleshoot",
- "faq",
- "known-limitations",
- "api-reference",
- "feedback"
- ]
-}
diff --git a/apps/docs/content/docs.v6/accelerate/static-ip.mdx b/apps/docs/content/docs.v6/accelerate/static-ip.mdx
deleted file mode 100644
index f570a8e869..0000000000
--- a/apps/docs/content/docs.v6/accelerate/static-ip.mdx
+++ /dev/null
@@ -1,42 +0,0 @@
----
-title: Static IP
-description: Learn enabling Static IP for Prisma Accelerate.
-url: /v6/accelerate/static-ip
-metaTitle: Enable Static IP for Prisma Accelerate
-metaDescription: Learn enabling Static IP for Prisma Accelerate.
----
-
-You can enable static IP for Accelerate when your security setup requires IP allowlisting or if you're implementing firewalls that only permit access from trusted IPs, ensuring controlled and secure database connections.
-
-
-
-:::info
-
-To enable static IP support for Accelerate within an existing or a new project environment, your workspace will need to be on our Pro or Business plans. Take a look at the [pricing page](https://www.prisma.io/pricing#accelerate) for more information.
-
-:::
-
-## Enable static IP in Accelerate
-
-You can opt-in to use static IP for Accelerate in the [Platform Console](https://pris.ly/pdp) in two ways:
-
-### 1. When enabling Accelerate for your project environment:
-
-1. Specify your database connection string and connection pool region.
-2. Enable static IP by toggling the **Static IP** switch in the **Network restrictions** section.
-3. Click on the **Enable Accelerate** button.
-
-### 2. For projects already using Accelerate:
-
-1. Navigate to the Accelerate **Settings** tab in the project environment.
-2. Enable static IP by toggling the **Static IP** switch in the **Network restrictions** section.
-
-Enabling static IP for Accelerate will provide you with a list of static IPv4 and IPv6 addresses.
-
-Once you have these addresses, configure your database firewall to allow incoming connections only from these IPs and any other trusted IPs that need access to your database.
-
-:::note
-
-Since you cannot enable static IP for an existing Accelerate-enabled environment, we recommend opting for static IP when enabling Accelerate in a new environment. Use the same database URL as your existing Accelerate environment to instantly access static IP support for Accelerate.
-
-:::
diff --git a/apps/docs/content/docs.v6/accelerate/troubleshoot.mdx b/apps/docs/content/docs.v6/accelerate/troubleshoot.mdx
deleted file mode 100644
index 2e21373712..0000000000
--- a/apps/docs/content/docs.v6/accelerate/troubleshoot.mdx
+++ /dev/null
@@ -1,184 +0,0 @@
----
-title: Troubleshooting Prisma Accelerate issues
-description: Troubleshooting Prisma Accelerate.
-url: /v6/accelerate/troubleshoot
-metaTitle: 'Troubleshooting: Prisma Accelerate'
-metaDescription: Troubleshooting Prisma Accelerate.
----
-
-When working with Prisma Accelerate, you may encounter errors often highlighted by specific error codes during development and operations. It is important to understand the meaning of these errors, why they occur, and how to resolve them in order to ensure the smooth operation of your applications. This guide aims to provide insights and steps to troubleshoot specific error codes encountered with Prisma Accelerate.
-
-## [`P6009`](/v6/orm/reference/error-reference#p6009-responsesizelimitexceeded) (`ResponseSizeLimitExceeded`)
-
-This error is triggered when the response size from a database query exceeds [the configured query response size limit](/v6/postgres/database/connection-pooling#response-size-limit). We've implemented this restriction to safeguard your application performance, as retrieving data over 5MB can significantly slow down your application due to multiple network layers. Typically, transmitting more than 5MB of data is common when conducting ETL (Extract, Transform, Load) operations. However, for other scenarios such as transactional queries, real-time data fetching for user interfaces, bulk data updates, or aggregating large datasets for analytics outside of ETL contexts, it should generally be avoided. These use cases, while essential, can often be optimized to work within [the configured query response size limit](/v6/postgres/database/connection-pooling#response-size-limit), ensuring smoother performance and a better user experience.
-
-### Possible causes for [`P6009`](/v6/orm/reference/error-reference#p6009-responsesizelimitexceeded)
-
-#### Transmitting images/files in response
-
-This error may arise if images or files stored within your table are being fetched, resulting in a large response size. Storing assets directly in the database is generally discouraged because it significantly impacts database performance and scalability. In addition to performance, it makes database backups slow and significantly increases the cost of storing routine backups.
-
-**Suggested solution:** Configure the [query response size limit](/v6/postgres/database/connection-pooling#response-size-limit) to be larger. If the limit is still exceeded, consider storing the image or file in a BLOB store like [Cloudflare R2](https://developers.cloudflare.com/r2/), [AWS S3](https://aws.amazon.com/pm/serv-s3/), or [Cloudinary](https://cloudinary.com/). These services allow you to store assets optimally and return a URL for access. Instead of storing the asset directly in the database, store the URL, which will substantially reduce the response size.
-
-#### Over-fetching of data
-
-In certain cases, a large number of records or fields are unintentionally fetched, which results in exceeding [the configured query response size limit](/v6/postgres/database/connection-pooling#response-size-limit). This could happen when the [`where`](/v6/orm/reference/prisma-client-reference#where) clause in the query is incorrect or entirely missing.
-
-**Suggested solution:** Configure the [query response size limit](/v6/postgres/database/connection-pooling#response-size-limit) to be larger. If the limit is still exceeded, double-check that the `where` clause is filtering data as expected. To prevent fetching too many records, consider using [pagination](/v6/orm/prisma-client/queries/pagination). Additionally, use the [`select`](/v6/orm/reference/prisma-client-reference#select) clause to return only the necessary fields, reducing the response size.
-
-#### Fetching a large volume of data
-
-In many data processing workflows, especially those involving ETL (Extract-Transform-Load) processes or scheduled CRON jobs, there's a need to extract large amounts of data from data sources (like databases, APIs, or file systems) for analysis, reporting, or further processing. If you are running an ETL/CRON workload that fetches a huge chunk of data for analytical processing then you might run into this limit.
-
-**Suggested solution:** Configure the [query response size limit](/v6/postgres/database/connection-pooling#response-size-limit) to be larger. If the limit is exceeded, consider splitting your query into batches. This approach ensures that each batch fetches only a portion of the data, preventing you from exceeding the size limit for a single operation.
-
-## [`P6004`](/v6/orm/reference/error-reference#p6004-querytimeout) (`QueryTimeout`)
-
-This error occurs when a database query fails to return a response within [the configured query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit). The query timeout limit includes the duration of waiting for a connection from the pool, network latency to the database, and the execution time of the query itself. We enforce this limit to prevent unintentional long-running queries that can overload system resources.
-
-> The time for Accelerate's cross-region networking is excluded from [the configured query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit) limit.
-
-### Possible causes for [`P6004`](/v6/orm/reference/error-reference#p6004-querytimeout)
-
-This error could be caused by numerous reasons. Some of the prominent ones are:
-
-#### High traffic and insufficient connections
-
-If the application is receiving very high traffic and there are not a sufficient number of connections available to the database, then the queries would need to wait for a connection to become available. This situation can lead to queries waiting longer than [the configured query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit) for a connection, ultimately triggering a timeout error if they do not get serviced within this duration.
-
-**Suggested solution**: Review and possibly increase the `connection_limit` specified in the connection string parameter when setting up Accelerate in a platform environment ([reference](/v6/postgres/database/connection-pooling#configuring-the-connection-pool-size)). This limit should align with your database's maximum number of connections.
-
-By default, the connection limit is set to 10 unless a different `connection_limit` is specified in your database connection string.
-
-#### Long-running queries
-
-Queries may be slow to respond, hitting [the configured query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit) even when connections are available. This could happen if a very large amount of data is being fetched in a single query or if appropriate indexes are missing from the table.
-
-**Suggested solution**: Configure the [query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit) to be larger. If the limit is exceeded, identify the slow-running queries and fetch only the necessary data. Use the `select` clause to retrieve specific fields and avoid fetching unnecessary data. Additionally, consider adding appropriate indexes to improve query efficiency. You might also isolate long-running queries into separate environments to prevent them from affecting transactional queries.
-
-#### Database resource contention
-
-A common yet challenging issue is when other services operating on the same database perform heavy analytics or data processing tasks, significantly consuming database resources. These operations can monopolize database connections and processing power, leading to a scenario where even simple queries cannot be executed in a timely manner. This "busy" or "noisy" database environment can cause queries that are typically fast to run slowly or even timeout, particularly during periods of high activity from other services.
-
-Users often rely on CPU and memory usage metrics to gauge database load, which can be misleading. While these are important indicators, they might not fully represent the database's operational state. Direct metrics like the number of reads, writes, and wait times offer a clearer view of the database's performance and should be monitored closely. A noticeable degradation in these metrics, especially in the absence of changes to the queries or data model, suggests that external pressures are affecting database performance.
-
-**Suggested solution**: If normally quick queries are intermittently slow or timing out without any modifications to them, it's probable that competing queries are exerting pressure on the same database tables. To diagnose this, adopt monitoring tools or leverage your database's inherent capabilities to observe reads, writes, and wait times. Such monitoring will unveil activity patterns or spikes that align with the observed performance dips.
-
-Moreover, it's crucial to periodically scrutinize and refine essential queries and verify that tables are properly indexed. This proactive approach minimizes the vulnerability of these queries to slowdowns caused by competing workloads.
-
-### Considerations for [`P6009`](/v6/orm/reference/error-reference#p6009-responsesizelimitexceeded) and [`P6004`](/v6/orm/reference/error-reference#p6004-querytimeout) errors
-
-For runtimes that support Prisma ORM natively, you could consider creating two `PrismaClient` Instances. One with the Accelerate connection string (prefixed with `prisma://`) and the other one with the direct database connection string (prefixed with `postgres://`, `mysql://` etc). The main idea behind this approach is to bypass Accelerate for certain specific queries.
-
-However, please note that the available connections would be split between both of your `PrismaClient` Instances. It's crucial to understand the implications of managing multiple instances, particularly in regards to direct database connections. Utilizing a `PrismaClient` instance with a direct database connection string means that this connection will interact directly with your database.
-
-This approach requires careful consideration because the direct connections and those managed by Accelerate share the same underlying database connection pool. This can lead to competition for resources, potentially affecting the performance and availability of your database services.
-
-Additionally, direct connections could have a significant impact on your database's performance and availability. Operations that consume a considerable amount of resources could potentially degrade the service for other users or processes that rely on the same database.
-
-If your application's runtime environment supports Prisma ORM natively and you're considering this strategy to circumvent P6009 and P6004 errors, you might create two `PrismaClient` instances:
-
-1. An instance using the Accelerate connection string (prefixed with `prisma://`) for general operations.
-2. Another instance with the direct database connection string (e.g., prefixed with `postgres://`, `mysql://`, etc.) for specific operations anticipated to exceed [the configured query limit timeout](/v6/postgres/database/connection-pooling#query-timeout-limit) or to result in responses larger than [the configured query response size limit](/v6/postgres/database/connection-pooling#response-size-limit).
-
-```jsx
-export const prisma = new PrismaClient({
- datasourceUrl: process.env.DIRECT_DB_CONNECTION,
-});
-
-export const prismaAccelerate = new PrismaClient({
- datasourceUrl: process.env.ACCELERATE_CONNECTION,
-}).$extends(withAccelerate());
-```
-
-This setup allows you to strategically direct certain operations through the direct connection, mitigating the risk of encountering the aforementioned errors. However, this decision should be made with a comprehensive understanding of the potential consequences and an assessment of whether your database infrastructure can support this additional load without compromising overall performance and availability.
-
-> Also see [**why doesn’t Accelerate fall back to the direct connection string during a service disruption?**](/v6/accelerate/faq#why-doesnt-accelerate-fall-back-to-the-direct-connection-string-during-a-service-disruption)
-
-## [`P6008`](/v6/orm/reference/error-reference#p6008-connectionerrorenginestarterror) (`ConnectionError|EngineStartError`)
-
-This error indicates that Prisma Accelerate cannot establish a connection to your database, potentially due to several reasons.
-
-### Possible causes for [`P6008`](/v6/orm/reference/error-reference#p6008-connectionerrorenginestarterror)
-
-#### Database Not Publicly accessible
-
-If your database is within a VPC or access is limited to specific IP addresses, you might encounter this error if static IP is not enabled for Accelerate or if the static IPs are not permitted in your database firewall.
-
-**Suggested solution:** [Enable static IP for Accelerate](/v6/accelerate/static-ip) and configure your database firewall to allow access from the provided static IP addresses.
-
-#### Unreachable Database Host/Port
-
-If the database’s server address (hostname) and port are incorrect or unreachable then you may encounter this error.
-
-**Suggested solution:** Verify the hostname/port of the database connection string that was provided while creating the Prisma Accelerate project. Additionally, attempt to connect to the database using a Database GUI tool (e.g., [Prisma Studio](https://www.prisma.io/studio), [TablePlus](https://tableplus.com/), or [DataGrip](https://www.jetbrains.com/datagrip/)) for further investigation.
-
-#### Incorrect username/password/database name
-
-This error can happen when the wrong credentials are provided to Prisma Accelerate, preventing it from establishing a connection to your database.
-
-**Suggested solution:** Verify the correctness of your database's username, password, and name in the connection string provided to Prisma Accelerate. Ensure that these credentials match those required by your database. Testing the connection using a direct database GUI tool can also help in confirming if the provided credentials are correct.
-
-#### Database taking too long to respond
-
-If the database is taking too long to respond to the connection request, Prisma Accelerate may timeout and throw this error. This could happen if the database is not active or is waking up from sleep mode.
-
-**Suggested solution:** Verify that the database is active and reachable. If the database is in sleep mode, try to wake it up by sending a request to it using a direct database GUI tool or wake it up using the database's management console.
-
-## [`P5011`](/v6/orm/reference/error-reference#p5011-too-many-requests) (`TooManyRequests`)
-
-This error occurs when Prisma Accelerate detects a high volume of requests that surpasses allowable thresholds. It acts as a protective measure to safeguard both Prisma Accelerate and your underlying database from excessive load.
-
-### Possible causes for [`P5011`](/v6/orm/reference/error-reference#p5011-too-many-requests)
-
-#### Aggressive retry loops
-
-If your application retries queries immediately or with minimal delay, especially after receiving certain errors, the rapid accumulation of requests can surpass the threshold.
-
-**Suggested solution:**
-
-- Implement an exponential backoff strategy. Rather than retrying immediately or with a fixed delay, gradually increase the delay period after each failed attempt.
-- This allows the system time to recover and reduces the likelihood of overwhelming Prisma Accelerate and your database.
-
-#### Sudden traffic spikes
-
-Unpredicted traffic surges (for example, during product launches, flash sales, or viral growth events) can cause the threshold to be met and result into `P5011`.
-
-**Suggested solution:**
-
-- Consider proactive scaling strategies for both Prisma Accelerate and your database.
-- Monitor traffic and resource usage. If you anticipate a surge, please contact [support](/v6/platform/support) for capacity planning and potential configuration adjustments.
-
-#### Prolonged or planned high workloads
-
-Certain processes, such as bulk data imports, ETL operations, or extended CRON jobs, can generate continuous high query volume over time.
-
-**Suggested solution:**
-
-- Use batching or chunking techniques to break large operations into smaller parts.
-- Establish throttling or scheduling to distribute the load more evenly.
-
-## Other errors
-
-### Error with MySQL (Aiven): "We were unable to process your request. Please refresh and try again."
-
-#### Issue
-
-When using an Aiven MySQL connection string that includes the `?ssl-mode=REQUIRED` parameter, you may encounter the following error:
-
-```
-We were unable to process your request. Please refresh and try again.
-```
-
-#### Cause
-
-The `ssl-mode=REQUIRED` parameter is incompatible with Accelerate, which leads to connection issues.
-
-#### Suggested solution
-
-To resolve this error, remove the `?ssl-mode=REQUIRED` parameter from your MySQL connection string.
-
-#### Example
-
-- Original connection string: `mysql://username:password@host:port/database?ssl-mode=REQUIRED`
-- Updated connection string: `mysql://username:password@host:port/database`
diff --git a/apps/docs/content/docs.v6/ai/index.mdx b/apps/docs/content/docs.v6/ai/index.mdx
deleted file mode 100644
index 3750662629..0000000000
--- a/apps/docs/content/docs.v6/ai/index.mdx
+++ /dev/null
@@ -1,61 +0,0 @@
----
-title: Build faster with Prisma + AI
-description: Learn about AI features in Prisma
-url: /v6/ai
-metaTitle: AI
-metaDescription: AI
----
-
-In the era of AI, where code is increasingly written by agents, ensuring clarity, type safety, and reliable infrastructure is essential. With 5+ years of leadership in the TypeScript ecosystem, Prisma ORM and Prisma Postgres provide the proven foundation for AI-assisted development.
-
-## Get started
-
-Run the following command to bootstrap your database with a prompt:
-
-```npm
-npx prisma init --prompt "Create a habit tracker application"
-```
-
-## AI Coding Tools
-
-Prisma ORM and Prisma Postgres integrate seamlessly with your AI coding tools. Check out our documentation with tips and tricks for working with Prisma in various AI editors.
-
-- [Cursor](/v6/orm/more/ai-tools/cursor) - Define project-specific rules and use your schema as context to generate accurate queries and code.
-- [Windsurf](/v6/orm/more/ai-tools/windsurf) - Automate your database workflows by generating schemas, queries, and seed data in this AI-powered editor.
-- [Github Copilot](/v6/orm/more/ai-tools/github-copilot) - Get Prisma-aware code suggestions, run CLI commands from chat, and query the Prisma docs.
-- [ChatGPT](/v6/orm/more/ai-tools/chatgpt) - Learn how to connect the Prisma MCP server to ChatGPT to manage your databases with natural language.
-
-## MCP server
-
-With Prisma's MCP server, your AI tool can take database actions on your behalf: Provisioning a new Prisma Postgres instance, creating database backups and executing SQL queries are just a few of its capabilities.
-
-```json title="Integrate in AI tool"
-{
- "mcpServers": {
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- }
-}
-```
-
-- [Capabilities and tools](/v6/postgres/integrations/mcp-server#tools) - Discover all the tools that make up the capabilities of the Prisma MCP server.
-- [Integrating in AI tools](/v6/postgres/integrations/mcp-server#integrating-in-ai-tools) - Learn how to integrate Prisma's MCP server in your favorite AI tool, such as Cursor, Claude, Warp, and more.
-- [How we built it](https://www.prisma.io/blog/about-mcp-servers-and-how-we-built-one-for-prisma) - Read this technical deep dive about the MCP protocol and how we built the Prisma MCP server.
-
-## Vibe Coding Tutorials
-
-Build complete, production-ready applications from scratch with AI assistance.
-
-- [Build a Linktree Clone SaaS](/v6/ai/tutorials/linktree-clone) - A complete vibe coding tutorial: build a full Linktree clone SaaS with Next.js, Prisma Postgres, and Clerk auth using AI assistance.
-
-## Resources
-
-- [Vibe Coding with Limits](https://www.prisma.io/blog/vibe-coding-with-limits-how-to-build-apps-in-the-age-of-ai) - How to Build Apps in the Age of AI
-- [Vibe Coding an E-commerce App](https://www.prisma.io/blog/vibe-coding-with-prisma-mcp-and-nextjs) - with Prisma MCP and Next.js
-- [Integrating the Vercel AI SDK](/v6/guides/ai-sdk-nextjs) - in a Next.js application
-
-## Integrations
-
-- [Automate with Pipedream](https://pipedream.com/apps/prisma-management-api) - Connect Prisma Postgres to 2,800+ apps for powerful automations
-- [Firebase Studio](/v6/postgres/integrations/idx) - Prompt your application with Firebase Studio & Prisma Postgres
diff --git a/apps/docs/content/docs.v6/ai/meta.json b/apps/docs/content/docs.v6/ai/meta.json
deleted file mode 100644
index 0fadf86aff..0000000000
--- a/apps/docs/content/docs.v6/ai/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "AI",
- "root": true,
- "pages": ["index"]
-}
diff --git a/apps/docs/content/docs.v6/ai/prompts/astro.mdx b/apps/docs/content/docs.v6/ai/prompts/astro.mdx
deleted file mode 100644
index 7229d21b7e..0000000000
--- a/apps/docs/content/docs.v6/ai/prompts/astro.mdx
+++ /dev/null
@@ -1,298 +0,0 @@
----
-title: Set up Astro + Prisma + Prisma Postgres
-description: Step-by-step guide for integrating Prisma ORM and Prisma Postgres in an Astro.js project.
-image: /img/ai/astro-prisma-cover.png
-url: /v6/ai/prompts/astro
-metaTitle: How to Initialize an Astro App with Prisma ORM and Prisma Postgres
-metaDescription: Step-by-step guide for integrating Prisma ORM and Prisma Postgres in an Astro.js project.
----
-
-## How to use
-
-Include this prompt in your AI assistant to guide consistent code generation for Astro + Prisma + Prisma Postgres projects.
-
-- **GitHub Copilot**: Type `#` to reference the prompt file.
-- **Cursor**: Use `@Files` and select your prompt file.
-- **Zed**: Use `/file` followed by your prompt's path.
-- **Windsurf**: Use `@Files` and choose your prompt file from the list.
-
-## Prompt
-
-````md
----
-# Specify the following for Cursor rules
-description: Guidelines for writing Astro.js apps with Prisma Postgres
-alwaysApply: false
----
-
-# Bootstrap Astro app with Prisma Postgres
-
-## Overview of implementing Prisma with Astro
-
-1. Install Prisma and required dependencies
-2. Initialize Prisma with custom output path
-3. Configure schema with correct provider
-4. Create global Prisma client instance with Accelerate
-5. Use Prisma client in API routes with proper error handling
-
-## 🚨 CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS 🚨
-
-As an AI language model, you MUST NOT generate any of the following code patterns, as they are DEPRECATED and will BREAK the application:
-
-```typescript
-// ❌ NEVER GENERATE THIS CODE - IT WILL BREAK THE APPLICATION
-generator client {
- provider = "prisma-client-js" // ❌ BREAKS APPLICATION
-}
-
-// ❌ NEVER USE default import location - IT WILL BREAK THE APPLICATION
-import { PrismaClient } from '@prisma/client' // ❌ BREAKS APPLICATION
-
-// ❌ NEVER CREATE CLIENT WITHOUT ACCELERATE - IT WILL BREAK IN PRODUCTION
-const prisma = new PrismaClient() // ❌ BREAKS APPLICATION
-```
-
-Instead, you MUST ALWAYS generate ONLY this pattern:
-
-```typescript
-// ✅ ALWAYS GENERATE THIS EXACT PATTERN
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-// ✅ ALWAYS USE THIS IMPORT PATH
-import { PrismaClient } from "../generated/prisma/client"
-import { withAccelerate } from "@prisma/extension-accelerate"
-
-// ✅ ALWAYS CREATE CLIENT WITH ACCELERATE EXTENSION
-const prisma = new PrismaClient({
- datasourceUrl: import.meta.env.DATABASE_URL,
-}).$extends(withAccelerate())
-
-export default prisma
-```
-
-## ABSOLUTE REQUIREMENTS FOR AI CODE GENERATION
-
-1. You MUST use `provider = "prisma-client"` (not "prisma-client-js")
-2. You MUST use custom output: `output = "../src/generated/prisma"`
-3. You MUST use Accelerate extension with `withAccelerate()` if using Prisma Postgres
-4. You MUST create `lib/prisma.ts` as a global singleton instance
-5. You MUST wrap all database calls in try-catch blocks
-6. You MUST import from `'../generated/prisma/client'` (not `'@prisma/client'`)
-7. You MUST use `import.meta.env.DATABASE_URL` in Astro (not `process.env`)
-8. You MUST ALWAYS use the full `npx prisma init` command with ALL flags: `npx prisma init --db --output ../src/generated/prisma --generator-provider prisma-client`
-
-## CORRECT INSTALLATION
-
-```bash
-# Dev dependencies
-npm install prisma tsx --save-dev
-
-# Production dependencies
-npm install @prisma/extension-accelerate @prisma/client
-```
-
-## CORRECT PRISMA INITIALIZATION
-
-```npm
-npx prisma init --db --output ../src/generated/prisma
-```
-
-## CORRECT SCHEMA CONFIGURATION
-
-```prisma
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
- url = env("DATABASE_URL")
-}
-
-model YourModel {
- id Int @id @default(autoincrement())
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-}
-```
-
-## CORRECT GLOBAL PRISMA CLIENT
-
-**src/lib/prisma.ts**:
-
-```typescript
-import { PrismaClient } from "../generated/prisma/client";
-import { withAccelerate } from "@prisma/extension-accelerate";
-
-const prisma = new PrismaClient({
- datasourceUrl: import.meta.env.DATABASE_URL,
-}).$extends(withAccelerate());
-
-export default prisma;
-```
-
-## CORRECT API ROUTE IMPLEMENTATION
-
-All API routes MUST follow this pattern with proper error handling:
-
-```typescript
-import type { APIRoute } from "astro";
-import prisma from "../../../lib/prisma";
-
-export const GET: APIRoute = async () => {
- try {
- const data = await prisma.yourModel.findMany();
- return new Response(JSON.stringify(data), {
- status: 200,
- headers: { "Content-Type": "application/json" },
- });
- } catch (error) {
- console.error("Error:", error);
- return new Response(JSON.stringify({ error: "Failed to fetch data" }), {
- status: 500,
- headers: { "Content-Type": "application/json" },
- });
- }
-};
-
-export const POST: APIRoute = async ({ request }) => {
- try {
- const body = await request.json();
-
- // Validate required fields
- if (!body.requiredField) {
- return new Response(JSON.stringify({ error: "Required field missing" }), {
- status: 400,
- headers: { "Content-Type": "application/json" },
- });
- }
-
- const result = await prisma.yourModel.create({
- data: body,
- });
-
- return new Response(JSON.stringify(result), {
- status: 201,
- headers: { "Content-Type": "application/json" },
- });
- } catch (error) {
- console.error("Error:", error);
- return new Response(JSON.stringify({ error: "Failed to create data" }), {
- status: 500,
- headers: { "Content-Type": "application/json" },
- });
- }
-};
-```
-
-## CORRECT USAGE IN ASTRO PAGES
-
-Server-side data fetching in Astro pages:
-
-```astro
----
-import prisma from '../lib/prisma'
-
-// Fetch data on the server
-const data = await prisma.yourModel.findMany()
----
-
-
-
- {data.map(item => (
-
{item.name}
- ))}
-
-
-```
-
-## AI MODEL VERIFICATION STEPS
-
-Before generating any code, you MUST verify:
-
-1. Are you using `provider = "prisma-client"` (not "prisma-client-js")? If not, STOP and FIX.
-2. Are you using `output = "../src/generated/prisma"`? If not, STOP and FIX.
-3. Are you importing from `'../generated/prisma/client'`? If not, STOP and FIX.
-4. Are you using `withAccelerate()` extension? If not, STOP and FIX.
-5. Are you wrapping database operations in try-catch? If not, STOP and FIX.
-6. Are you using `import.meta.env` (not `process.env`)? If not, STOP and FIX.
-7. Did you use `--generator-provider prisma-client` (NOT `postgresql`)? If not, STOP and FIX.
-
-## CONSEQUENCES OF INCORRECT IMPLEMENTATION
-
-If you generate code using:
-
-- `prisma-client-js` provider
-- Default import from `@prisma/client`
-- PrismaClient without Accelerate extension
-- Missing custom output path
-
-The implementation will:
-
-1. Break in production
-2. Cause connection pool exhaustion
-3. Fail to maintain proper database connections
-4. Result in import errors
-5. Cause performance issues
-
-## USEFUL COMMANDS
-
-```npm
-npx prisma generate # Regenerate client after schema changes
-```
-
-```npm
-npx prisma migrate dev --name X # Create and apply migration
-```
-
-```npm
-npx prisma studio # Open visual database editor
-```
-
-```npm
-npx prisma db push # Push schema without migration
-```
-
-## AI MODEL RESPONSE TEMPLATE
-
-When asked about Prisma + Astro implementation, you MUST:
-
-1. ONLY use code from this guide
-2. NEVER suggest deprecated approaches
-3. ALWAYS use the exact patterns shown above
-4. VERIFY your response against the patterns shown here
-5. ALWAYS include error handling in API routes
-6. ALWAYS use the global prisma instance from `lib/prisma.ts`
-
-Remember: There are NO EXCEPTIONS to these rules.
-````
-
-## Running the application
-
-Get your application running locally in three quick steps:
-
-**1. Generate the Prisma Client:**
-
-```bash
-npx prisma generate --no-engine
-```
-
-**2. View your database in Prisma Studio:**
-
-```bash
-npm run db:studio
-```
-
-Prisma Studio opens at `localhost:5555` where you can inspect your `User` table and see the test user stored in your database.
-
-**3. Start your Next.js development server:**
-
-```bash
-npm run dev
-```
-
-Visit `http://localhost:3000` to see your Next.js application live, displaying your first user fetched directly from your Prisma Postgres database!
diff --git a/apps/docs/content/docs.v6/ai/prompts/nextjs.mdx b/apps/docs/content/docs.v6/ai/prompts/nextjs.mdx
deleted file mode 100644
index 64abe95d8b..0000000000
--- a/apps/docs/content/docs.v6/ai/prompts/nextjs.mdx
+++ /dev/null
@@ -1,637 +0,0 @@
----
-title: Set up NextJS + Prisma + Prisma Postgres
-description: Step-by-step guide for integrating Prisma ORM and Prisma Postgres in an NextJS project.
-url: /v6/ai/prompts/nextjs
-metaTitle: How to Initialize an NextJS App with Prisma ORM and Prisma Postgres
-metaDescription: Step-by-step guide for integrating Prisma ORM and Prisma Postgres in an NextJS project.
----
-
-## Prerequisites
-
-Before using this prompt, you need to create a new Next.js project:
-
-```bash
-npx create-next-app@latest my-app
-cd my-app
-```
-
-When prompted, select the following recommended options:
-
-- **TypeScript**: Yes
-- **ESLint**: Yes
-- **Tailwind CSS**: Yes (optional)
-- **`src/` directory**: No
-- **App Router**: Yes
-- **Turbopack**: Yes (optional)
-- **Import alias**: Use default (`@/*`)
-
-Once your Next.js project is created, you can use the prompt below with your AI assistant to add Prisma and Prisma Postgres.
-
-## How to use
-
-Include this prompt in your AI assistant to guide consistent code generation for NextJS + Prisma + Prisma Postgres projects.
-
-- **GitHub Copilot**: Type `#` to reference the prompt file.
-- **Cursor**: Use `@Files` and select your prompt file.
-- **Zed**: Use `/file` followed by your prompt's path.
-- **Windsurf**: Use `@Files` and choose your prompt file from the list.
-
-## Video Tutorial
-
-Watch this step-by-step walkthrough showing this prompt in action:
-
-
-
-
-
-## Prompt
-
-````md
----
-# Specify the following for Cursor rules
-description: Guidelines for writing Next.js apps with Prisma Postgres
-alwaysApply: false
----
-
-# Bootstrap Next.js app with Prisma Postgres (Prisma 7)
-
-> **Note**: This guide is updated for **Prisma ORM 7**. Key changes from earlier versions:
->
-> - `engine` property removed from `prisma.config.ts`
-> - `url` removed from datasource in `schema.prisma` (now only in `prisma.config.ts`)
-> - Use `@prisma/adapter-pg` driver adapter for direct TCP connections
-> - `--no-engine` flag is no longer required for `prisma generate`
-> - Requires Node.js 20.19+ and TypeScript 5.4.0+
-
-## Overview of implementing Prisma with Next.js
-
-1. Install Prisma and required dependencies (including dotenv)
-2. Initialize Prisma and configure schema
-3. Configure dotenv for environment variables
-4. Create global Prisma client instance with Pg Adapter
-5. Add npm scripts for testing and database management
-6. Create test script to verify setup
-7. Use Prisma client in API routes and pages with proper error handling
-
-## 🚨 CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS 🚨
-
-As an AI language model, you MUST NOT generate any of the following code patterns, as they are DEPRECATED and will BREAK the application:
-
-```typescript
-// ❌ NEVER GENERATE THIS CODE - IT WILL BREAK THE APPLICATION
-generator client {
- provider = "prisma-client-js" // ❌ BREAKS APPLICATION
-}
-
-// ❌ NEVER USE default import location - IT WILL BREAK THE APPLICATION
-import { PrismaClient } from '@prisma/client' // ❌ BREAKS APPLICATION
-
-// ❌ WRONG IMPORT PATH - MISSING /client - IT WILL BREAK THE APPLICATION
-import { PrismaClient } from "../app/generated/prisma" // ❌ BREAKS APPLICATION
-
-// ❌ NEVER USE ACCELERATE - IT IS NOT USED IN THIS WORKFLOW
-import { withAccelerate } from "@prisma/extension-accelerate" // ❌ BREAKS APPLICATION
-
-// ❌ NEVER USE accelerateUrl - IT WILL BREAK THE APPLICATION
-const prisma = new PrismaClient({
- accelerateUrl: process.env.DATABASE_URL, // ❌ BREAKS APPLICATION - use adapter
-})
-
-// ❌ NEVER include url in datasource block - IT WILL BREAK THE APPLICATION
-datasource db {
- provider = "postgresql"
- url = env("DATABASE_URL") // ❌ BREAKS APPLICATION - moved to prisma.config.ts
-}
-
-// ❌ NEVER include engine property - IT WILL BREAK THE APPLICATION
-export default defineConfig({
- engine: "classic", // ❌ BREAKS APPLICATION - removed in Prisma 7
-})
-
-// ❌ NEVER use Prisma Postgres HTTP URLs - ONLY use TCP URLs
-DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/..." // ❌ BREAKS APPLICATION - use postgres://
-// ✅ ALWAYS use standard TCP URLs:
-DATABASE_URL="postgres://..." // ✅ CORRECT
-```
-
-Instead, you MUST ALWAYS generate ONLY this pattern:
-
-```typescript
-// ✅ ALWAYS GENERATE THIS EXACT PATTERN
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-// ✅ CRITICAL: MUST include /client at the end of import path
-import { PrismaClient } from "../app/generated/prisma/client"
-import { PrismaPg } from "@prisma/adapter-pg"
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-})
-
-const globalForPrisma = global as unknown as { prisma: PrismaClient }
-
-const prisma = globalForPrisma.prisma || new PrismaClient({
- adapter,
-})
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
-
-export default prisma
-```
-
-## ABSOLUTE REQUIREMENTS FOR AI CODE GENERATION
-
-1. You MUST use `provider = "prisma-client"` (not "prisma-client-js")
-2. You MUST use custom output: `output = "../app/generated/prisma"`
-3. You MUST use `@prisma/adapter-pg` driver adapter
-4. You MUST create `lib/prisma.ts` as a global singleton instance
-5. You MUST wrap all database calls in try-catch blocks
-6. You MUST import from `'../app/generated/prisma/client'` (not `'@prisma/client'` or `'../app/generated/prisma'`)
-7. You MUST use `adapter` property in PrismaClient constructor
-8. You MUST install `dotenv` and add `import "dotenv/config"` to `prisma.config.ts`
-9. You MUST add npm scripts for `db:test` and `db:studio` to package.json
-10. You MUST create a test script at `scripts/test-database.ts` to verify setup
-11. You MUST NOT include `url` in the datasource block of `schema.prisma`
-12. You MUST NOT include `engine` property in `prisma.config.ts`
-13. You MUST use `npx prisma init --db --output ../app/generated/prisma` to create a real cloud database
-14. You MUST use standard TCP URLs (`postgres://...`) in .env
-15. You MUST NOT use `accelerateUrl` or `withAccelerate`
-
-## VERSION REQUIREMENTS
-
-- **Node.js**: 20.19 or higher (Node.js 18 is NOT supported)
-- **TypeScript**: 5.4.0 or higher (5.9.x recommended)
-- **Prisma**: 7.0.0 or higher
-
-## CORRECT INSTALLATION
-
-```bash
-# Dev dependencies
-npm install prisma tsx --save-dev
-
-# Production dependencies
-npm install @prisma/adapter-pg @prisma/client dotenv
-```
-
-## CORRECT PRISMA INITIALIZATION
-
-> **FOR AI ASSISTANTS**: This command is **interactive** and requires user input. You **MUST ask the user to run this command manually** in their own terminal, then **wait for them to confirm completion** before proceeding with the next steps. Do NOT attempt to run this command yourself.
-
-```bash
-# Initialize Prisma AND create a real Prisma Postgres cloud database
-npx prisma init --db --output ../app/generated/prisma
-```
-
-This command:
-
-- Authenticates you with Prisma Console (if needed)
-- Prompts for **region** and **project name**
-- **Creates a cloud Prisma Postgres database**
-- Generates:
- - `prisma/schema.prisma` (with correct output path)
- - `prisma.config.ts` (with dotenv import)
- - **`.env` with a `DATABASE_URL`**
-
-**IMPORTANT**: Ensure the generated `.env` uses a `postgres://` URL scheme. If it generates `prisma+postgres://`, replace it with the standard TCP connection string available in the Prisma Console.
-
-```text
-DATABASE_URL="postgres://..."
-```
-
-**IMPORTANT**: Do NOT use `npx prisma init` without `--db` as this only creates local files without a database.
-
-## CORRECT PRISMA CONFIG (prisma.config.ts)
-
-When using `npx prisma init --db`, the `prisma.config.ts` is **auto-generated** with the correct configuration:
-
-```typescript
-import "dotenv/config"; // ✅ Auto-included by prisma init --db
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- // ✅ NO engine property - removed in Prisma 7
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-**Note**: If you need to manually create this file, ensure `import "dotenv/config"` is at the top.
-
-## CORRECT SCHEMA CONFIGURATION (prisma/schema.prisma)
-
-Update the generated `prisma/schema.prisma` file:
-
-```prisma
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
- // ✅ NO url here - now configured in prisma.config.ts
-}
-
-// Example User model for testing
-model User {
- id Int @id @default(autoincrement())
- email String @unique
- name String?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-}
-```
-
-## CORRECT GLOBAL PRISMA CLIENT
-
-Create `lib/prisma.ts` file:
-
-```typescript
-import { PrismaClient } from "../app/generated/prisma/client"; // ✅ CRITICAL: Include /client
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const globalForPrisma = global as unknown as { prisma: PrismaClient };
-
-const prisma =
- globalForPrisma.prisma ||
- new PrismaClient({
- adapter,
- });
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
-
-export default prisma;
-```
-
-## ADD NPM SCRIPTS TO PACKAGE.JSON
-
-Update your `package.json` to include these scripts:
-
-```json
-{
- "scripts": {
- "dev": "next dev",
- "build": "next build",
- "start": "next start",
- "lint": "eslint",
- "db:test": "tsx scripts/test-database.ts",
- "db:studio": "prisma studio"
- }
-}
-```
-
-## CREATE TEST SCRIPT
-
-Create `scripts/test-database.ts` to verify your setup:
-
-```typescript
-import "dotenv/config"; // ✅ CRITICAL: Load environment variables
-import prisma from "../lib/prisma";
-
-async function testDatabase() {
- console.log("🔍 Testing Prisma Postgres connection...\n");
-
- try {
- // Test 1: Check connection
- console.log("✅ Connected to database!");
-
- // Test 2: Create a test user
- console.log("\n📝 Creating a test user...");
- const newUser = await prisma.user.create({
- data: {
- email: "demo@example.com",
- name: "Demo User",
- },
- });
- console.log("✅ Created user:", newUser);
-
- // Test 3: Fetch all users
- console.log("\n📋 Fetching all users...");
- const allUsers = await prisma.user.findMany();
- console.log(`✅ Found ${allUsers.length} user(s):`);
- allUsers.forEach((user) => {
- console.log(` - ${user.name} (${user.email})`);
- });
-
- console.log("\n🎉 All tests passed! Your database is working perfectly.\n");
- } catch (error) {
- console.error("❌ Error:", error);
- process.exit(1);
- }
-}
-
-testDatabase();
-```
-
-## CORRECT API ROUTE IMPLEMENTATION (App Router)
-
-Create `app/api/users/route.ts` with GET and POST handlers:
-
-```typescript
-import { NextRequest, NextResponse } from "next/server";
-import prisma from "../../../lib/prisma";
-
-export async function GET(request: NextRequest) {
- try {
- const users = await prisma.user.findMany();
- return NextResponse.json(users);
- } catch (error) {
- console.error("Error fetching users:", error);
- return NextResponse.json({ error: "Failed to fetch users" }, { status: 500 });
- }
-}
-
-export async function POST(request: NextRequest) {
- try {
- const body = await request.json();
- const user = await prisma.user.create({
- data: {
- email: body.email,
- name: body.name,
- },
- });
- return NextResponse.json(user, { status: 201 });
- } catch (error) {
- console.error("Error creating user:", error);
- return NextResponse.json({ error: "Failed to create user" }, { status: 500 });
- }
-}
-```
-
-## CORRECT USAGE IN SERVER COMPONENTS
-
-Update `app/page.tsx` to display users from the database:
-
-```typescript
-import prisma from "../lib/prisma"
-
-export default async function Home() {
- let users: Array<{
- id: number
- email: string
- name: string | null
- createdAt: Date
- updatedAt: Date
- }> = []
- let error = null
-
- try {
- users = await prisma.user.findMany({
- orderBy: {
- createdAt: "desc",
- },
- })
- } catch (e) {
- console.error("Error fetching users:", e)
- error = "Failed to load users. Make sure your DATABASE_URL is configured."
- }
-
- return (
-
-
Users from Database
- {error ? (
-
{error}
- ) : users.length === 0 ? (
-
No users yet. Create one using the API at /api/users
- ) : (
-
- {users.map((user) => (
-
-
{user.name || "No name"}
-
{user.email}
-
- ))}
-
- )}
-
- )
-}
-```
-
-## COMPLETE SETUP WORKFLOW
-
-User should follow these steps (AI should provide these instructions):
-
-1. **Install dependencies**:
-
- ```npm
- npm install prisma tsx --save-dev
- ```
-
- ```npm
- npm install @prisma/adapter-pg @prisma/client dotenv
- ```
-
-2. **Initialize Prisma AND create Prisma Postgres database** (⚠️ USER MUST RUN MANUALLY):
-
- > **AI ASSISTANT**: Ask the user to run this command in their own terminal. This is interactive and requires user input. Wait for the user to confirm completion before continuing.
-
- ```npm
- npx prisma init --db --output ../app/generated/prisma
- ```
-
- The user should follow the terminal prompts to:
- - Authenticate with Prisma Console (if needed)
- - Choose a region (e.g., us-east-1)
- - Name your project
-
- Once complete, this creates `prisma/schema.prisma`, `prisma.config.ts`, AND `.env` with the `DATABASE_URL`.
-
- **User should confirm when done** so the AI can proceed with the next steps.
-
-3. **Verify `.env` was created** - Ensure `DATABASE_URL` uses `postgres://`. If it uses `prisma+postgres://`, change it to the TCP connection string.
-
- ```text
- DATABASE_URL="postgres://..."
- ```
-
- **Do NOT invent or manually change this URL. Use the one from Prisma Console.**
-
-4. **Update `prisma/schema.prisma`** - Add the User model (generator and datasource are already configured):
-
- ```prisma
- model User {
- id Int @id @default(autoincrement())
- email String @unique
- name String?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- }
- ```
-
-5. **Create `lib/prisma.ts`** with correct import path including `/client` and using `@prisma/adapter-pg`.
-
-6. **Add npm scripts** to `package.json` for `db:test` and `db:studio`
-
-7. **Create `scripts/test-database.ts`** test script
-
-8. **Push schema to database**:
-
- ```npm
- npx prisma db push
- ```
-
-9. **Generate Prisma Client**:
-
- ```npm
- npx prisma generate
- ```
-
-10. **Test the setup**:
-
- ```bash
- npm run db:test
- ```
-
-11. **Start development server**:
- ```bash
- npm run dev
- ```
-
-## AI MODEL VERIFICATION STEPS
-
-Before generating any code, you MUST verify:
-
-1. Are you using `provider = "prisma-client"` (not "prisma-client-js")? If not, STOP and FIX.
-2. Are you using `output = "../app/generated/prisma"`? If not, STOP and FIX.
-3. Are you importing from `'../app/generated/prisma/client'` (with `/client`)? If not, STOP and FIX.
-4. Did you add `import "dotenv/config"` to `prisma.config.ts`? If not, STOP and FIX.
-5. Did you add `import "dotenv/config"` to `scripts/test-database.ts`? If not, STOP and FIX.
-6. Are you using `@prisma/adapter-pg`? If not, STOP and FIX.
-7. Are you using `adapter` property in PrismaClient constructor? If not, STOP and FIX.
-8. Are you wrapping database operations in try-catch? If not, STOP and FIX.
-9. Did you create the test script at `scripts/test-database.ts`? If not, STOP and FIX.
-10. Did you add `db:test` and `db:studio` scripts to package.json? If not, STOP and FIX.
-11. Did you remove `url` from the datasource block in `schema.prisma`? If not, STOP and FIX.
-12. Did you remove `engine` property from `prisma.config.ts`? If not, STOP and FIX.
-13. Are you using `npx prisma init --db` (not just `npx prisma init`)? If not, STOP and FIX.
-14. Is the DATABASE_URL a TCP URL (`postgres://...`)? If it's a `prisma+postgres://` URL, STOP and FIX.
-15. Did Prisma generate the `.env` file? If you invented the URL manually, STOP and FIX.
-
-## CONSEQUENCES OF INCORRECT IMPLEMENTATION
-
-If you generate code using:
-
-- `prisma-client-js` provider → **CLIENT GENERATION FAILS**
-- Wrong import path (missing `/client`) → **MODULE NOT FOUND ERROR**
-- Missing `import "dotenv/config"` in prisma.config.ts → **DATABASE_URL NOT FOUND ERROR**
-- Missing `import "dotenv/config"` in test scripts → **ENVIRONMENT VARIABLE ERROR**
-- Default import from `@prisma/client` → **IMPORT ERROR**
-- Using `accelerateUrl` or `withAccelerate` → **UNNECESSARY ACCELERATE DEPENDENCY / CONFIG ERROR**
-- Missing custom output path → **WRONG CLIENT GENERATED**
-- Including `url` in datasource block → **DEPRECATED CONFIGURATION ERROR**
-- Including `engine` property → **DEPRECATED CONFIGURATION ERROR**
-- Using local URL (`postgres://localhost:...`) → **VERSION INCOMPATIBILITY ERRORS WITH PRISMA 7**
-- Using `npx prisma init` without `--db` → **NO DATABASE CREATED, ONLY LOCAL FILES**
-- Manually inventing DATABASE_URL → **INVALID CONNECTION STRING ERRORS**
-
-The implementation will:
-
-1. Break immediately with module errors
-2. Fail to read environment variables
-3. Cause connection pool exhaustion in production
-4. Result in import errors that prevent compilation
-5. Cause performance issues and connection failures
-6. Fail with "HTTP connection string is not supported" errors when using local URLs
-
-## USEFUL COMMANDS
-
-```bash
-# After changing schema
-npx prisma generate # Regenerate client (--no-engine flag no longer needed)
-
-# Push schema to database (no migrations)
-npx prisma db push
-
-# Test database connection
-npm run db:test
-
-# Open visual database editor
-npm run db:studio
-
-# Create and apply migrations (for production)
-npx prisma migrate dev --name your_migration_name
-```
-
-## TESTING WORKFLOW
-
-After setup, test with these steps:
-
-1. **Test database connection**:
-
- ```bash
- npm run db:test
- ```
-
- Should create a demo user and display it.
-
-2. **Open Prisma Studio**:
-
- ```bash
- npm run db:studio
- ```
-
- Visual interface at `localhost:5555` to view/edit data.
-
-3. **Test API routes**:
-
- ```bash
- # Create a user via API
- curl -X POST http://localhost:3000/api/users \
- -H "Content-Type: application/json" \
- -d '{"email":"test@example.com","name":"Test User"}'
-
- # Get all users
- curl http://localhost:3000/api/users
- ```
-
-4. **View in browser**:
- Open `localhost:3000` to see users displayed on the homepage.
-
-## AI MODEL RESPONSE TEMPLATE
-
-When asked about Prisma + Next.js implementation, you MUST:
-
-1. ONLY use code patterns from this guide
-2. NEVER suggest deprecated approaches
-3. ALWAYS use the exact patterns shown above
-4. ALWAYS include `/client` in import paths
-5. ALWAYS add `import "dotenv/config"` to prisma.config.ts
-6. ALWAYS add `import "dotenv/config"` to test scripts
-7. ALWAYS create the test script at `scripts/test-database.ts`
-8. ALWAYS add npm scripts for `db:test` and `db:studio`
-9. ALWAYS include error handling in API routes and server components
-10. ALWAYS use the global prisma instance from `lib/prisma.ts`
-11. ALWAYS use `@prisma/adapter-pg` and `adapter` property
-12. NEVER include `url` in the datasource block of schema.prisma
-13. NEVER include `engine` property in prisma.config.ts
-14. ALWAYS ask the user to run `npx prisma init --db --output ../app/generated/prisma` **manually in their own terminal** (this command is interactive and requires user input for region and project name)
-15. ALWAYS wait for user confirmation after they run the interactive `prisma init --db` command before proceeding
-16. NEVER attempt to run interactive commands yourself - ask the user to do it
-17. NEVER use `prisma+postgres://` URLs - ONLY `postgres://` TCP URLs
-18. NEVER manually invent or fabricate DATABASE_URL values
-19. ALWAYS let Prisma generate the `.env` file with the real DATABASE_URL (and ensure it's correct type)
-20. VERIFY your response against ALL the patterns shown here before responding
-
-Remember: There are NO EXCEPTIONS to these rules. Every requirement is MANDATORY for the setup to work.
-````
diff --git a/apps/docs/content/docs.v6/ai/prompts/prisma-7.mdx b/apps/docs/content/docs.v6/ai/prompts/prisma-7.mdx
deleted file mode 100644
index 36515fc7a2..0000000000
--- a/apps/docs/content/docs.v6/ai/prompts/prisma-7.mdx
+++ /dev/null
@@ -1,459 +0,0 @@
----
-title: Migrating to Prisma 7
-description: Step-by-step guide for migration your app to use the version 7 of Prisma ORM
-url: /v6/ai/prompts/prisma-7
-metaTitle: How to upgrade to Prisma ORM version 7
-metaDescription: Step-by-step guide for migration your app to use the version 7 of Prisma ORM
----
-
-## How to use
-
-Include this prompt in your AI assistant to guide in upgrading to Prisma ORM 7.0.
-
-- **GitHub Copilot**: Type `#` to reference the prompt file.
-- **Cursor**: Use `@Files` and select your prompt file.
-- **Zed**: Use `/file` followed by your prompt's path.
-- **Windsurf**: Use `@Files` and choose your prompt file from the list.
-
-## Video Tutorial
-
-Watch this video showing this prompt in action:
-
-
-
-
-
-## Prompt
-
-````md
----
-# Specify the following for Cursor rules
-description: Guidelines for migrating an app to Prisma ORM v7
-alwaysApply: false
----
-
-# Prisma v6 → v7 Migration Assistant
-
-**Role:** You are a precise, changeset-oriented code migration assistant. Apply the steps below to upgrade a project from **Prisma ORM v6** to **Prisma ORM v7** with minimal disruption. Work in small, re-viewable steps and explain each change briefly. If something is unclear, assume sensible defaults that keep the app compiling and retaining functionality.
-
-## Ground Rules
-
-- Never introduce Prisma Accelerate or HTTP/WebSocket drivers on your own.
-- Do **not** remove Prisma Accelerate automatically.
-- **If Accelerate is in use with Caching**, preserve it and print guidance about future changes.
-- **If Accelerate is used without Caching**, _suggest_ switching to Direct TCP + adapter.
-- Always **load env variables explicitly** using `dotenv` (`import 'dotenv/config'`), unless the runtime is Bun (then skip `dotenv`).
-- Keep TypeScript **ESM** compatible, and avoid CommonJS requires.
-- Favor additive, reversible edits; do not remove user logic.
-- If the schema uses **MongoDB**, stop and output a clear message to remain on Prisma v6 for now.
-
----
-
-## 0) Detect Context & Plan
-
-1. Identify:
- - Package manager and scripts.
- - Database: Postgres, SQLite, MySQL, SQL Server (MongoDB = halt).
- - Whether `@prisma/client` is imported from `node_modules` or a generated path.
- - Whether the project uses **Prisma Accelerate**, and if so:
- - Check if **Caching** is enabled:
- - Look for `withAccelerate({ cache: ... })`
- - Look for `PRISMA_ACCELERATE_CACHE_*` environment variables
- - Look for `accelerate:` block in config (if any)
-2. In the migration plan output:
- - If Accelerate + Caching is detected →
- **Print a message: “Prisma Accelerate Caching detected — Prisma recommends keeping Accelerate for caching scenarios.”**
- - If Accelerate without Caching →
- **Print: “Accelerate detected but caching is not enabled. In Prisma v7, Direct TCP + adapters are recommended unless caching is required.”**
- - If no Accelerate → continue normally.
-
-> **Do not modify or remove Accelerate code paths. Only describe recommendations.**
-
----
-
-## 1) Dependencies
-
-- Upgrade/install:
- - Dev: `prisma@latest` (7.0.0), `tsx`, `dotenv` (skip if Bun).
- - Runtime: `@prisma/client@latest` (7.0.0).
- - **One** database adapter that matches the datasource:
- - Postgres: `@prisma/adapter-ppg`
- - SQLite: `@prisma/adapter-better-sqlite3`
- - MySQL/mariaDB: `@prisma/adapter-mariadb`
- - D1: `@prisma/adapter-d1`
- - PlanetScale: `@prisma/adapter-planetscale`
- - MSSQL: `@prisma/adapter-mssql`
- - CockroachDB: `@prisma/adapter-pg`
- - Neon: `@prisma/adapter-neon`
-
-- **Do not remove Accelerate packages automatically.**
-- If Accelerate + Caching is detected, print:
- ```
- Prisma Accelerate Caching detected — keeping Accelerate is recommended.
- ```
-- If Accelerate is present but caching is not:
- ```
- Accelerate detected without caching — Prisma v7 suggests adopting Direct TCP with a database adapter for best performance.
- ```
-- Eliminate no user code; only output informational guidance.
-
-> Produce installation commands based on the repo’s package manager.
-
----
-
-## 2) Prisma Schema Changes
-
-- In `schema.prisma`:
- - `generator client`:
-
- ```diff
- - provider = "prisma-client-js"
- + provider = "prisma-client"
- output = "./generated"
- ```
-
- - Remove any `previewFeatures = ["driverAdapters"]` and any `engineType` attributes.
-
- - Update the `datasource db` block:
- - **Goal:** keep the existing `provider` value, but **remove any `url = …` entry**.
-
- - Example (for illustration only — do not insert comments into the user's schema):
- - Before:
-
- ```prisma
- datasource db {
- provider = "postgresql"
- url = env("DATABASE_URL")
- }
- ```
-
- - After:
-
- ```prisma
- datasource db {
- provider = "postgresql"
- }
- ```
-
- - Rules:
- - Preserve the existing `provider` value exactly as-is (e.g. `"postgresql"`, `"mysql"`, `"sqlite"`, etc.).
- - Remove only the `url = ...` line from the `datasource db` block.
- - Preserve any other properties on the datasource (for example: `shadowDatabaseUrl`, `relationMode`, `schemas`, `extensions`, `directUrl`, etc.).
- - Do **not** add explanatory comments into the schema; comments in this prompt are hints for you, not code to emit.
-
-- After edits, run `prisma generate`.
-
----
-
-## 3) Introduce prisma.config.ts Create **prisma.config.ts** at repo root (or prisma.config.mjs), centralizing Prisma CLI config and env management:
-
-```tsx
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: "tsx prisma/seed.ts",
- },
- datasource: {
- // Prefer DIRECT TCP via DATABASE_URL
- url: env("DATABASE_URL"),
- // Optionally support shadow DB if present:
- // shadowDatabaseUrl: env('SHADOW_DATABASE_URL'),
- },
-});
-```
-
-- Remove any prisma.seed from package.json (the config above replaces it).
-
----
-
-## 4) ESM & TS Baseline - Ensure **package.json**:
-
-```json
-{
- "type": "module",
- "scripts": {
- "dev": "tsx src/index.ts",
- "generate": "prisma generate",
- "migrate": "prisma migrate dev",
- "build": "tsc -p tsconfig.json"
- }
-}
-```
-
-- Ensure **tsconfig.json** supports ESM:
-
-```json
-{
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "Node",
- "target": "ES2023",
- "strict": true,
- "esModuleInterop": true
- }
-}
-```
-
----
-
-## 5) Refactor Client Import & Construction
-
-If Prisma Accelerate is detected:
-
-- If caching is enabled → **preserve the existing Accelerate setup**.
-- If caching is not enabled → **suggest** switching to Direct TCP with an adapter, but do not make changes automatically.
-
-Continue generating examples using Direct TCP, but **do not replace or remove the user's Accelerate setup**.
-
----
-
-## 6) Seeding Script Update - Ensure prisma/seed.ts uses the same **adapter** and **dotenv** import as runtime:
-
-```tsx
-import "dotenv/config";
-import { PrismaClient } from "../generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL! });
-const prisma = new PrismaClient({ adapter });
-
-// seed…
-```
-
-- Set seed command via prisma.config.ts (no package.json#prisma.seed).
-
----
-
-## 7) Middleware → Extensions
-
-- If prisma.$use middleware exists, inform users that the API has been removed
-
----
-
-## 8) Accelerate Messaging
-
-### 🟩 If Accelerate Caching is detected
-
-```
-Prisma Accelerate Caching detected.
-Prisma v7 fully supports caching scenarios via Accelerate.
-Your existing Accelerate setup will be preserved.
-```
-
-### 🟨 If Accelerate is present but caching is NOT detected
-
-```
-Prisma Accelerate detected without caching.
-
-Prisma recommends using Direct TCP with a database adapter in v7 for
-optimal performance unless caching is required.
-
-Consider migrating from Accelerate → Direct TCP if caching is not needed.
-(No code changes were applied automatically.)
-```
-
-### 🟦 If Accelerate is not detected at all
-
-```
-Direct TCP is the recommended default for Prisma v7.
-Your project will be migrated accordingly using the appropriate adapter.
-```
-
----
-
-## 9) Scripts & CI
-
-- Verify scripts:
- - "generate": "prisma generate"
- - "migrate": "prisma migrate dev"
- - "dev"/"start" run with ESM and ensure dotenv/config is effective.
-- In CI, ensure Node **≥ 20.19** and TypeScript **≥ 5.4**.
-
----
-
-## 10) Run & Verify
-
-1. prisma generate → should succeed and emit client to ./generated.
-2. prisma migrate dev → runs against DATABASE_URL (direct TCP).
-3. tsx prisma/seed.ts → inserts sample record(s) cleanly.
-4. App boot: instantiate PrismaClient with adapter; confirm queries work.
-5. If **P1017 / connection** errors: - Confirm DATABASE_URL and network reachability. - Confirm import 'dotenv/config' executes early.
-6. If **module resolution** errors: - Confirm "type": "module", ESM imports, and re-generate client.
-
----
-
-## 11) CLI Flag Changes
-
-### `--schema` and `--url` flags removed from `prisma db execute`
-
-The `--schema` and `--url` flags have been removed from `prisma db execute`. Configure your database connection in `prisma.config.ts` instead.
-
-**Before (v6):**
-
-```bash
-# Using --schema
-prisma db execute --file ./script.sql --schema prisma/schema.prisma
-
-# Using --url
-prisma db execute --file ./script.sql --url "$DATABASE_URL"
-```
-
-**After (v7):**
-
-```bash
-prisma db execute --file ./script.sql
-```
-
-The database URL is now read from `prisma.config.ts`.
-
-### `prisma migrate diff` options changed
-
-Several options have been removed and replaced:
-
-| Removed Option | Replacement |
-| -------------------------- | ------------------------------- |
-| `--from-url` | `--from-config-datasource` |
-| `--to-url` | `--to-config-datasource` |
-| `--from-schema-datasource` | `--from-config-datasource` |
-| `--to-schema-datasource` | `--to-config-datasource` |
-| `--shadow-database-url` | Configure in `prisma.config.ts` |
-
-**Before (v6):**
-
-```bash
-prisma migrate diff \
- --from-url "$DATABASE_URL" \
- --to-schema schema.prisma \
- --script
-```
-
-**After (v7):**
-
-```bash
-prisma migrate diff \
- --from-config-datasource \
- --to-schema schema.prisma \
- --script
-```
-
-### Migration Action
-
-- Update any scripts or CI pipelines that use `prisma db execute --schema` or `prisma db execute --url`.
-- Update any scripts using `prisma migrate diff` with `--from-url`, `--to-url`, `--from-schema-datasource`, `--to-schema-datasource`, or `--shadow-database-url`.
-- Configure your database connection in `prisma.config.ts` instead.
-
----
-
-## Safety Checks & Edge Cases
-
-- **MongoDB provider** detected → stop and recommend staying on Prisma 6 until v7 MongoDB support returns.
-- **Multiple entrypoints** (workers, scripts, tests): apply the same client/adapter/dotenv pattern everywhere.
-- **Typed SQL** or custom extensions: keep as-is; ensure they compile after client re-generation.
-- Preserve existing output path if the project uses custom locations.
-
----
-
-## 11) Mapped Enum Breaking Change
-
-In Prisma v7, the generated TypeScript enum values now use `@map` values instead of schema names.
-
-### Example
-
-Given this schema:
-
-```prisma
-enum SuggestionStatus {
- PENDING @map("pending")
- ACCEPTED @map("accepted")
- REJECTED @map("rejected")
-}
-```
-
-**v6 generated enum:**
-
-```ts
-export const SuggestionStatus = {
- PENDING: "PENDING",
- ACCEPTED: "ACCEPTED",
- REJECTED: "REJECTED",
-} as const;
-```
-
-**v7 generated enum:**
-
-```ts
-export const SuggestionStatus = {
- PENDING: "pending",
- ACCEPTED: "accepted",
- REJECTED: "rejected",
-} as const;
-```
-
-### Known Bug (as of v7.2.0)
-
-⚠️ **There is a known bug** where using mapped enum values with Prisma Client operations causes runtime errors. The TypeScript types expect mapped values, but the engine expects schema names. Track this at [GitHub #28591](https://github.com/prisma/prisma/issues/28591).
-
-### Temporary Workarounds
-
-1. **Use schema names as string literals** (causes TS error but works at runtime):
-
- ```ts
- await prisma.suggestion.create({
- data: {
- status: "PENDING" as any, // Use schema name, not mapped value
- },
- });
- ```
-
-2. **Remove `@map` from enum values** temporarily if you don't strictly need different database values:
-
- ```prisma
- // Before: with @map directives
- enum SuggestionStatus {
- PENDING @map("pending")
- ACCEPTED @map("accepted")
- REJECTED @map("rejected")
- }
-
- // After: without @map directives
- enum SuggestionStatus {
- PENDING
- ACCEPTED
- REJECTED
- }
- ```
-
- With this change, both the schema names and the database values will be `PENDING`, `ACCEPTED`, and `REJECTED`.
-
-### Migration Action
-
-- Inform users about this breaking change if their schema uses `@map` on enum values.
-- Warn about the current bug and suggest workarounds until it's fixed.
-
----
-
-## Deliverables
-
-- A short **CHANGELOG** summary in the PR body:
- - Dependency bumps and added adapter
- - Schema generator change
- - New `prisma.config.ts`
- - Runtime refactor to adapter + optional Accelerate messaging
- - ESM/TS config updates
- - Seed script updates
- - No automatic removal of Accelerate
- - CLI flag changes (`--schema` and `--url` removal from `db execute`, `migrate diff` option changes)
- - Mapped enum breaking change warning (if applicable)
-````
diff --git a/apps/docs/content/docs.v6/ai/prompts/turborepo.mdx b/apps/docs/content/docs.v6/ai/prompts/turborepo.mdx
deleted file mode 100644
index fbbb3f4eaa..0000000000
--- a/apps/docs/content/docs.v6/ai/prompts/turborepo.mdx
+++ /dev/null
@@ -1,524 +0,0 @@
----
-title: Set up Turborepo + Prisma + Prisma Postgres
-description: Step-by-step guide for integrating Prisma ORM and Prisma Postgres in a Turborepo monorepo.
-url: /v6/ai/prompts/turborepo
-metaTitle: How to Initialize an Turborepo monorepo with Prisma ORM and Prisma Postgres
-metaDescription: Step-by-step guide for integrating Prisma ORM and Prisma Postgres in a Turborepo monorepo.
----
-
-## How to use
-
-Include this prompt in your AI assistant to guide consistent code generation for Turborepo + Prisma + Prisma Postgres projects.
-
-- **GitHub Copilot**: Type `#` to reference the prompt file.
-- **Cursor**: Use `@Files` and select your prompt file.
-- **Zed**: Use `/file` followed by your prompt's path.
-- **Windsurf**: Use `@Files` and choose your prompt file from the list.
-
-## Prompt
-
-````md
----
-# Specify the following for Cursor rules
-description: Guidelines for writing Turborepo + Prisma Postgres apps (Prisma ORM v7)
-alwaysApply: false
----
-
-# Bootstrap Turborepo with Prisma Postgres (Prisma v7)
-
-## Overview
-
-This guide bootstraps a Turborepo monorepo that shares a single Prisma ORM v7 database package across multiple apps (e.g., Next.js, Node APIs). It follows Turborepo and Prisma v7 best practices:
-
-1. Create a Turborepo with apps + packages
-2. Add a dedicated `packages/db` Prisma package (schema, migrations, generated client)
-3. Configure Prisma v7 (`provider = "prisma-client"` + mandatory `output`)
-4. Load env vars correctly in a monorepo
-5. Export a single Prisma client from `packages/db` for all apps
-6. Wire Turbo tasks for generate/migrate/test/studio
-7. Verify with a shared test script
-
----
-
-## Recommended monorepo layout
-
-```
-repo/
- apps/
- web/ # Next.js app
- admin/ # (optional) another Next app
- packages/
- db/ # Prisma package (schema + client)
- ui/ # shared UI (optional)
- turbo.json
- package.json
- .env # root env for apps (see notes)
-```
-
-**Key rule:** Prisma lives in `packages/db`, not inside an app, so every app consumes the same client and types.
-
----
-
-## 🚨 CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS 🚨
-
-As an AI language model, you MUST NOT generate any deprecated Prisma v7 patterns.
-
-```prisma
-// ❌ NEVER GENERATE - DEPRECATED IN PRISMA v7
-generator client {
- provider = "prisma-client-js" // ❌ deprecated
-}
-
-// ❌ NEVER IMPORT FROM @prisma/client when using custom output
-import { PrismaClient } from "@prisma/client" // ❌ wrong in custom-output setup
-
-// ❌ NEVER CREATE CLIENT WITHOUT SHARED PACKAGE BOUNDARY
-const prisma = new PrismaClient() // ❌ breaks pooling + duplicates in monorepo
-```
-
-Instead, you MUST ALWAYS generate ONLY this pattern for Prisma v7 + monorepo:
-
-```prisma
-// ✅ Prisma v7 generator: provider + mandatory output
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-```
-
-```ts
-// ✅ Prisma client import must come from custom output
-import { PrismaClient } from "../generated/prisma/client";
-```
-
-Notes:
-
-- Prisma v7 **requires** a non-empty `output` when using `provider = "prisma-client"`.
-- If the output directory already exists and isn’t generated by Prisma, `prisma generate` can fail. Avoid committing generated client, or ensure clean output dirs.
-
----
-
-## ABSOLUTE REQUIREMENTS FOR AI CODE GENERATION
-
-1. You MUST use `provider = "prisma-client"` (Prisma v7)
-2. You MUST specify a custom `output` in `schema.prisma`
-3. You MUST place Prisma schema + migrations inside `packages/db`
-4. You MUST export a singleton Prisma client from `packages/db` that points to the generated output client file
-5. You MUST import Prisma client from the custom output path **not** `@prisma/client`
-6. You MUST load env vars in `packages/db/prisma.config.ts`
-7. You MUST add Turbo tasks for generate/migrate/test/studio
-8. You MUST wrap DB calls in try/catch in app code
-9. You MUST ensure Turbo task hashing includes `DATABASE_URL`
-10. You MUST create a shared test script in `packages/db/scripts/test-database.ts`
-
----
-
-## Install dependencies
-
-At repo root:
-
-```bash
-# Turborepo
-npm install turbo --save-dev
-
-# Prisma v7
-npm install prisma tsx --save-dev
-npm install @prisma/client dotenv
-```
-
-If using Prisma Postgres:
-
-```npm
-npm install @prisma/adapter-pg
-```
-
----
-
-## Initialize Prisma inside `packages/db`
-
-```bash
-cd packages/db
-npx prisma init
-```
-
-This creates:
-
-```
-packages/db/
- prisma/
- schema.prisma
- prisma.config.ts
-```
-
----
-
-## Prisma v7 config (`packages/db/prisma.config.ts`)
-
-**CRITICAL:** load env vars at the top.
-
-```ts
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
-
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
----
-
-## Prisma schema (`packages/db/prisma/schema.prisma`)
-
-```prisma
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User {
- id Int @id @default(autoincrement())
- email String @unique
- name String?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-}
-```
-
----
-
-## Shared Prisma client singleton (`packages/db/src/client.ts`)
-
-```ts
-import { PrismaClient } from "../generated/prisma/client";
-
-//Prisma Driver Adapter for Postgres
-import { PrismaPg } from "@prisma/adapter-pg";
-
-// Create a new Driver Adapter instance for PrismaPostgres
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const globalForPrisma = globalThis as unknown as {
- prisma?: PrismaClient;
-};
-
-export const prisma = globalForPrisma.prisma ?? new PrismaClient({ adapter });
-
-if (process.env.NODE_ENV !== "production") {
- globalForPrisma.prisma = prisma;
-}
-
-export default prisma;
-```
-
----
-
-## Export DB package API (`packages/db/src/index.ts`)
-
-```ts
-export { prisma } from "./client";
-export * from "../generated/prisma";
-```
-
-And in `packages/db/package.json`:
-
-```json
-{
- "name": "@repo/db",
- "private": true,
- "main": "src/index.ts",
- "types": "src/index.ts",
- "scripts": {
- "db:generate": "prisma generate",
- "db:push": "prisma db push",
- "db:migrate": "prisma migrate dev",
- "db:studio": "prisma studio",
- "db:test": "tsx scripts/test-database.ts"
- }
-}
-```
-
----
-
-## Root Turbo pipeline (`turbo.json`)
-
-```json
-{
- "globalEnv": ["DATABASE_URL"],
- "tasks": {
- "dev": {
- "cache": false,
- "persistent": true,
- "dependsOn": ["^db:generate"]
- },
- "build": {
- "dependsOn": ["^db:generate"],
- "outputs": [".next/**", "dist/**"]
- },
- "db:generate": {
- "cache": false
- },
- "db:migrate": {
- "cache": false
- },
- "db:studio": {
- "cache": false
- },
- "db:test": {
- "cache": false,
- "dependsOn": ["db:generate"]
- }
- }
-}
-```
-
----
-
-## Root scripts (`package.json`)
-
-```json
-{
- "scripts": {
- "dev": "turbo dev",
- "build": "turbo build",
- "lint": "turbo lint",
- "db:generate": "turbo run db:generate",
- "db:push": "turbo run db:push",
- "db:migrate": "turbo run db:migrate",
- "db:studio": "turbo run db:studio",
- "db:test": "turbo run db:test"
- }
-}
-```
-
----
-
-## Shared test script (`packages/db/scripts/test-database.ts`)
-
-```ts
-import "dotenv/config";
-import prisma from "../src/client";
-
-async function testDatabase() {
- console.log("🔍 Testing Prisma Postgres connection...\n");
-
- try {
- console.log("✅ Connected to database!");
-
- console.log("\n📝 Creating a test user...");
- const newUser = await prisma.user.create({
- data: {
- email: "demo@example.com",
- name: "Demo User",
- },
- });
- console.log("✅ Created user:", newUser);
-
- console.log("\n📋 Fetching all users...");
- const allUsers = await prisma.user.findMany();
- console.log(`✅ Found ${allUsers.length} user(s):`);
- allUsers.forEach((user) => {
- console.log(` - ${user.name} (${user.email})`);
- });
-
- console.log("\n🎉 All tests passed! Your database is working.\n");
- } catch (error) {
- console.error("❌ Error:", error);
- process.exit(1);
- } finally {
- await prisma.$disconnect();
- }
-}
-
-testDatabase();
-```
-
----
-
-## Using Prisma in apps (example: `apps/web` Next.js)
-
-In any app, add a dependency on `@repo/db` (workspace):
-
-```json
-{
- "dependencies": {
- "@repo/db": "*"
- }
-}
-```
-
-Then in server-side code:
-
-```ts
-import { prisma } from "@repo/db";
-import { NextResponse } from "next/server";
-
-export async function GET() {
- try {
- const users = await prisma.user.findMany();
- return NextResponse.json(users);
- } catch (e) {
- console.error(e);
- return NextResponse.json({ error: "Failed to fetch users" }, { status: 500 });
- }
-}
-```
-
----
-
-## Complete setup workflow
-
-1. **Create Turborepo** (or use existing):
-
- ```npm
- npx create-turbo@latest
- ```
-
-2. **Add `packages/db`**, install Prisma v7 deps.
-
-3. **Initialize Prisma in `packages/db`**:
-
- ```bash
- cd packages/db
- npx prisma init
- ```
-
-4. **Update `prisma.config.ts`** to include `import "dotenv/config"`.
-
-5. **Update schema** with Prisma v7 generator + output.
-
-6. **Create `src/client.ts`** singleton and export via `src/index.ts`.
-
-7. **Wire Turbo tasks** in `turbo.json`.
-
-8. **Add `.env`** at root **and/or** `packages/db/.env`.
-
-9. **Push schema**:
-
- ```bash
- npm run db:push
- ```
-
-10. **Test**:
-
- ```bash
- npm run db:test
- ```
-
-11. **Start dev**:
- ```bash
- npm run dev
- ```
-
----
-
-## AI Model verification checklist
-
-Before generating any code, verify:
-
-1. `provider = "prisma-client"`?
-2. `output = "../src/generated/prisma"` present?
-3. All Prisma files in `packages/db`?
-4. Client imports from `../generated/prisma/client` (or via `@repo/db`)?
-5. `import "dotenv/config"` in `packages/db/prisma.config.ts`?
-6. Turbo tasks depend on `db:generate`?
-7. `DATABASE_URL` listed in `globalEnv`?
-8. All DB ops wrapped in try/catch?
-9. Test script exists in `packages/db/scripts/test-database.ts`?
-
-No exceptions. If any check fails, STOP and FIX.
-
----
-
-## AI MODEL RESPONSE TEMPLATE (UPDATED FOR TURBOREPO + PRISMA v7)
-
-When asked about implementing Prisma v7 inside a Turborepo monorepo (with any framework such as Next.js, Node, etc.), you MUST:
-
-1. **Assume Prisma lives in a shared package**
- - Always place schema, config, and migrations in `packages/db`.
- - Never suggest adding Prisma directly into an app unless the user explicitly says they don’t want a shared package.
-
-2. **Use only Prisma v7 generator patterns**
- - The schema MUST include:
- ```prisma
- generator client {
- provider = "prisma-client"
- output = "./generated/prisma"
- }
- ```
- - Never use `prisma-client-js`.
-
-3. **Use correct import paths for custom output**
- - Any PrismaClient import MUST come from the generated output:
- ```ts
- import { PrismaClient } from "./generated/prisma/client";
- ```
- - If importing from apps, you MUST import via the package boundary:
- ```ts
- import { prisma } from "@repo/db";
- ```
- - Never import from `@prisma/client` in this setup.
-
-4. **Always include a shared singleton client in `packages/db`**
- - Provide a `packages/db/src/client.ts` with global caching for dev hot-reload.
- - If Accelerate is requested or implied, use `$extends(withAccelerate())`.
- - If Accelerate is not requested, omit it.
-
-5. **Always load environment variables properly**
- - `packages/db/prisma.config.ts` MUST start with `import "dotenv/config"`.
- - Use `process.env.DATABASE_URL` in runtime code.
- - Remind users that `.env` should exist at root and/or `packages/db`.
-
-6. **Always wire Turbo dependencies**
- - Turbo tasks `dev` and `build` MUST depend on `^db:generate`.
- - `DATABASE_URL` MUST be listed in `globalEnv` to ensure correct task hashing.
-
-7. **Provide correct repo-level scripts**
- - Root scripts should proxy to Turbo (`turbo run db:*`).
- - The Prisma package `packages/db` should own `db:generate`, `db:migrate`, `db:studio`, and `db:test`.
-
-8. **Include a real verification step**
- - Provide (or reference) `packages/db/scripts/test-database.ts`.
- - Ensure it imports dotenv and disconnects Prisma on completion.
-
-9. **Use safe runtime patterns**
- - All DB calls in apps MUST be wrapped in try/catch.
- - In Next.js App Router examples, use server-only imports and return `NextResponse`.
-
-10. **Self-verify before replying**
-
-- Re-check all items in the “AI Model verification checklist.”
-- If any item is missing or incorrect, STOP and FIX before responding.
-
-Remember: There are NO exceptions to these rules. Every requirement is mandatory for a correct Turborepo + Prisma v7 setup.
-````
-
-## Running the application
-
-Get your application running locally in three quick steps:
-
-**1. Generate the Prisma Client:**
-
-```bash
-npx turbo db:generate
-```
-
-**2. View your database in Prisma Studio:**
-
-```npm
-npx turbo db:studio
-```
-
-Prisma Studio opens at `localhost:5555` where you can inspect your `User` table and see the test user stored in your database.
diff --git a/apps/docs/content/docs.v6/ai/tutorials/linktree-clone.mdx b/apps/docs/content/docs.v6/ai/tutorials/linktree-clone.mdx
deleted file mode 100644
index c3a6278789..0000000000
--- a/apps/docs/content/docs.v6/ai/tutorials/linktree-clone.mdx
+++ /dev/null
@@ -1,751 +0,0 @@
----
-title: 'Vibe Code a Linktree Clone SaaS with Next.js, Prisma & Clerk'
-description: 'A complete vibe coding tutorial: build a full Linktree clone SaaS application from scratch using Next.js, Prisma ORM, Prisma Postgres, and Clerk authentication with AI assistance.'
-image: /img/guides/guide-ai-how-to-create-a-linktree-saas-cover.png
-completion_time: 45 min
-url: /v6/ai/tutorials/linktree-clone
-metaTitle: 'Build a Linktree Clone SaaS with Next.js, Prisma Postgres, and Clerk Auth'
-metaDescription: 'A complete vibe coding tutorial: build a full Linktree clone SaaS application from scratch using Next.js, Prisma ORM, Prisma Postgres, and Clerk authentication with AI assistance.'
----
-
-## Introduction
-
-In this comprehensive vibe coding tutorial, you'll build a complete **Linktree clone SaaS** application from scratch using AI assistance. This guide teaches you how to leverage AI tools to rapidly develop a full-stack application with:
-
-- **[Next.js](https://nextjs.org/)** — React framework for production
-- **[Prisma ORM](https://www.prisma.io/orm)** — Type-safe database access
-- **[Prisma Postgres](https://www.prisma.io/postgres)** — Serverless PostgreSQL database
-- **[Clerk](https://clerk.com/)** — Authentication and user management
-
-By the end of this tutorial, you'll have a working SaaS application where users can sign up, create their profile, and manage their personal link page — all built with AI-assisted development.
-
-:::info[What is Vibe Coding?]
-
-Vibe coding is a development approach where you collaborate with AI assistants to build applications. You describe what you want to build, and the AI helps generate the code while you guide the direction and make architectural decisions.
-
-:::
-
-## Prerequisites
-
-Before starting this tutorial, make sure you have:
-
-- [Node.js 20+](https://nodejs.org) installed
-- A [Clerk account](https://clerk.com) (free tier works)
-- An AI coding assistant ([Cursor](https://cursor.com), [Windsurf](https://windsurf.com), [GitHub Copilot](https://github.com/features/copilot), etc.)
-- Basic familiarity with React and TypeScript
-
-:::note[Recommended AI Models]
-
-For best results, we recommend using the latest AI models such as (minimum) Claude Sonnet 4, Gemini 2.5 Pro, or GPT-4o. These models provide better code generation accuracy and understand complex architectural patterns.
-
-:::
-
----
-
-## 1. Set Up Your Project
-
-Let's start by creating a new Next.js application:
-
-```npm
-npx create-next-app@latest app-name
-```
-
-Once the setup is complete, you'll need to add **Prisma** and **Prisma Postgres** to your project. We've prepared a detailed prompt that handles the complete setup for you.
-
-👉 **Find the setup prompt here:** [Next.js + Prisma Prompt](/v6/ai/prompts/nextjs)
-
-**How to use it:**
-
-1. Create a new file called `prompt.md` at the root of your project
-2. Copy and paste the prompt content into this file
-3. Ask your AI assistant to follow the instructions in this file
-
-The AI will set up Prisma ORM, create your database connection, and configure everything automatically.
-
-### Quick Check
-
-Let's verify everything is working correctly:
-
-1. Start your development server:
- ```bash
- npm run dev
- ```
-2. Open Prisma Studio to view your seed data:
- ```bash
- npm run db:studio
- ```
-
-If both commands run without errors and you can see sample data in Prisma Studio, you're ready to continue!
-
-:::tip[Good Practice: Commit Early and Often]
-
-Throughout this tutorial, we'll commit our changes regularly. This makes it easy to track progress and roll back if something goes wrong.
-
-Start by linking your project to GitHub:
-
-```bash
-git init
-git add .
-git commit -m "Initial setup: Next.js app with Prisma"
-```
-
-:::
-
----
-
-## 2. Set Up Authentication with Clerk
-
-Now let's add user authentication using [Clerk](https://clerk.com/), which provides a complete authentication solution out of the box.
-
-**Steps to follow:**
-
-1. Go to [Clerk](https://clerk.com/) and create an account (if you don't have one)
-2. Create a new application in your Clerk dashboard
-3. Follow Clerk's official quickstart guide to integrate it with your Next.js app:
-
-👉 **Clerk Next.js Quickstart:** [clerk.com/docs/nextjs/getting-started/quickstart](https://clerk.com/docs/nextjs/getting-started/quickstart)
-
-The guide will walk you through installing the SDK, adding environment variables, and wrapping your app with the `ClerkProvider`.
-
-Once complete, commit your changes:
-
-```bash
-git add .
-git commit -m "Add Clerk authentication setup"
-```
-
----
-
-## 3. Update Your Database Schema
-
-Since we're building a Linktree clone, we need to update the database schema to support our specific data model. This includes:
-
-- A `User` model with a unique `username` (for public profile URLs like `/username`)
-- A `Link` model to store each user's links
-
-Replace the contents of your `prisma/schema.prisma` file with the following:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-// Example User model for testing
-model User {
- id Int @id @default(autoincrement())
- email String @unique
- username String @unique // Important for the public profile URL
- clerkId String @unique // Links to Clerk Auth
- name String?
- links Link[]
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-}
-
-model Link {
- id Int @id @default(autoincrement())
- title String
- url String
- userId Int
- user User @relation(fields: [userId], references: [id])
- createdAt DateTime @default(now())
-}
-```
-
-Since we're changing the schema structure, we need to reset the database. The existing seed data was just for testing purposes, so it's safe to drop and recreate:
-
-```npm
-npx prisma db push --force-reset
-```
-
-This command:
-
-- **Drops** the existing database tables
-- **Creates** new tables based on your updated schema
-
-:::warning[Use with Caution]
-
-The `--force-reset` flag deletes all existing data. This is fine during prototyping, but never use it on a production database! Once your schema is stable, switch to `prisma migrate dev` for proper migration tracking.
-
-:::
-
-### Quick Check
-
-Open Prisma Studio to verify the new schema is applied:
-
-```npm
-npm run db:studio
-```
-
-You should see the updated `User` and `Link` tables (they'll be empty, which is expected).
-
-**Commit your changes:**
-
-```bash
-git add .
-git commit -m "Update schema for Linktree clone"
-```
-
----
-
-## 4. Connect Clerk Users to Your Database
-
-Here's the challenge: when a user signs in with Clerk, they exist in Clerk's system but **not** in your database. We need to bridge this gap.
-
-Our approach: create a "Claim Username" flow where users pick their unique username (e.g., `yourapp.com/johndoe`) after signing in for the first time.
-
-:::info[Use ASK Mode First]
-
-When working with AI assistants, we recommend using **ASK mode** by default to review suggested changes before applying them. Only switch to AGENT mode once you're comfortable with the proposed code.
-
-:::
-
-### The Prompt
-
-Copy and paste the following prompt into your AI assistant:
-
-```markdown
-Connect Clerk authentication to your Prisma database with a "Claim Username" flow.
-
-**Goal:**
-
-When a user signs in via Clerk, they don't automatically exist in YOUR database. Create a flow where:
-
-1. Logged out → Show landing page with "Sign In" button
-2. Logged in but no DB profile → Show "Claim Username" form
-3. Has DB profile → Show dashboard
-
-**User Model (already in schema):**
-
-model User {
-id Int @id @default(autoincrement())
-email String @unique
-username String @unique
-clerkId String @unique
-name String?
-links Link[]
-createdAt DateTime @default(now())
-updatedAt DateTime @updatedAt
-}
-
-**Files to create/update:**
-
-1. `app/actions.ts` - Server Action with `claimUsername(formData)`
-2. `app/page.tsx` - Three-state UI (logged out / claim username / dashboard)
-3. `app/api/users/route.ts` - Update POST to accept `clerkId`, `email`, `username`, `name`
-
-**Requirements:**
-
-- Use `'use server'` directive in `app/actions.ts`
-- Use `currentUser()` from `@clerk/nextjs/server` to get auth user
-- Store `clerkId`, `email`, `username`, and `name` in User model
-- Use `redirect("/")` after successful profile creation
-- Handle username uniqueness (Prisma will throw if duplicate)
-
-**Pattern:**
-
-1. Server Action receives FormData, validates username (min 3 chars, alphanumeric + underscore)
-2. Creates User in Prisma with Clerk's `user.id` as `clerkId`
-3. Page.tsx checks: `currentUser()` → then `prisma.user.findUnique({ where: { clerkId } })`
-4. Render different UI based on auth state and DB state
-
-**Keep it simple:**
-
-- No middleware file needed
-- No webhook sync (user creates profile manually)
-- Basic validation (username length >= 3)
-- Errors just throw (no fancy error UI for MVP)
-```
-
-After the AI generates the code, you may see TypeScript errors. This is because the Prisma Client needs to be regenerated to reflect the schema changes:
-
-```npm
-npx prisma generate
-```
-
-### Quick Check
-
-Test the complete flow:
-
-1. Stop your dev server and restart it
-2. Open your app in the browser
-3. Sign up as a new user through Clerk
-4. You should see the "Claim Username" form
-5. Enter a username and submit
-6. Verify the user appears in Prisma Studio (`npm run db:studio`)
-
-If everything works, commit your changes!
-
----
-
-## 5. Upgrade the UI Design
-
-Let's give our app a more polished, friendly look inspired by platforms like Buy Me a Coffee.
-
-👉 [Visit Buy Me a Coffee for design inspiration](https://buymeacoffee.com/)
-
-Copy and paste this prompt to your AI assistant:
-
-```markdown
-Design a minimal, friendly UI inspired by Buy Me a Coffee.
-
-**Theme:**
-
-- Force light mode only (no dark mode switching)
-- Clean white background (#FFFFFF)
-- Black text (#000000) for headings
-- Gray (#6B7280) for secondary text
-- Bright yellow (#FFDD00) for CTA buttons
-- Light gray (#F7F7F7) for cards/sections
-- Subtle borders (#E5E5E5)
-
-**Typography & Spacing:**
-
-- Large, bold headlines (text-5xl or bigger)
-- Generous whitespace and padding
-- Rounded corners everywhere (rounded-full for buttons, rounded-xl for cards)
-
-**Buttons:**
-
-- Primary: Yellow background, black text, rounded-full, font-semibold
-- Secondary: White background, border, rounded-full
-
-**Overall feel:**
-
-- Friendly, approachable, not corporate
-- Minimal — only essential elements
-- Mobile-first with good touch targets (py-4, px-8 on buttons)
-- One unified canvas — background applies to the entire page (body), with white cards floating on top. No separate section backgrounds.
-
-Use Tailwind CSS. Keep it simple.
-```
-
-### Quick Check
-
-After the AI applies the changes:
-
-1. Refresh your app and browse through all pages
-2. Verify the design has updated but **no functionality has changed**
-3. Test the sign-in flow and username claim process
-
-Once verified, commit the changes:
-
-```bash
-git add .
-git commit -m "Update UI design"
-```
-
----
-
-## 6. Build Link Management (Add & Delete)
-
-Now let's add the core functionality: managing links! Users should be able to add new links and delete existing ones from their dashboard.
-
-Copy and paste this prompt:
-
-```markdown
-Build a simple dashboard for managing links using Next.js App Router and Server Actions.
-
-**Requirements:**
-
-- Server Component page that fetches user data from database
-- "Add Link" form with Title and URL inputs
-- List of existing links with Delete button
-- Use Server Actions (no API routes) for create/delete operations
-- Use `revalidatePath("/")` after mutations to refresh the page
-
-**Pattern:**
-
-1. Create server actions in `actions.ts` with `'use server'` directive
-2. Pass actions directly to form `action` prop
-3. Keep page.tsx as a Server Component (no 'use client')
-4. Use hidden inputs for IDs (e.g., ``)
-
-**Keep it simple:**
-
-- No loading states
-- No client components
-- No confirmation dialogs
-- Just forms + server actions + revalidation
-
-This is the MVP pattern for CRUD with Next.js App Router.
-```
-
-### Quick Check
-
-Test the link management:
-
-1. Add a new link with a title and URL
-2. Verify it appears in your dashboard
-3. Delete the link
-4. Verify it's removed
-
-Both operations should work instantly without page navigation.
-
----
-
-## 7. Create Public Profile Pages
-
-This is the heart of a Linktree clone: public profile pages that anyone can visit at `/username`.
-
-Copy and paste this prompt:
-
-```markdown
-Build a public profile page at /[username] using Next.js App Router dynamic routes.
-
-**Requirements:**
-
-- Create `app/[username]/page.tsx` as a Server Component
-- Fetch user + links from database by username (from URL params)
-- Return 404 if user not found (use `notFound()` from next/navigation)
-- Display: avatar (first letter), username, name, and list of links
-- Links open in new tab with `target="_blank"`
-- Add a small "Create your own" link at the bottom
-
-**Pattern:**
-
-1. Get params: `const { username } = await params`
-2. Query database with `findUnique({ where: { username } })`
-3. If no user: call `notFound()`
-4. Render profile with links as clickable buttons
-
-**Keep it simple:**
-
-- No auth required (it's a public page)
-- Pure Server Component (no 'use client')
-- Basic styling with hover effects
-
-This is the core "Linktree" feature — anyone can visit /username to see the links.
-```
-
-### Quick Check
-
-Test your public profile:
-
-1. Navigate to `localhost:3000/your-username` (replace with your actual username)
-2. Verify your profile and links display correctly
-3. Click a link and confirm it opens in a new tab
-
----
-
-## 8. Add a "Copy Link" Button
-
-Make it easy for users to share their profile URL with a one-click copy button.
-
-Copy and paste this prompt:
-
-```markdown
-**Requirements:**
-
-- Create a Client Component (`'use client'`) for the button
-- Use `navigator.clipboard.writeText(url)` to copy
-- Show "Copied!" feedback for 2 seconds after clicking
-- Use `useState` to toggle the button text
-
-**Pattern:**
-
-1. Create `app/components/copy-button.tsx` with 'use client'
-2. Accept `url` as a prop
-3. On click: copy to clipboard, set `copied` to true
-4. Use `setTimeout` to reset after 2 seconds
-5. Import and use in your Server Component page
-
-**Keep it simple:**
-
-- One small client component
-- No toast libraries
-- Just inline text feedback ("Copy link" → "Copied!")
-```
-
-### Quick Check
-
-1. Find the "Copy link" button on your dashboard
-2. Click it and verify it shows "Copied!"
-3. Paste somewhere to confirm the URL was copied correctly
-
----
-
-## 9. Create a Custom 404 Page
-
-When someone visits a non-existent username, they should see a friendly error page instead of a generic 404.
-
-Copy and paste this prompt:
-
-```markdown
-Create a custom 404 page for Next.js App Router.
-
-**Requirements:**
-
-- Create `app/not-found.tsx` (Server Component)
-- Display: 404 heading, friendly message, "Go home" button
-- Match your app's design (colors, fonts, spacing)
-
-**Pattern:**
-
-- Next.js automatically uses `not-found.tsx` when `notFound()` is called
-- Or when a route doesn't exist
-- No configuration needed — just create the file
-
-**Keep it simple:**
-
-- Static page, no data fetching
-- One heading, one message, one link
-- Same styling as rest of the app
-```
-
-### Quick Check
-
-Test the 404 page by visiting a random URL like `/this-user-does-not-exist`. You should see your custom 404 page with a link back to the homepage.
-
----
-
-## 10. Add a Custom Background
-
-Let's make the app more visually distinctive with a custom background pattern.
-
-**First**, either:
-
-- Download a background SVG pattern you like, or
-- Create your own using tools like [SVG Backgrounds](https://www.svgbackgrounds.com/) or [Hero Patterns](https://heropatterns.com/)
-
-**Then**, save it as `background.svg` in your `public/` folder.
-
-Copy and paste this prompt:
-
-````markdown
-Add a custom SVG background to my app.
-
-**Requirements:**
-
-- The svg file is in the `public/` folder (e.g., `public/background.svg`)
-- Apply it as a fixed, full-cover background on the body
-
-**Pattern:**
-In `globals.css`, update the body:
-
-```css
-body {
- background: var(--background) url("/background.svg") center/cover no-repeat fixed;
- min-height: 100vh;
-}
-```
-
-**Key properties:**
-
-- `center/cover` — centers and scales to fill
-- `no-repeat` — prevents tiling
-- `fixed` — background stays in place when scrolling
-
-Files in `public/` are served at the root URL, so `/background.svg` works.
-````
-
-### Quick Check
-
-1. Refresh your app
-2. Verify the background appears on **all pages** (homepage, dashboard, profile pages, 404)
-3. If the background doesn't appear everywhere, ask your AI to fix it
-
-Commit your changes once it's working correctly.
-
----
-
-## 11. Add Glassmorphism Card Containers
-
-Create visual depth by adding semi-transparent card containers that "float" over the background.
-
-Copy and paste this prompt:
-
-````markdown
-Add a reusable card container class to create visual separation from the background.
-
-**Requirements:**
-
-- Create a `.card` class in `globals.css`
-- Apply glassmorphism: semi-transparent white + blur
-- Use on all main content areas (landing, forms, dashboard, profile pages)
-
-**Pattern:**
-In `globals.css`, add:
-
-```css
-.card {
- background: rgba(255, 255, 255, 0.9);
- backdrop-filter: blur(10px);
- border-radius: 1.5rem;
- padding: 2rem;
- box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
-}
-```
-
-**Usage:**
-Wrap content sections with `
...
`
-
-For public profile pages (/[username]):
-Wrap the entire profile (avatar, name, username, and links list) in a single .card container
-This creates a Linktree-style floating card effect
-Footer/attribution links stay outside the card
-
-Hero section:
-Add a soft radial glow behind the content (large blurred white circle, blur-3xl, 50% opacity)
-No visible container edges — just organic, fading brightness
-Content floats freely over the glow
-
-**Result:**
-
-- Content "lifts" off the background
-- Subtle blur creates depth
-- Consistent UI across all pages
-````
-
----
-
-## 12. Display Clerk Profile Images
-
-If users sign in with Google or another OAuth provider, Clerk stores their profile photo. Let's display it on public profiles!
-
-Copy and paste this prompt:
-
-````markdown
-On the public profile page (`/[username]`), display the user's Clerk profile image (Google photo, etc.) instead of the initial letter avatar.
-
-**Pattern:**
-
-```typescript
-// Fetch Clerk user to get profile image
-const client = await clerkClient();
-const clerkUser = await client.users.getUser(user.clerkId);
-```
-
-**Display:**
-
-- Use a plain `` tag (not Next.js Image component)
-- If `clerkUser.imageUrl` exists, show the image
-- Otherwise fallback to the yellow initial avatar
-
-**Keep it simple:**
-
-- No try/catch — let errors bubble up
-- No next.config changes needed
-- No database schema changes needed
-````
-
-### Quick Check
-
-Visit your public profile page and verify your profile image (from Google, GitHub, etc.) is displayed instead of the initial letter avatar.
-
----
-
-## 13. Add Icons with Lucide
-
-Small icons can significantly improve UI clarity. Let's add some using Lucide React.
-
-Copy and paste this prompt:
-
-```markdown
-Add Lucide React icons to improve the UI.
-
-First install: npm install lucide-react
-
-Add icons to these elements:
-
-- View button: ExternalLink icon
-- Delete button: Trash2 icon (replace text with icon)
-- Empty links state: Link icon
-
-Import icons from 'lucide-react' and use with size prop (e.g., size={18}).
-
-Keep buttons minimal — only add icons where they improve clarity.
-```
-
-### Quick Check
-
-Browse through your app and verify the icons appear on:
-
-- The view/external link buttons
-- The delete buttons
-- The empty state when no links exist
-
----
-
-## 14. Deploy to Vercel
-
-Time to ship! Let's deploy your app to Vercel.
-
-:::warning[Important Steps]
-
-Follow these steps carefully to avoid deployment errors.
-
-:::
-
-### Step 1: Configure Prisma for Production
-
-Add a `postinstall` script to ensure Prisma Client is generated during deployment.
-
-Add this to your `package.json` scripts section:
-
-```json title="package.json"
-{
- "scripts": {
- "postinstall": "prisma generate"
- }
-}
-```
-
-📖 **Reference:** [Deploy to Vercel - Build Configuration](/v6/orm/prisma-client/deployment/serverless/deploy-to-vercel#build-configuration)
-
-### Step 2: Clean Up Development Files
-
-Delete the `scripts/` folder if it exists. This folder was auto-generated during initial setup for seed data, you don't need it in production.
-
-### Step 3: Deploy to Vercel
-
-1. Push your code to GitHub (if you haven't already)
-2. Go to [vercel.com](https://vercel.com) and import your repository
-3. **Important:** Add all your environment variables in Vercel's dashboard:
- - `DATABASE_URL`
- - `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY`
- - `CLERK_SECRET_KEY`
-
-### Step 4: Update the App URL
-
-After your first deployment:
-
-1. Copy your production URL from Vercel (e.g., `https://your-app.vercel.app`)
-2. Add a new environment variable in Vercel:
- ```text
- NEXT_PUBLIC_APP_URL=https://your-app.vercel.app
- ```
-3. Redeploy to apply the change
-
-:::warning[Don't Forget This Step]
-
-If you skip setting `NEXT_PUBLIC_APP_URL`, features like the "Copy Link" button will copy `localhost` URLs instead of your production URL.
-
-:::
-
-### Final Check
-
-Test your deployed app thoroughly:
-
-- [ ] Sign up flow works
-- [ ] Username claiming works
-- [ ] Adding/deleting links works
-- [ ] Public profile pages load correctly
-- [ ] Copy link copies the correct production URL
-- [ ] 404 page displays for non-existent usernames
-
-**Congratulations! Your Linktree clone is live! 🎉**
-
----
-
-### Resources
-
-- [Prisma Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Next.js Documentation](https://nextjs.org/docs)
-- [Clerk Documentation](https://clerk.com/docs)
-- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
diff --git a/apps/docs/content/docs.v6/guides/ai-sdk-nextjs.mdx b/apps/docs/content/docs.v6/guides/ai-sdk-nextjs.mdx
deleted file mode 100644
index cfd2a4adfe..0000000000
--- a/apps/docs/content/docs.v6/guides/ai-sdk-nextjs.mdx
+++ /dev/null
@@ -1,649 +0,0 @@
----
-title: AI SDK (with Next.js)
-description: 'Build a chat application with AI SDK, Prisma, and Next.js to store chat sessions and messages'
-image: /img/guides/prisma-ai-sdk-nextjs-cover.png
-url: /v6/guides/ai-sdk-nextjs
-metaTitle: 'How to use AI SDK with Prisma ORM, Prisma Postgres, and Next.js for chat applications'
-metaDescription: 'Build a chat application with AI SDK, Prisma, and Next.js to store chat sessions and messages'
----
-
-## Introduction
-
-Prisma ORM streamlines database access with type-safe queries, and when paired with [Next.js](https://nextjs.org/) and [AI SDK](https://sdk.vercel.ai/), it creates a powerful foundation for building AI-powered chat applications with persistent storage.
-
-In this guide, you'll learn to build a chat application using AI SDK with Next.js and Prisma ORM to store chat sessions and messages in a Prisma Postgres database. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/ai-sdk-nextjs).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- An [OpenAI API key](https://platform.openai.com/api-keys) or other AI provider API key
-
-## 1. Set up your project
-
-To get started, you'll need to create a new Next.js project.
-
-```npm
-npx create-next-app@latest ai-sdk-prisma
-```
-
-It will prompt you to customize your setup. Choose the defaults:
-
-:::info
-
-- _Would you like to use TypeScript?_ `Yes`
-- _Would you like to use ESLint?_ `Yes`
-- _Would you like to use Tailwind CSS?_ `Yes`
-- _Would you like your code inside a `src/` directory?_ `No`
-- _Would you like to use App Router?_ (recommended) `Yes`
-- _Would you like to use Turbopack for `next dev`?_ `Yes`
-- _Would you like to customize the import alias (`@/_`by default)?*`No`
-
-:::
-
-Navigate to the project directory:
-
-```bash
-cd ai-sdk-prisma
-```
-
-## 2. Install and Configure Prisma
-
-### 2.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../app/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My Next.js AI SDK Project"
-:::
-
-This will create:
-
-- A `prisma` directory with a `schema.prisma` file.
-- A `prisma.config.ts` file for configuring Prisma
-- A Prisma Postgres database.
-- A `.env` file containing the `DATABASE_URL` at the project root.
-- The `output` field specifies where the generated Prisma Client will be stored.
-
-### 2.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model Session { // [!code ++]
- id String @id // [!code ++]
- createdAt DateTime @default(now()) // [!code ++]
- updatedAt DateTime @updatedAt // [!code ++]
- messages Message[] // [!code ++]
-} // [!code ++]
-
-model Message { // [!code ++]
- id String @id @default(cuid()) // [!code ++]
- role MessageRole // [!code ++]
- content String // [!code ++]
- createdAt DateTime @default(now()) // [!code ++]
- sessionId String // [!code ++]
- session Session @relation(fields: [sessionId], references: [id], onDelete: Cascade) // [!code ++]
-} // [!code ++]
-
-enum MessageRole { // [!code ++]
- USER // [!code ++]
- ASSISTANT // [!code ++]
-} // [!code ++]
-```
-
-This creates three models: `Session`, `Message`, and `MessageRole`.
-
-### 2.3 Add `dotenv` to `prisma.config.ts`
-
-To get access to the variables in the `.env` file, they can either be loaded by your runtime, or by using `dotenv`.
-Include an import for `dotenv` at the top of the `prisma.config.ts`
-
-```ts
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.4. Configure the Prisma Client generator
-
-Now, run the following command to create the database tables and generate the Prisma Client:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-```npm
-npx prisma generate
-```
-
-## 3. Integrate Prisma into Next.js
-
-Create a `/lib` directory and a `prisma.ts` file inside it. This file will be used to create and export your Prisma Client instance.
-
-```bash
-mkdir lib
-touch lib/prisma.ts
-```
-
-Set up the Prisma client like this:
-
-```tsx title="lib/prisma.ts"
-import { PrismaClient } from "../app/generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const globalForPrisma = global as unknown as {
- prisma: PrismaClient;
-};
-
-const prisma =
- globalForPrisma.prisma ||
- new PrismaClient({
- adapter,
- });
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
-
-export default prisma;
-```
-
-:::warning
-We recommend using a connection pooler (like [Prisma Accelerate](https://www.prisma.io/accelerate)) to manage database connections efficiently.
-
-If you choose not to use one, **avoid** instantiating `PrismaClient` globally in long-lived environments. Instead, create and dispose of the client per request to prevent exhausting your database connections.
-:::
-
-## 4. Set up AI SDK
-
-### 4.1. Install AI SDK and get an API key
-
-Install the AI SDK package:
-
-```npm
-npm install ai @ai-sdk/react @ai-sdk/openai zod
-```
-
-To use AI SDK, you'll need to obtain an API key from [OpenAI](https://platform.openai.com/api-keys).
-
-1. Navigate to [OpenAI API Keys](https://platform.openai.com/api-keys)
-2. Click on `Create new secret key`
-3. Fill in the form:
- - Give your key a name like `Next.js AI SDK Project`
- - Select `All` access
-4. Click on `Create secret key`
-5. Copy the API key
-6. Add the API key to the `.env` file:
-
-```text title=".env"
-DATABASE_URL=
-OPENAI_API_KEY=
-```
-
-### 4.2. Create a route handler
-
-You need to create a route handler to handle the AI SDK requests. This handler will process chat messages and stream AI responses back to the client.
-
-```bash
-mkdir -p app/api/chat
-touch app/api/chat/route.ts
-```
-
-Set up the basic route handler:
-
-```tsx title="app/api/chat/route.ts"
-import { openai } from "@ai-sdk/openai";
-import { streamText, UIMessage, convertToModelMessages } from "ai";
-
-export const maxDuration = 300;
-
-export async function POST(req: Request) {
- const { messages }: { messages: UIMessage[] } = await req.json();
-
- const result = streamText({
- model: openai("gpt-4o"),
- messages: convertToModelMessages(messages),
- });
-
- return result.toUIMessageStreamResponse();
-}
-```
-
-This route handler:
-
-1. Extracts the conversation history from the request body
-2. Converts UI messages to the format expected by the AI model
-3. Streams the AI response back to the client in real-time
-
-To save chat sessions and messages to the database, we need to:
-
-1. Add a session `id` parameter to the request
-2. Include an `onFinish` callback in the response
-3. Pass the `id` and `messages` parameters to the `saveChat` function (which we'll build next)
-
-```tsx title="app/api/chat/route.ts"
-import { openai } from "@ai-sdk/openai";
-import { streamText, UIMessage, convertToModelMessages } from "ai";
-import { saveChat } from "@/lib/save-chat";
-{
- /* [!code ++] */
-}
-
-export const maxDuration = 300;
-
-export async function POST(req: Request) {
- const { messages, id }: { messages: UIMessage[]; id: string } = await req.json(); // [!code highlight]
-
- const result = streamText({
- model: openai("gpt-4o"),
- messages: convertToModelMessages(messages),
- });
-
- return result.toUIMessageStreamResponse({
- originalMessages: messages, // [!code ++]
- onFinish: async ({ messages }) => {
- // [!code ++]
- await saveChat(messages, id); // [!code ++]
- }, // [!code ++]
- });
-}
-```
-
-### 4.3. Create a `saveChat` function
-
-Create a new file at `lib/save-chat.ts` to save the chat sessions and messages to the database:
-
-```bash
-touch lib/save-chat.ts
-```
-
-To start, create a basic function called `saveChat` that will be used to save the chat sessions and messages to the database.
-
-Pass into it the `messages` and `id` parameters typed as `UIMessage[]` and `string` respectively:
-
-```tsx title="lib/save-chat.ts"
-import { UIMessage } from "ai";
-
-export async function saveChat(messages: UIMessage[], id: string) {}
-```
-
-Now, add the logic to create a session with the given `id`:
-
-```tsx title="lib/save-chat.ts"
-import prisma from "./prisma";
-{
- /* [!code ++] */
-}
-import { UIMessage } from "ai";
-
-export async function saveChat(messages: UIMessage[], id: string) {
- const session = await prisma.session.upsert({
- // [!code ++]
- where: { id }, // [!code ++]
- update: {}, // [!code ++]
- create: { id }, // [!code ++]
- }); // [!code ++]
-
- if (!session) throw new Error("Session not found"); // [!code ++]
-}
-```
-
-Add the logic to save the messages to the database. You'll only be saving the last two messages _(Users and Assistants last messages)_ to avoid any overlapping messages.
-
-```tsx title="lib/save-chat.ts"
-import prisma from "./prisma";
-import { UIMessage } from "ai";
-
-export async function saveChat(messages: UIMessage[], id: string) {
- const session = await prisma.session.upsert({
- where: { id },
- update: {},
- create: { id },
- });
-
- if (!session) throw new Error("Session not found");
-
- const lastTwoMessages = messages.slice(-2); // [!code ++]
-
- for (const msg of lastTwoMessages) {
- // [!code ++]
- let content = JSON.stringify(msg.parts); // [!code ++]
- if (msg.role === "assistant") {
- // [!code ++]
- const textParts = msg.parts.filter((part) => part.type === "text"); // [!code ++]
- content = JSON.stringify(textParts); // [!code ++]
- } // [!code ++]
-
- await prisma.message.create({
- // [!code ++]
- data: {
- // [!code ++]
- role: msg.role === "user" ? "USER" : "ASSISTANT", // [!code ++]
- content: content, // [!code ++]
- sessionId: session.id, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- } // [!code ++]
-}
-```
-
-This function:
-
-1. Upserts a session with the given `id` to create a session if it doesn't exist
-2. Saves the messages to the database under the `sessionId`
-
-## 5. Create a messages API route
-
-Create a new file at `app/api/messages/route.ts` to fetch the messages from the database:
-
-```bash
-mkdir -p app/api/messages
-touch app/api/messages/route.ts
-```
-
-Create a basic API route to fetch the messages from the database.
-
-```tsx title="app/api/messages/route.ts"
-import { NextResponse } from "next/server";
-import prisma from "@/lib/prisma";
-
-export async function GET() {
- try {
- const messages = await prisma.message.findMany({
- orderBy: { createdAt: "asc" },
- });
-
- const uiMessages = messages.map((msg) => ({
- id: msg.id,
- role: msg.role.toLowerCase(),
- parts: JSON.parse(msg.content),
- }));
-
- return NextResponse.json({ messages: uiMessages });
- } catch (error) {
- console.error("Error fetching messages:", error);
- return NextResponse.json({ messages: [] });
- }
-}
-```
-
-## 6. Create the UI
-
-Replace the content of the `app/page.tsx` file with the following:
-
-```tsx title="app/page.tsx"
-"use client";
-
-export default function Page() {}
-```
-
-### 6.1. Set up the basic imports and state
-
-Start by importing the required dependencies and setting up the state variables that will manage the chat interface:
-
-```tsx title="app/page.tsx"
-"use client";
-
-import { useChat } from "@ai-sdk/react";
-{
- /* [!code ++] */
-}
-import { useState, useEffect } from "react";
-{
- /* [!code ++] */
-}
-
-export default function Chat() {
- const [input, setInput] = useState(""); // [!code ++]
- const [isLoading, setIsLoading] = useState(true); // [!code ++]
-
- const { messages, sendMessage, setMessages } = useChat(); // [!code ++]
-}
-```
-
-### 6.2. Load existing messages
-
-Create a `useEffect` hook that will automatically fetch and display any previously saved messages when the chat component loads:
-
-```tsx title="app/page.tsx"
-"use client";
-
-import { useChat } from "@ai-sdk/react";
-import { useState, useEffect } from "react";
-
-export default function Chat() {
- const [input, setInput] = useState("");
- const [isLoading, setIsLoading] = useState(true);
-
- const { messages, sendMessage, setMessages } = useChat();
-
- useEffect(() => {
- // [!code ++]
- fetch("/api/messages") // [!code ++]
- .then((res) => res.json()) // [!code ++]
- .then((data) => {
- // [!code ++]
- if (data.messages && data.messages.length > 0) {
- // [!code ++]
- setMessages(data.messages); // [!code ++]
- } // [!code ++]
- setIsLoading(false); // [!code ++]
- }) // [!code ++]
- .catch(() => setIsLoading(false)); // [!code ++]
- }, [setMessages]); // [!code ++]
-}
-```
-
-This loads any existing messages from your database when the component first mounts, so users can see their previous conversation history.
-
-### 6.3. Add message display
-
-Build the UI components that will show a loading indicator while fetching data and render the chat messages with proper styling:
-
-```tsx title="app/page.tsx"
-'use client';
-
-import { useChat } from '@ai-sdk/react';
-import { useState, useEffect } from 'react';
-
-export default function Chat() {
- const [input, setInput] = useState('');
- const [isLoading, setIsLoading] = useState(true);
-
- const { messages, sendMessage, setMessages } = useChat();
-
- useEffect(() => {
- fetch('/api/messages')
- .then(res => res.json())
- .then(data => {
- if (data.messages && data.messages.length > 0) {
- setMessages(data.messages);
- }
- setIsLoading(false);
- })
- .catch(() => setIsLoading(false));
- }, [setMessages]);
-
- if (isLoading) { // [!code ++]
- return
// [!code ++]
- ))} // [!code ++]
-```
-
-The message rendering logic handles different message types and applies appropriate styling - user messages appear on the right with a dark background, while AI responses appear on the left with a light background.
-
-### 6.4. Add the input form
-
-Now we need to create the input interface that allows users to type and send messages to the AI:
-
-```tsx title="app/page.tsx"
-"use client";
-
-import { useChat } from "@ai-sdk/react";
-import { useState, useEffect } from "react";
-
-export default function Chat() {
- const [input, setInput] = useState("");
- const [isLoading, setIsLoading] = useState(true);
-
- const { messages, sendMessage, setMessages } = useChat();
-
- useEffect(() => {
- fetch("/api/messages")
- .then((res) => res.json())
- .then((data) => {
- if (data.messages && data.messages.length > 0) {
- setMessages(data.messages);
- }
- setIsLoading(false);
- })
- .catch(() => setIsLoading(false));
- }, [setMessages]);
-
- if (isLoading) {
- return
- );
-}
-```
-
-## 7. Test your application
-
-To test your application, run the following command:
-
-```npm
-npm run dev
-```
-
-Open your browser and navigate to [`http://localhost:3000`](http://localhost:3000) to see your application in action.
-
-Test it by sending a message to the AI and see if it's saved to the database. Check Prisma Studio to see the messages in the database.
-
-```npm
-npx prisma studio
-```
-
-You're done! You've just created a AI SDK chat application with Next.js and Prisma. Below are some next steps to explore, as well as some more resources to help you get started expanding your project.
-
-## Next Steps
-
-Now that you have a working AI SDK chat application connected to a Prisma Postgres database, you can:
-
-- Extend your Prisma schema with more models and relationships
-- Add create/update/delete routes and forms
-- Explore authentication and validation
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-
-### More Info
-
-- [Prisma Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [AI SDK Documentation](https://ai-sdk.dev/)
diff --git a/apps/docs/content/docs.v6/guides/astro.mdx b/apps/docs/content/docs.v6/guides/astro.mdx
deleted file mode 100644
index d010b9902b..0000000000
--- a/apps/docs/content/docs.v6/guides/astro.mdx
+++ /dev/null
@@ -1,403 +0,0 @@
----
-title: Astro
-description: Learn how to use Prisma ORM in an Astro app
-image: /img/guides/prisma-astro-cover.png
-url: /v6/guides/astro
-metaTitle: How to use Prisma ORM and Prisma Postgres with Astro
-metaDescription: Learn how to use Prisma ORM in an Astro app
----
-
-## Introduction
-
-
-Questions answered in this page
-
-- How to integrate Prisma with Astro?
-- How to set up Prisma Postgres in Astro?
-- How to query data in Astro pages?
-
-
-
-Prisma ORM offers type-safe database access, and [Astro](https://astro.build/) is built for performance. Together with [Prisma Postgres](https://www.prisma.io/postgres), you get a fast, content-first stack with zero cold starts and end-to-end speed.
-
-In this guide, you'll learn to integrate Prisma ORM with a Prisma Postgres database in an Astro project from scratch. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/astro).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- [Astro VSCode extension (recommended)](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode)
-
-## 1. Set up your project
-
-Create a new Astro project:
-
-```npm
-npx create-astro@latest
-```
-
-:::info
-
-- _Where should we create your new project?_ `astro-prisma`
-- _How would you like to start your new project?_ `Use minimal (empty) template `
-- _Install dependencies? (recommended)_ `Yes`
-- _Initialize a new git repository? (optional)_ `Yes`
-
-:::
-
-Navigate into the newly created project directory:
-
-```bash
-cd astro-prisma
-```
-
-## 2. Install and Configure Prisma
-
-### 2.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../prisma/generated
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My Astro Project"
-:::
-This will create:
-
-- A `prisma/` directory with a `schema.prisma` file
-- A `prisma.config.ts` file for configuring Prisma
-- A `.env` file with a `DATABASE_URL` already set
-
-### 2.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, add the following models and change the generator to use the `prisma-client` provider:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../prisma/generated"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-```
-
-This creates two models: `User` and `Post`, with a one-to-many relationship between them.
-
-### 2.3 Add `dotenv` to `prisma.config.ts`
-
-To get access to the variables in the `.env` file, they can either be loaded by your runtime, or by using `dotenv`.
-Include an import for `dotenv` at the top of the `prisma.config.ts`
-
-```ts
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.4. Run migrations and generate Prisma Client
-
-Now, run the following command to create the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-Then generate Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-### 2.5. Seed the database
-
-Let's add some seed data to populate the database with sample users and posts.
-
-Create a new file called `seed.ts` in the `prisma/` directory:
-
-```typescript title="prisma/seed.ts"
-import { PrismaClient, Prisma } from "../prisma/generated/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-const userData: Prisma.UserCreateInput[] = [
- {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: [
- {
- title: "Join the Prisma Discord",
- content: "https://pris.ly/discord",
- published: true,
- },
- {
- title: "Prisma on YouTube",
- content: "https://pris.ly/youtube",
- },
- ],
- },
- },
- {
- name: "Bob",
- email: "bob@prisma.io",
- posts: {
- create: [
- {
- title: "Follow Prisma on Twitter",
- content: "https://www.twitter.com/prisma",
- published: true,
- },
- ],
- },
- },
-];
-
-export async function main() {
- console.log("Starting to seed...");
-
- for (const u of userData) {
- await prisma.user.upsert({
- where: { email: u.email },
- update: {},
- create: u,
- });
- }
-
- console.log("Seeding finished.");
-}
-
-main()
- .catch((e) => {
- console.error(e);
- process.exit(1);
- })
- .finally(async () => {
- await prisma.$disconnect();
- });
-```
-
-Now, tell Prisma how to run this script by updating your `prisma.config.ts`:
-
-```ts title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: `tsx prisma/seed.ts`,
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Run the seed script:
-
-```npm
-npx prisma db seed
-```
-
-And open Prisma Studio to inspect your data:
-
-```npm
-npx prisma studio
-```
-
-## 3. Integrate Prisma into Astro
-
-### 3.1. Create TypeScript environment definitions
-
-First, create an `env.d.ts` file in your `src` directory to provide TypeScript definitions for environment variables:
-
-```typescript title="src/env.d.ts"
-interface ImportMetaEnv {
- readonly DATABASE_URL: string;
-}
-
-interface ImportMeta {
- readonly env: ImportMetaEnv;
-}
-```
-
-### 3.2. Create a Prisma Client
-
-Inside of `/src`, create a `lib` directory and a `prisma.ts` file inside it. This file will be used to create and export your Prisma Client instance.
-
-```bash
-mkdir src/lib
-touch src/lib/prisma.ts
-```
-
-Set up the Prisma client like this:
-
-```typescript title="src/lib/prisma.ts"
-import { PrismaClient } from "../../prisma/generated/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: import.meta.env.DATABASE_URL,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-export default prisma;
-```
-
-:::warning
-We recommend using a connection pooler (like [Prisma Accelerate](https://www.prisma.io/accelerate)) to manage database connections efficiently.
-
-If you choose not to use one, **avoid** instantiating `PrismaClient` globally in long-lived environments. Instead, create and dispose of the client per request to prevent exhausting your database connections.
-:::
-
-### 3.3. Create an API route
-
-An API route is the best way to fetch data from your database in an Astro app.
-
-Create a new file called `api/users.ts` in the `src/pages` directory:
-
-```bash
-mkdir src/pages/api
-touch src/pages/api/users.ts
-```
-
-Now, create a GET route that fetches the `Users` data from your database, making sure to include each user's `Posts` by adding them to the `include` field:
-
-```typescript title="src/pages/api/users.ts"
-import type { APIRoute } from "astro";
-import prisma from "../../lib/prisma";
-
-export const GET: APIRoute = async () => {
- const users = await prisma.user.findMany({
- include: { posts: true },
- });
-
- return new Response(JSON.stringify(users), {
- headers: { "Content-Type": "application/json" },
- });
-};
-```
-
-### 3.4. Fetch the data from the API route (Recommended Method)
-
-Instead of using `fetch()` with HTTP requests, Astro recommends importing endpoint functions directly. This approach is more efficient and avoids URL parsing issues.
-
-Start by creating a new type that combines the `User` and `Post` models called `UserWithPosts`:
-
-```tsx title="src/pages/index.astro"
----
-import type { User, Post } from "../../prisma/generated/client"; // [!code ++]
-import { GET } from "./api/users.ts"; // [!code ++]
-
-type UserWithPosts = User & { posts: Post[] }; // [!code ++]
-
-const response = await GET(Astro); // [!code ++]
-const users: UserWithPosts[] = await response.json(); // [!code ++]
----
-
-
-
-
-
-
-
- Astro + Prisma
-
-
-
// [!code ++]
-
-
-```
-
-### 3.5. Run your app
-
-Now start your development server to see your Astro app in action:
-
-```npm
-npm run dev
-```
-
-Open your browser at [`http://localhost:4321`](http://localhost:4321) to see the users and their posts displayed on the page.
-
-## Summary
-
-You're done! You've just created an Astro app with Prisma that's connected to a Prisma Postgres database. Below are some next steps to explore, as well as some more resources to help you get started expanding your project.
-
-## Next Steps
-
-Now that you have a working Astro app connected to a Prisma Postgres database, you can:
-
-- Extend your Prisma schema with more models and relationships
-- Add create/update/delete routes and forms
-- Explore authentication and validation
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-
-### More Info
-
-- [Prisma Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Astro Documentation](https://astro.build/docs)
diff --git a/apps/docs/content/docs.v6/guides/authjs-nextjs.mdx b/apps/docs/content/docs.v6/guides/authjs-nextjs.mdx
deleted file mode 100644
index 7f77c873c9..0000000000
--- a/apps/docs/content/docs.v6/guides/authjs-nextjs.mdx
+++ /dev/null
@@ -1,631 +0,0 @@
----
-title: Auth.js (with Next.js)
-description: Learn how to use Prisma ORM in a Next.js app with Auth.js
-image: /img/guides/prisma-authjs-nextjs-cover.png
-url: /v6/guides/authjs-nextjs
-metaTitle: How to use Prisma ORM and Prisma Postgres with Auth.js and Next.js
-metaDescription: Learn how to use Prisma ORM in a Next.js app with Auth.js
----
-
-## Introduction
-
-[Auth.js](https://authjs.dev/) is a flexible, open-source authentication library designed to simplify adding authentication to your Next.js applications.
-
-In this guide, you'll wire Auth.js into a brand-new [Next.js](https://nextjs.org/) app and persist users in a [Prisma Postgres](https://prisma.io/postgres) database. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/authjs-nextjs).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- Basic familiarity with Next.js App Router and Prisma
-
-## 1. Set up your project
-
-Create a new Next.js application:
-
-```npm
-npx create-next-app@latest authjs-prisma
-```
-
-It will prompt you to customize your setup. Choose the defaults:
-
-:::info
-
-- _Would you like to use TypeScript?_ `Yes`
-- _Would you like to use ESLint?_ `Yes`
-- _Would you like to use Tailwind CSS?_ `Yes`
-- _Would you like your code inside a `src/` directory?_ `No`
-- _Would you like to use App Router?_ (recommended) `Yes`
-- _Would you like to use Turbopack for `next dev`?_ `Yes`
-- _Would you like to customize the import alias (`@/_`by default)?*`No`
-
-:::
-
-Navigate to the project directory:
-
-```bash
-cd authjs-prisma
-```
-
-## 2. Install and configure Prisma
-
-### 2.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../app/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My Auth.js Project"
-:::
-
-This will create:
-
-- A `prisma` directory with a `schema.prisma` file.
-- A `prisma.config.ts` file for configuring Prisma
-- A Prisma Postgres database.
-- A `.env` file containing the `DATABASE_URL` at the project root.
-- A schema configuration that specifies where the Prisma Client will be generated (`../app/generated/prisma`).
-
-### 2.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, swap the provider to `prisma-client` and add the runtime `vercel-edge` to the generator:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
- runtime = "vercel-edge" // [!code ++]
-}
-
-datasource db {
- provider = "postgresql"
-}
-```
-
-Add the following models to the `schema.prisma` file, these models are provided by Auth.js:
-
-```prisma title="prisma/schema.prisma"
-model Account { // [!code ++]
- id String @id @default(cuid()) // [!code ++]
- userId String @map("user_id") // [!code ++]
- type String // [!code ++]
- provider String // [!code ++]
- providerAccountId String @map("provider_account_id") // [!code ++]
- refresh_token String? @db.Text // [!code ++]
- access_token String? @db.Text // [!code ++]
- expires_at Int? // [!code ++]
- token_type String? // [!code ++]
- scope String? // [!code ++]
- id_token String? @db.Text // [!code ++]
- session_state String? // [!code ++]
-
- user User @relation(fields: [userId], references: [id], onDelete: Cascade) // [!code ++]
-
- @@unique([provider, providerAccountId]) // [!code ++]
- @@map("accounts") // [!code ++]
-} // [!code ++]
-
-model Session { // [!code ++]
- id String @id @default(cuid()) // [!code ++]
- sessionToken String @unique @map("session_token") // [!code ++]
- userId String @map("user_id") // [!code ++]
- expires DateTime // [!code ++]
- user User @relation(fields: [userId], references: [id], onDelete: Cascade) // [!code ++]
-
- @@map("sessions") // [!code ++]
-} // [!code ++]
-
-model User { // [!code ++]
- id String @id @default(cuid()) // [!code ++]
- name String? // [!code ++]
- email String? @unique // [!code ++]
- emailVerified DateTime? @map("email_verified") // [!code ++]
- image String? // [!code ++]
- accounts Account[] // [!code ++]
- sessions Session[] // [!code ++]
-
- @@map("users") // [!code ++]
-} // [!code ++]
-
-model VerificationToken { // [!code ++]
- identifier String // [!code ++]
- token String // [!code ++]
- expires DateTime // [!code ++]
-
- @@unique([identifier, token]) // [!code ++]
- @@map("verification_tokens") // [!code ++]
-} // [!code ++]
-```
-
-This creates the following models:
-
-- **`Account`**: Stores OAuth provider information (access tokens, refresh tokens, provider account IDs) and enables users to sign in with multiple providers while maintaining a single user record.
-
-- **`Session`**: Tracks authenticated user sessions with a unique session token, user ID, and expiration time to maintain authentication state across requests.
-
-- **`User`**: The core model storing user information (name, email, profile image). Users can have multiple accounts from different providers and multiple active sessions.
-
-- **`VerificationToken`**: Stores temporary tokens for email verification, password reset, and other security operations with expiration times.
-
-### 2.3 Add `dotenv` to `prisma.config.ts`
-
-To get access to the variables in the `.env` file, they can either be loaded by your runtime, or by using `dotenv`.
-Include an import for `dotenv` at the top of the `prisma.config.ts`
-
-```ts
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.4. Configure the Prisma Client generator
-
-Now, run the following command to create the database tables and generate the Prisma Client:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-```npm
-npx prisma generate
-```
-
-### 2.5 Create a Prisma Client
-
-Create a new folder in the root called `lib` and create a new file called `prisma.ts` in it. This file will contain the Prisma Client:
-
-```typescript title="lib/prisma.ts" showLineNumbers
-import { PrismaClient } from "../app/generated/prisma/client"; // [!code ++]
-import { PrismaPg } from "@prisma/adapter-pg"; // [!code ++]
-
-const adapter = new PrismaPg({
- // [!code ++]
- connectionString: process.env.DATABASE_URL!, // [!code ++]
-}); // [!code ++]
-
-const globalForPrisma = global as unknown as {
- // [!code ++]
- prisma: PrismaClient; // [!code ++]
-}; // [!code ++]
-
-const prisma = // [!code ++]
- globalForPrisma.prisma || // [!code ++]
- new PrismaClient({
- // [!code ++]
- adapter, // [!code ++]
- }); // [!code ++]
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma; // [!code ++]
-
-export default prisma; // [!code ++]
-```
-
-## 3. Set up Auth.js credentials
-
-### 3.1. Install dependencies
-
-Install the Auth.js dependencies:
-
-```npm
-npm install @auth/prisma-adapter next-auth@beta
-```
-
-### 3.2 Credentials
-
-For this guide, you'll be setting up OAuth with Github. For this, you'll need 3 environment variables:
-
-- `AUTH_SECRET` - Provided by Auth.js
-- `CLIENT_ID` - Provided by Github
-- `CLIENT_SECRET` - Provided by Github
-
-To get the `AUTH_SECRET`, you can run the following command:
-
-```npm
-npx auth secret --copy
-```
-
-- `--copy` will copy the secret to your clipboard. _(Normally, just running `npx auth secret` will add the secret to your `.env.local` file. To keep it tidy, you can use `--copy` and add it to the `.env` file that Prisma created earlier.)_
-
-Add the following to the `.env` file:
-
-```bash title=".env"
-DATABASE_URL=
-AUTH_SECRET= # [!code ++]
-```
-
-To get the `CLIENT_ID` and `CLIENT_SECRET`, you can create a new OAuth application on Github.
-
-1. Navigate to [Github Developer Settings](https://github.com/settings/developers)
-2. Click on `New OAuth App`
-3. Enter a name for your app, a home page URL, and a callback URL
-
-- Name: `Auth.js + Prisma` (Or anything you want)
-- Homepage URL: `http://localhost:3000`
-- Callback URL: `http://localhost:3000/api/auth/callback/github`
-
-4. Click `Register application`
-5. Click `Generate new client secret` and copy the `Client ID` and `Client Secret`.
-6. Add the `Client ID` and `Client Secret` to the `.env` file:
-
-```bash title=".env"
-DATABASE_URL=
-AUTH_SECRET=
-AUTH_GITHUB_ID= # [!code ++]
-AUTH_GITHUB_SECRET= # [!code ++]
-```
-
-### 3.3. Configure Auth.js
-
-In the `/lib` folder, create a new file called `auth.ts` and add the following code:
-
-```typescript title="lib/auth.ts"
-import NextAuth from "next-auth";
-
-export const { handlers, auth, signIn, signOut } = NextAuth({
- providers: [],
-});
-```
-
-Next, you'll need to add the Github provider to the `auth.ts` file:
-
-```typescript title="lib/auth.ts"
-import NextAuth from "next-auth";
-import GitHub from "next-auth/providers/github"; // [!code ++]
-
-export const { handlers, auth, signIn, signOut } = NextAuth({
- providers: [GitHub], // [!code highlight]
-});
-```
-
-Users will now be able to sign in with Github. To add them to your database, you'll need to use the [Prisma Adapter](https://authjs.dev/getting-started/adapters/prisma):
-
-```typescript title="lib/auth.ts"
-import NextAuth from "next-auth";
-import { PrismaAdapter } from "@auth/prisma-adapter"; // [!code ++]
-import prisma from "@/lib/prisma"; // [!code ++]
-import GitHub from "next-auth/providers/github";
-
-export const { handlers, auth, signIn, signOut } = NextAuth({
- adapter: PrismaAdapter(prisma), // [!code highlight]
- providers: [GitHub],
-});
-```
-
-In the root, create a new file called `middleware.ts`. This will protect your routes and ensure that only authenticated users can access them:
-
-```tsx title="middleware.ts"
-export { auth as middleware } from "@/lib/auth";
-```
-
-### 3.4. Configure the Route
-
-The route handler is required to handle authentication requests from Auth.js. It exports the `GET` and `POST` handlers that Auth.js uses for sign-in, sign-out, and callback operations.
-
-Create a new file at `app/api/auth/[...nextauth]/route.ts`:
-
-```bash
-mkdir -p app/api/auth/[...nextauth]
-touch app/api/auth/[...nextauth]/route.ts
-```
-
-Add the following code to the file:
-
-```tsx title="app/api/auth/[...nextauth]/route.ts"
-import { handlers } from "@/lib/auth";
-
-export const { GET, POST } = handlers;
-```
-
-That's it! Your app is now secured. To see more configuration options, check out the [Auth.js Middleware documentation](https://next-auth.js.org/configuration/nextjs#middleware).
-
-## 4. Auth components
-
-You will be creating a Sign In and Sign Out button. Create a `/components` folder in the root and add a new file called `auth-components.tsx` in it.
-
-Start by importing the `signIn` and `signOut` functions from the `auth` file:
-
-```tsx title="components/auth-components.tsx"
-import { signIn, signOut } from "@/lib/auth";
-{
- /* [!code ++] */
-}
-```
-
-Next, create the `SignIn` and `SignOut` components:
-
-```tsx title="components/auth-components.tsx"
-import { signIn, signOut } from "@/lib/auth";
-
-export function SignIn({ provider }: { provider?: string }) {
- // [!code ++]
- return (
- // [!code ++]
- // [!code ++]
- ); // [!code ++]
-} // [!code ++]
-
-export function SignOut() {
- // [!code ++]
- return (
- // [!code ++]
- // [!code ++]
- ); // [!code ++]
-} // [!code ++]
-```
-
-To add functionality to both of the buttons, add an action to the form that calls the `signIn` and `signOut` functions respectively:
-
-```tsx title="components/auth-components.tsx"
-import { signIn, signOut } from "@/lib/auth";
-
-export function SignIn({ provider }: { provider?: string }) {
- return (
-
- );
-}
-
-export function SignOut() {
- return (
-
- );
-}
-```
-
-## 5. Add the components to your app
-
-### 5.1. Set up the basic page structure
-
-In the `/app` folder, replace the `page.tsx` file with the following code:
-
-```tsx title="app/page.tsx"
-const Page = async () => {
- // [!code ++]
- return (
- // [!code ++]
-
- );
-};
-
-export default Page;
-```
-
-### 5.3. Show content based on auth state
-
-Add the logic to show different content based on whether the user is signed in:
-
-```tsx title="app/page.tsx"
-import { SignIn, SignOut } from "@/components/auth-components";
-import { auth } from "@/lib/auth";
-
-const Page = async () => {
- const session = await auth();
-
- return (
-
-
-
Auth.js + Prisma
-
- {!session ? (
-
-
-
- ) : (
-
-
-
Signed in as:
-
{session.user?.email}
-
-
-
-
Data fetched from DB with Prisma:
-
-
-
-
-
-
- )}
-
-
- );
-};
-
-export default Page;
-```
-
-### 5.4. Add the user data to the page
-
-If the user is signed in, you can fetch the user data from the database and display it on the page.
-
-```tsx title="app/page.tsx"
-import { SignIn, SignOut } from "@/components/auth-components";
-import { auth } from "@/lib/auth";
-import prisma from "@/lib/prisma";
-{
- /* [!code ++] */
-}
-
-const Page = async () => {
- const session = await auth();
- let user = null; // [!code ++]
-
- if (session) {
- // [!code ++]
- user = await prisma.user.findUnique({
- // [!code ++]
- where: {
- // [!code ++]
- id: session.user?.id, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- } // [!code ++]
-
- return (
-
-
-
Auth.js + Prisma
-
- {!session ? (
-
-
-
- ) : (
-
-
-
Signed in as:
-
{session.user?.email}
-
-
-
Data fetched from DB with Prisma:
-
-
- {" "}
- // [!code ++]
-
{JSON.stringify(user, null, 2)}
// [!code
- ++]
-
{" "}
- // [!code ++]
-
-
-
-
- )}
-
-
- );
-};
-
-export default Page;
-```
-
-## 6. Test it out
-
-:::warning
-
-Before starting the development server, note that if you are using Next.js v15.2.0 or v15.2.1, do not use Turbopack as there is a known [issue](https://github.com/vercel/next.js/issues/76497). Remove Turbopack from your dev script by updating your `package.json`
-
-```json title="package.json"
-"script":{
- "dev": "next dev --turbopack", // [!code --]
- "dev": "next dev", // [!code ++]
-}
-```
-
-This change is not needed on any versions before or after.
-
-:::
-
-Your application is now fully configured.
-
-1. Start the development server to test it:
-
-```npm
-npm run dev
-```
-
-2. Navigate to `http://localhost:3000` in your browser. You should see the home page with a "Sign In with github" button.
-
-3. Click on **Sign In with github**, authorize the app, and you should be redirected to the dashboard. You can then sign out and sign back in.
-
-4. To view the user data directly in your database, you can use Prisma Studio:
-
-```npm
-npx prisma studio
-```
-
-5. This will open a new tab in your browser where you can see the `User`, `Session`, and `Account` tables and their contents.
-
-:::success
-
-Congratulations! You now have a fully functional authentication system built with Auth.js, Prisma, and Next.js.
-
-:::
diff --git a/apps/docs/content/docs.v6/guides/betterauth-astro.mdx b/apps/docs/content/docs.v6/guides/betterauth-astro.mdx
deleted file mode 100644
index 9342dee934..0000000000
--- a/apps/docs/content/docs.v6/guides/betterauth-astro.mdx
+++ /dev/null
@@ -1,878 +0,0 @@
----
-title: Better Auth (with Astro)
-description: Learn how to use Prisma ORM in an Astro app with Better Auth
-image: /img/guides/prisma-betterauth-astro-cover.png
-url: /v6/guides/betterauth-astro
-metaTitle: How to use Prisma ORM and Prisma Postgres with Better Auth and Astro
-metaDescription: Learn how to use Prisma ORM in an Astro app with Better Auth
----
-
-## Introduction
-
-[Better Auth](https://better-auth.com/) is a modern, open-source authentication solution for web apps. It's built with TypeScript and provides a simple and extensible auth experience with support for multiple database adapters, including Prisma.
-
-In this guide, you'll wire Better Auth into a brand-new [Astro](https://astro.build/) app and persist users in a [Prisma Postgres](https://prisma.io/postgres) database. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/betterauth-astro).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- Basic familiarity with Astro and Prisma
-
-## 1. Set up your project
-
-Create a new Astro project:
-
-```npm
-npm create astro@latest betterauth-astro-prisma
-```
-
-:::info
-
-- _How would you like to start your new project?_ `Use minimal (empty) template `
-- _Install dependencies? (recommended)_ `Yes`
-- _Initialize a new git repository? (optional)_ `Yes`
-
-:::
-
-Navigate to the project directory:
-
-```bash
-cd betterauth-astro-prisma
-```
-
-These selections will create a minimal Astro project with TypeScript for type safety.
-
-## 2. Set up Prisma
-
-Next, you'll add Prisma to your project to manage your database.
-
-### 2.1. Install Prisma and dependencies
-
-Install the necessary Prisma packages:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../prisma/generated
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My Better Auth Astro Project"
-:::
-
-This will create:
-
-- A `prisma` directory with a `schema.prisma` file
-- A Prisma Postgres database
-- A `.env` file containing the `DATABASE_URL` at the project root
-- A `prisma.config.ts` file for configuring Prisma
-- An `output` directory for the generated Prisma Client as `prisma/generated`
-
-### 2.2. Configure Prisma to load environment variables
-
-To get access to the variables in the `.env` file, update your `prisma.config.ts` to import `dotenv`:
-
-```ts title="prisma.config.ts" showLineNumbers
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- engine: "classic",
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.3. Generate the Prisma Client
-
-Run the following command to generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-### 2.4. Set up a global Prisma client
-
-In the `src` directory, create a `lib` folder and a `prisma.ts` file inside it. This file will be used to create and export your Prisma Client instance.
-
-```bash
-mkdir -p src/lib
-touch src/lib/prisma.ts
-```
-
-Set up the Prisma client like this:
-
-```ts title="src/lib/prisma.ts"
-import { PrismaClient } from "../../prisma/generated/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: import.meta.env.DATABASE_URL,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-export default prisma;
-```
-
-:::warning
-We recommend using a connection pooler (like [Prisma Accelerate](https://www.prisma.io/accelerate)) to manage database connections efficiently.
-
-If you choose not to use one, **avoid** instantiating `PrismaClient` globally in long-lived environments. Instead, create and dispose of the client per request to prevent exhausting your database connections.
-:::
-
-## 3. Set up Better Auth
-
-Now it's time to integrate Better Auth for authentication.
-
-### 3.1. Install and configure Better Auth
-
-First, install the Better Auth core package:
-
-```npm
-npm install better-auth
-```
-
-Next, generate a secure secret that Better Auth will use to sign authentication tokens. This ensures your tokens cannot be tampered with.
-
-```npm
-npx @better-auth/cli@latest secret
-```
-
-Copy the generated secret and add it, along with your application's URL, to your `.env` file:
-
-```bash title=".env"
-# Better Auth
-BETTER_AUTH_SECRET=your-generated-secret # [!code ++]
-BETTER_AUTH_URL=http://localhost:4321 # [!code ++]
-
-# Prisma
-DATABASE_URL="your-database-url"
-```
-
-:::info
-Astro's default development server runs on port `4321`. If your application runs on a different port, update the `BETTER_AUTH_URL` accordingly.
-:::
-
-Now, create a configuration file for Better Auth. In the `src/lib` directory, create an `auth.ts` file:
-
-```bash
-touch src/lib/auth.ts
-```
-
-In this file, you'll configure Better Auth to use the Prisma adapter, which allows it to persist user and session data in your database. You will also enable email and password authentication.
-
-```ts title="src/lib/auth.ts"
-import { betterAuth } from "better-auth";
-import { prismaAdapter } from "better-auth/adapters/prisma";
-import prisma from "./prisma";
-
-export const auth = betterAuth({
- database: prismaAdapter(prisma, {
- provider: "postgresql",
- }),
- emailAndPassword: {
- enabled: true,
- },
-});
-```
-
-Better Auth also supports other sign-in methods like social logins (Google, GitHub, etc.), which you can explore in their [documentation](https://www.better-auth.com/docs/authentication/email-password).
-
-### 3.2. Add Better Auth models to your schema
-
-Better Auth provides a CLI command to automatically add the necessary authentication models (`User`, `Session`, `Account`, and `Verification`) to your `schema.prisma` file.
-
-Run the following command:
-
-```npm
-npx @better-auth/cli generate
-```
-
-:::note
-It will ask for confirmation to overwrite your existing Prisma schema. Select `y`.
-:::
-
-This will add the following models:
-
-```prisma
-model User {
- id String @id
- name String
- email String
- emailVerified Boolean
- image String?
- createdAt DateTime
- updatedAt DateTime
- sessions Session[]
- accounts Account[]
-
- @@unique([email])
- @@map("user")
-}
-
-model Session {
- id String @id
- expiresAt DateTime
- token String
- createdAt DateTime
- updatedAt DateTime
- ipAddress String?
- userAgent String?
- userId String
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
-
- @@unique([token])
- @@map("session")
-}
-
-model Account {
- id String @id
- accountId String
- providerId String
- userId String
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- accessToken String?
- refreshToken String?
- idToken String?
- accessTokenExpiresAt DateTime?
- refreshTokenExpiresAt DateTime?
- scope String?
- password String?
- createdAt DateTime
- updatedAt DateTime
-
- @@map("account")
-}
-
-model Verification {
- id String @id
- identifier String
- value String
- expiresAt DateTime
- createdAt DateTime?
- updatedAt DateTime?
-
- @@map("verification")
-}
-```
-
-### 3.3. Migrate the database
-
-With the new models in your schema, you need to update your database. Run a migration to create the corresponding tables:
-
-```npm
-npx prisma migrate dev --name add-auth-models
-```
-
-```npm
-npx prisma generate
-```
-
-
-
-## 4. Set up the API routes
-
-Better Auth needs an API endpoint to handle authentication requests like sign-in, sign-up, and sign-out. You'll create a catch-all API route in Astro to handle all requests sent to `/api/auth/[...all]`.
-
-In the `src/pages` directory, create an `api/auth` folder structure and a `[...all].ts` file inside it:
-
-```bash
-mkdir -p src/pages/api/auth
-touch 'src/pages/api/auth/[...all].ts'
-```
-
-Add the following code to the newly created `[...all].ts` file. This code uses the Better Auth handler to process authentication requests.
-
-```ts title="src/pages/api/auth/[...all].ts"
-import { auth } from "../../../lib/auth";
-import type { APIRoute } from "astro";
-
-export const prerender = false; // Not needed in 'server' mode
-
-export const ALL: APIRoute = async (ctx) => {
- return auth.handler(ctx.request);
-};
-```
-
-Next, you'll need a client-side utility to interact with these endpoints from your Astro pages. In the `src/lib` directory, create an `auth-client.ts` file:
-
-```bash
-touch src/lib/auth-client.ts
-```
-
-Add the following code, which creates the client functions you'll use in your UI:
-
-```ts title="src/lib/auth-client.ts"
-import { createAuthClient } from "better-auth/client";
-
-export const authClient = createAuthClient();
-
-export const { signIn, signUp, signOut, useSession } = authClient;
-```
-
-## 5. Configure TypeScript definitions
-
-In the `src` directory, create an `env.d.ts` file to provide TypeScript definitions for environment variables and Astro locals:
-
-```bash
-touch src/env.d.ts
-```
-
-Add the following type definitions:
-
-```ts title="src/env.d.ts"
-///
-
-declare namespace App {
- interface Locals {
- user: import("better-auth").User | null;
- session: import("better-auth").Session | null;
- }
-}
-
-interface ImportMetaEnv {
- readonly DATABASE_URL: string;
-}
-
-interface ImportMeta {
- readonly env: ImportMetaEnv;
-}
-```
-
-## 6. Set up authentication middleware
-
-In the `src` directory, create a `middleware.ts` file to check authentication status on every request. This will make the user and session data available to all your pages.
-
-```bash
-touch src/middleware.ts
-```
-
-Add the following code:
-
-```ts title="src/middleware.ts"
-import { auth } from "./lib/auth";
-import { defineMiddleware } from "astro:middleware";
-
-export const onRequest = defineMiddleware(async (context, next) => {
- context.locals.user = null;
- context.locals.session = null;
- const isAuthed = await auth.api.getSession({
- headers: context.request.headers,
- });
- if (isAuthed) {
- context.locals.user = isAuthed.user;
- context.locals.session = isAuthed.session;
- }
- return next();
-});
-```
-
-## 7. Set up your pages
-
-Now, let's build the user interface for authentication. In the `src/pages` directory, create the following folder structure:
-
-- `sign-up/index.astro`
-- `sign-in/index.astro`
-- `dashboard/index.astro`
-
-```bash
-mkdir -p src/pages/{sign-up,sign-in,dashboard}
-touch src/pages/{sign-up,sign-in,dashboard}/index.astro
-```
-
-### 7.1. Sign up page
-
-This page allows new users to create an account. Start with the basic HTML structure in `src/pages/sign-up/index.astro`.
-
-```html title="src/pages/sign-up/index.astro"
----
-export const prerender = false;
----
-
-
-
-
-
- Sign Up
-
-
-
-
Sign Up
-
-
-
-```
-
-Add a form with input fields for name, email, and password. This form will collect the user's registration information.
-
-```html title="src/pages/sign-up/index.astro"
----
-export const prerender = false;
----
-
-
-
-
-
- Sign Up
-
-
-
-
- // [!code ++]
-
-
-
-```
-
-Now add a script to handle form submission. Import the `authClient` and add an event listener to the form that prevents the default submission behavior, extracts the form data, and calls the Better Auth sign-up method.
-
-```html title="src/pages/sign-up/index.astro"
----
-export const prerender = false;
----
-
-
-
-
-
- Sign Up
-
-
-
-
-
-
- // [!code ++]
-
-
-```
-
-Finally, add a server-side check to redirect authenticated users away from this page. If a user is already signed in, they should be redirected to the dashboard instead.
-
-```html title="src/pages/sign-up/index.astro"
----
-export const prerender = false;
-
-if (Astro.locals.user?.id) return Astro.redirect("/dashboard"); // [!code ++]
----
-
-
-
-
-
- Sign Up
-
-
-
-
-
-
-
-
-```
-
-### 7.2. Sign in page
-
-This page allows existing users to authenticate. Start with the basic HTML structure in `src/pages/sign-in/index.astro`.
-
-```html title="src/pages/sign-in/index.astro"
----
-export const prerender = false;
----
-
-
-
-
-
- Sign In
-
-
-
-
Sign In
-
-
-
-```
-
-Add a form with input fields for email and password. This form will collect the user's credentials.
-
-```html title="src/pages/sign-in/index.astro"
----
-export const prerender = false;
----
-
-
-
-
-
- Sign In
-
-
-
-
-
-
- // [!code ++]
-
-
-```
-
-Finally, add a server-side check to redirect authenticated users away from this page. If a user is already signed in, they should be redirected to the dashboard instead.
-
-```html title="src/pages/sign-in/index.astro"
----
-export const prerender = false;
-
-if (Astro.locals.user?.id) return Astro.redirect("/dashboard"); // [!code ++]
----
-
-
-
-
-
- Sign In
-
-
-
-
-
-
-
-
-```
-
-### 7.3. Dashboard page
-
-This is the protected page for authenticated users. Start with the basic HTML structure in `src/pages/dashboard/index.astro`.
-
-```html title="src/pages/dashboard/index.astro"
----
-export const prerender = false;
----
-
-
-
-
-
- Dashboard
-
-
-
-
Dashboard
-
-
-
-```
-
-Add a server-side check to protect this route. If the user is not authenticated, redirect them to the sign-in page.
-
-```html title="src/pages/dashboard/index.astro"
----
-export const prerender = false;
-
-if (!Astro.locals.user?.id) return Astro.redirect("/sign-in"); // [!code ++]
----
-
-
-
-
-
- Dashboard
-
-
-
-
Dashboard
-
-
-
-```
-
-Now display the authenticated user's information. The `Astro.locals.user` object contains the user data that was set by the middleware.
-
-```html title="src/pages/dashboard/index.astro"
----
-export const prerender = false;
-
-if (!Astro.locals.user?.id) return Astro.redirect("/sign-in");
----
-
-
-
-
-
- Dashboard
-
-
-
-
Dashboard
-
{JSON.stringify(Astro.locals.user, null, 2)}
- {/* [!code ++] */}
-
-
-
-```
-
-Finally, add a sign-out button. Import the `authClient` and add a button that calls the sign-out method, allowing the user to log out and be redirected to the sign-in page.
-
-```html title="src/pages/dashboard/index.astro"
----
-export const prerender = false;
-
-if (!Astro.locals.user?.id) return Astro.redirect("/sign-in");
----
-
-
-
-
-
- Dashboard
-
-
-
-
Dashboard
-
{JSON.stringify(Astro.locals.user, null, 2)}
- {/* [!code ++] */}
-
-
- // [!code ++]
-
-
-```
-
-### 7.4. Home page
-
-Finally, update the home page to provide simple navigation. Replace the contents of `src/pages/index.astro` with the following:
-
-```html title="src/pages/index.astro"
----
-export const prerender = false;
----
-
-
-
-
-
- Better Auth + Astro + Prisma
-
-
-
-
- ) }
-
-
-
-```
-
-## 8. Test it out
-
-Your application is now fully configured.
-
-1. Start the development server to test it:
-
-```npm
-npm run dev
-```
-
-2. Navigate to `http://localhost:4321` in your browser. You should see the home page with "Sign Up" and "Sign In" links.
-
-3. Click on **Sign Up**, create a new account, and you should be redirected to the dashboard. You can then sign out and sign back in.
-
-4. To view the user data directly in your database, you can use Prisma Studio.
-
-```npm
-npx prisma studio
-```
-
-5. This will open a new tab in your browser where you can see the `User`, `Session`, and `Account` tables and their contents.
-
-:::success
-
-Congratulations! You now have a fully functional authentication system built with Better Auth, Prisma, and Astro.
-
-:::
-
-## Next steps
-
-- Add support for social login or magic links
-- Implement password reset and email verification
-- Add user profile and account management pages
-- Deploy to Vercel or Netlify and secure your environment variables
-- Extend your Prisma schema with custom application models
-
-## Further reading
-
-- [Better Auth documentation](https://www.better-auth.com/docs)
-- [Prisma documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Astro documentation](https://astro.build/docs)
diff --git a/apps/docs/content/docs.v6/guides/betterauth-nextjs.mdx b/apps/docs/content/docs.v6/guides/betterauth-nextjs.mdx
deleted file mode 100644
index a69685d7a5..0000000000
--- a/apps/docs/content/docs.v6/guides/betterauth-nextjs.mdx
+++ /dev/null
@@ -1,996 +0,0 @@
----
-title: Better Auth (with Next.js)
-description: Learn how to use Prisma ORM in a Next.js app with Better Auth
-image: /img/guides/prisma-betterauth-nextjs-cover.png
-url: /v6/guides/betterauth-nextjs
-metaTitle: How to use Prisma ORM and Prisma Postgres with Better Auth and Next.js
-metaDescription: Learn how to use Prisma ORM in a Next.js app with Better Auth
----
-
-## Introduction
-
-[Better Auth](https://better-auth.com/) is a modern, open-source authentication solution for web applications. It's built with TypeScript and provides a simple and extensible auth experience with support for multiple database adapters, including Prisma.
-
-In this guide, you'll wire Better Auth into a brand-new [Next.js](https://nextjs.org/) app and persist users in a [Prisma Postgres](https://prisma.io/postgres) database. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/betterauth-nextjs).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- Basic familiarity with Next.js App Router and Prisma
-
-## 1. Set up your project
-
-Create a new Next.js application:
-
-```npm
-npx create-next-app@latest betterauth-nextjs-prisma
-```
-
-It will prompt you to customize your setup. Choose the defaults:
-
-:::info
-
-- _Would you like to use TypeScript?_ `Yes`
-- _Would you like to use ESLint?_ `Yes`
-- _Would you like to use Tailwind CSS?_ `Yes`
-- _Would you like your code inside a `src/` directory?_ `Yes`
-- _Would you like to use App Router?_ `Yes`
-- _Would you like to use Turbopack?_ `Yes`
-- _Would you like to customize the import alias (`@/_`by default)?*`No`
-
-:::
-
-Navigate to the project directory:
-
-```bash
-cd betterauth-nextjs-prisma
-```
-
-These selections will create a modern Next.js project with TypeScript for type safety, ESLint for code quality, and Tailwind CSS for styling. Using the `src/` directory and the App Router are common conventions for new Next.js applications.
-
-## 2. Set up Prisma
-
-Next, you'll add Prisma to your project to manage your database.
-
-### 2.1. Install Prisma and dependencies
-
-Install the necessary Prisma packages. The dependencies differ slightly depending on whether you use Prisma Postgres with Accelerate or another database.
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../src/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My Better Auth Project"
-:::
-
-This will create:
-
-- A `prisma` directory with a `schema.prisma` file
-- A Prisma Postgres database
-- A `.env` file containing the `DATABASE_URL` at the project root
-- An `output` directory for the generated Prisma Client as `better-auth/generated/prisma`
-
-### 2.2. Configure Prisma
-
-Create a `prisma.config.ts` file in the root of your project with the following content:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-The `dotenv` package should already be installed as it's a Next.js dependency. If not, install it using:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-### 2.3. Generate the Prisma client
-
-Run the following command to create the database tables and generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-### 2.4. Set up a global Prisma client
-
-In the `src` directory, create a `lib` folder and a `prisma.ts` file inside it. This file will be used to create and export your Prisma Client instance.
-
-```bash
-mkdir -p src/lib
-touch src/lib/prisma.ts
-```
-
-Set up the Prisma client like this:
-
-```tsx title="src/lib/prisma.ts"
-import { PrismaClient } from "@/generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const globalForPrisma = global as unknown as {
- prisma: PrismaClient;
-};
-
-const prisma =
- globalForPrisma.prisma ||
- new PrismaClient({
- adapter,
- });
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
-
-export default prisma;
-```
-
-:::warning
-We recommend using a connection pooler (like [Prisma Accelerate](https://www.prisma.io/accelerate)) to manage database connections efficiently.
-
-If you choose not to use one, **avoid** instantiating `PrismaClient` globally in long-lived environments. Instead, create and dispose of the client per request to prevent exhausting your database connections.
-:::
-
-## 3. Set up Better Auth
-
-Now it's time to integrate Better Auth for authentication.
-
-### 3.1. Install and configure Better Auth
-
-First, install the Better Auth core package:
-
-```npm
-npm install better-auth
-```
-
-Next, generate a secure secret that Better Auth will use to sign authentication tokens. This ensures your tokens cannot be messed with.
-
-```npm
-npx @better-auth/cli@latest secret
-```
-
-Copy the generated secret and add it, along with your application's URL, to your `.env` file:
-
-```bash title=".env"
-# Better Auth
-BETTER_AUTH_SECRET=your-generated-secret # [!code ++]
-BETTER_AUTH_URL=http://localhost:3000 # [!code ++]
-
-# Prisma
-DATABASE_URL="your-database-url"
-```
-
-Now, create a configuration file for Better Auth. In the `src/lib` directory, create an `auth.ts` file:
-
-```bash
-touch src/lib/auth.ts
-```
-
-In this file, you'll configure Better Auth to use the Prisma adapter, which allows it to persist user and session data in your database. You will also enable email and password authentication.
-
-```ts title="src/lib/auth.ts"
-import { betterAuth } from "better-auth";
-import { prismaAdapter } from "better-auth/adapters/prisma";
-import prisma from "@/lib/prisma";
-
-export const auth = betterAuth({
- database: prismaAdapter(prisma, {
- provider: "postgresql",
- }),
-});
-```
-
-Better Auth also supports other sign-in methods like social logins (Google, GitHub, etc.), which you can explore in their [documentation](https://www.better-auth.com/docs/authentication/email-password).
-
-```ts title="src/lib/auth.ts"
-import { betterAuth } from "better-auth";
-import { prismaAdapter } from "better-auth/adapters/prisma";
-import prisma from "@/lib/prisma";
-
-export const auth = betterAuth({
- database: prismaAdapter(prisma, {
- provider: "postgresql",
- }),
- emailAndPassword: {
- // [!code ++]
- enabled: true, // [!code ++]
- }, // [!code ++]
-});
-```
-
-:::info
-If your application runs on a port other than `3000`, you must add it to the `trustedOrigins` in your `auth.ts` configuration to avoid CORS errors during authentication requests.
-
-```ts title="src/lib/auth.ts"
-import { betterAuth } from "better-auth";
-import { prismaAdapter } from "better-auth/adapters/prisma";
-import prisma from "@/lib/prisma";
-
-export const auth = betterAuth({
- database: prismaAdapter(prisma, {
- provider: "postgresql",
- }),
- emailAndPassword: {
- enabled: true,
- },
- trustedOrigins: ["http://localhost:3001"], // [!code ++]
-});
-```
-
-:::
-
-### 3.2. Add Better Auth models to your schema
-
-Better Auth provides a CLI command to automatically add the necessary authentication models (`User`, `Session`, `Account`, and `Verification`) to your `schema.prisma` file.
-
-Run the following command:
-
-```npm
-npx @better-auth/cli generate
-```
-
-:::note
-It will ask for confirmation to overwrite your existing Prisma schema. Select `y`.
-:::
-
-This will add the following models:
-
-```prisma
-model User {
- id String @id
- name String
- email String
- emailVerified Boolean
- image String?
- createdAt DateTime
- updatedAt DateTime
- sessions Session[]
- accounts Account[]
-
- @@unique([email])
- @@map("user")
-}
-
-model Session {
- id String @id
- expiresAt DateTime
- token String
- createdAt DateTime
- updatedAt DateTime
- ipAddress String?
- userAgent String?
- userId String
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
-
- @@unique([token])
- @@map("session")
-}
-
-model Account {
- id String @id
- accountId String
- providerId String
- userId String
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- accessToken String?
- refreshToken String?
- idToken String?
- accessTokenExpiresAt DateTime?
- refreshTokenExpiresAt DateTime?
- scope String?
- password String?
- createdAt DateTime
- updatedAt DateTime
-
- @@map("account")
-}
-
-model Verification {
- id String @id
- identifier String
- value String
- expiresAt DateTime
- createdAt DateTime?
- updatedAt DateTime?
-
- @@map("verification")
-}
-```
-
-### 3.3. Migrate the database
-
-With the new models in your schema, you need to update your database. Run a migration to create the corresponding tables:
-
-```npm
-npx prisma migrate dev --name add-auth-models
-```
-
-```npm
-npx prisma generate
-```
-
-## 4. Set up the API routes
-
-Better Auth needs an API endpoint to handle authentication requests like sign-in, sign-up, and sign-out. You'll create a catch-all API route in Next.js to handle all requests sent to `/api/auth/[...all]`.
-
-In the `src/app/api` directory, create an `auth/[...all]` folder structure and a `route.ts` file inside it:
-
-```bash
-mkdir -p "src/app/api/auth/[...all]"
-touch "src/app/api/auth/[...all]/route.ts"
-```
-
-Add the following code to the newly created `route.ts` file. This code uses a helper from Better Auth to create Next.js-compatible `GET` and `POST` request handlers.
-
-```ts
-import { auth } from "@/lib/auth";
-import { toNextJsHandler } from "better-auth/next-js";
-
-export const { POST, GET } = toNextJsHandler(auth);
-```
-
-Next, you'll need a client-side utility to interact with these endpoints from your React components. In the `src/lib` directory, create an `auth-client.ts` file:
-
-```bash
-touch src/lib/auth-client.ts
-```
-
-Add the following code, which creates the React hooks and functions you'll use in your UI:
-
-```ts
-import { createAuthClient } from "better-auth/react";
-
-export const { signIn, signUp, signOut, useSession } = createAuthClient();
-```
-
-## 5. Set up your pages
-
-Now, let's build the user interface for authentication. In the `src/app` directory, create the following folder structure:
-
-- `sign-up/page.tsx`
-- `sign-in/page.tsx`
-- `dashboard/page.tsx`
-
-```bash
-mkdir -p src/app/{sign-up,sign-in,dashboard}
-touch src/app/{sign-up,sign-in,dashboard}/page.tsx
-```
-
-### 5.1. Sign up page
-
-First, create the basic `SignUpPage` component in `src/app/sign-up/page.tsx`. This sets up the main container and a title for your page.
-
-```tsx title="src/app/sign-up/page.tsx"
-"use client";
-
-export default function SignUpPage() {
- return (
-
-
Sign Up
-
- );
-}
-```
-
-Next, import the necessary hooks from React and Next.js to manage state and navigation. Initialize the router and a state variable to hold any potential error messages.
-
-```tsx title="src/app/sign-up/page.tsx"
-"use client";
-
-import { useState } from "react"; // [!code ++]
-import { useRouter } from "next/navigation"; // [!code ++]
-
-export default function SignUpPage() {
- const router = useRouter(); // [!code ++]
- const [error, setError] = useState(null); // [!code ++]
-
- return (
-
-
Sign Up
-
- );
-}
-```
-
-Now, import the `signUp` function from your Better Auth client and add the `handleSubmit` function. This function is triggered on form submission and calls the `signUp.email` method provided by Better Auth, passing the user's name, email, and password.
-
-```tsx title="src/app/sign-up/page.tsx"
-"use client";
-
-import { useState } from "react";
-import { useRouter } from "next/navigation";
-//add-next-lin
-import { signUp } from "@/lib/auth-client";
-
-export default function SignUpPage() {
- const router = useRouter();
- const [error, setError] = useState(null);
-
- async function handleSubmit(e: React.FormEvent) {
- // [!code ++]
- e.preventDefault(); // [!code ++]
- setError(null); // [!code ++]
-
- const formData = new FormData(e.currentTarget); // [!code ++]
-
- const res = await signUp.email({
- // [!code ++]
- name: formData.get("name") as string, // [!code ++]
- email: formData.get("email") as string, // [!code ++]
- password: formData.get("password") as string, // [!code ++]
- }); // [!code ++]
-
- if (res.error) {
- // [!code ++]
- setError(res.error.message || "Something went wrong."); // [!code ++]
- } else {
- // [!code ++]
- router.push("/dashboard"); // [!code ++]
- } // [!code ++]
- } // [!code ++]
-
- return (
-
-
Sign Up
-
- );
-}
-```
-
-To inform the user of any issues, add an element that conditionally renders when the `error` state is not null.
-
-```tsx title="src/app/sign-up/page.tsx"
-"use client";
-
-import { useState } from "react";
-import { useRouter } from "next/navigation";
-import { signUp } from "@/lib/auth-client";
-
-export default function SignUpPage() {
- const router = useRouter();
- const [error, setError] = useState(null);
-
- async function handleSubmit(e: React.FormEvent) {
- e.preventDefault();
- setError(null);
-
- const formData = new FormData(e.currentTarget);
-
- const res = await signUp.email({
- name: formData.get("name") as string,
- email: formData.get("email") as string,
- password: formData.get("password") as string,
- });
-
- if (res.error) {
- setError(res.error.message || "Something went wrong.");
- } else {
- router.push("/dashboard");
- }
- }
-
- return (
-
-
Sign Up
- {error &&
{error}
} // [!code ++]
-
- );
-}
-```
-
-Finally, add the HTML form with input fields for the user's name, email, and password, and a submit button.
-
-```tsx title="src/app/sign-up/page.tsx"
-"use client";
-
-import { useState } from "react";
-import { useRouter } from "next/navigation";
-import { signUp } from "@/lib/auth-client";
-
-export default function SignUpPage() {
- const router = useRouter();
- const [error, setError] = useState(null);
-
- async function handleSubmit(e: React.FormEvent) {
- e.preventDefault();
- setError(null);
-
- const formData = new FormData(e.currentTarget);
-
- const res = await signUp.email({
- name: formData.get("name") as string,
- email: formData.get("email") as string,
- password: formData.get("password") as string,
- });
-
- if (res.error) {
- setError(res.error.message || "Something went wrong.");
- } else {
- router.push("/dashboard");
- }
- }
-
- return (
-
-
Sign Up
- {error &&
{error}
}
- {" "}
- // [!code ++]
-
- );
-}
-```
-
-### 5.2. Sign in page
-
-For the sign-in page, start with the basic structure in `src/app/sign-in/page.tsx`.
-
-```tsx title="src/app/sign-in/page.tsx"
-"use client";
-
-export default function SignInPage() {
- return (
-
-
Sign In
-
- );
-}
-```
-
-Now, add the state and router hooks, similar to the sign-up page.
-
-```tsx title="src/app/sign-in/page.tsx"
-"use client";
-
-import { useState } from "react"; // [!code ++]
-import { useRouter } from "next/navigation"; // [!code ++]
-
-export default function SignInPage() {
- const router = useRouter(); // [!code ++]
- const [error, setError] = useState(null); // [!code ++]
-
- return (
-
-
Sign In
-
- );
-}
-```
-
-Add the `handleSubmit` function, this time importing and using the `signIn.email` method from Better Auth.
-
-```tsx title="src/app/sign-in/page.tsx"
-"use client";
-
-import { useState } from "react";
-import { useRouter } from "next/navigation";
-import { signIn } from "@/lib/auth-client";
-{
- /* [!code ++] */
-}
-
-export default function SignInPage() {
- const router = useRouter();
- const [error, setError] = useState(null);
-
- async function handleSubmit(e: React.FormEvent) {
- // [!code ++]
- e.preventDefault(); // [!code ++]
- setError(null); // [!code ++]
-
- const formData = new FormData(e.currentTarget); // [!code ++]
-
- const res = await signIn.email({
- // [!code ++]
- email: formData.get("email") as string, // [!code ++]
- password: formData.get("password") as string, // [!code ++]
- }); // [!code ++]
-
- if (res.error) {
- // [!code ++]
- setError(res.error.message || "Something went wrong."); // [!code ++]
- } else {
- // [!code ++]
- router.push("/dashboard"); // [!code ++]
- } // [!code ++]
- } // [!code ++]
-
- return (
-
-
Sign In
-
- );
-}
-```
-
-Add the conditional error message display.
-
-```tsx title="src/app/sign-in/page.tsx"
-"use client";
-
-import { useState } from "react";
-import { useRouter } from "next/navigation";
-import { signIn } from "@/lib/auth-client";
-
-export default function SignInPage() {
- const router = useRouter();
- const [error, setError] = useState(null);
-
- async function handleSubmit(e: React.FormEvent) {
- e.preventDefault();
- setError(null);
-
- const formData = new FormData(e.currentTarget);
-
- const res = await signIn.email({
- email: formData.get("email") as string,
- password: formData.get("password") as string,
- });
-
- if (res.error) {
- setError(res.error.message || "Something went wrong.");
- } else {
- router.push("/dashboard");
- }
- }
-
- return (
-
-
Sign In
- {error &&
{error}
} // [!code ++]
-
- );
-}
-```
-
-Finally, add the form fields for email and password and a sign-in button.
-
-```tsx title="src/app/sign-in/page.tsx"
-"use client";
-
-import { useState } from "react";
-import { useRouter } from "next/navigation";
-import { signIn } from "@/lib/auth-client";
-
-export default function SignInPage() {
- const router = useRouter();
- const [error, setError] = useState(null);
-
- async function handleSubmit(e: React.FormEvent) {
- e.preventDefault();
- setError(null);
-
- const formData = new FormData(e.currentTarget);
-
- const res = await signIn.email({
- email: formData.get("email") as string,
- password: formData.get("password") as string,
- });
-
- if (res.error) {
- setError(res.error.message || "Something went wrong.");
- } else {
- router.push("/dashboard");
- }
- }
-
- return (
-
-
Sign In
- {error &&
{error}
}
- {" "}
- // [!code ++]
-
- );
-}
-```
-
-### 5.3. Dashboard page
-
-This is the protected page for authenticated users. Start with the basic component in `src/app/dashboard/page.tsx`.
-
-```tsx title="src/app/dashboard/page.tsx"
-"use client";
-
-export default function DashboardPage() {
- return (
-
-
Dashboard
-
- );
-}
-```
-
-Import the `useSession` hook from your Better Auth client. This hook is the key to managing authentication state on the client side. It provides the session data and a pending status.
-
-```tsx title="src/app/dashboard/page.tsx"
-"use client";
-
-import { useRouter } from "next/navigation"; // [!code ++]
-import { useSession } from "@/lib/auth-client"; // [!code ++]
-
-export default function DashboardPage() {
- const router = useRouter(); // [!code ++]
- const { data: session, isPending } = useSession(); // [!code ++]
-
- return (
-
-
Dashboard
-
- );
-}
-```
-
-To protect this route, use a `useEffect` hook. This effect checks if the session has loaded (`!isPending`) and if there is no authenticated user (`!session?.user`). If both are true, it redirects the user to the sign-in page.
-
-```tsx title="src/app/dashboard/page.tsx"
-"use client";
-
-import { useRouter } from "next/navigation";
-import { useSession } from "@/lib/auth-client";
-import { useEffect } from "react";
-{
- /* [!code ++] */
-}
-
-export default function DashboardPage() {
- const router = useRouter();
- const { data: session, isPending } = useSession();
-
- useEffect(() => {
- // [!code ++]
- if (!isPending && !session?.user) {
- // [!code ++]
- router.push("/sign-in"); // [!code ++]
- } // [!code ++]
- }, [isPending, session, router]); // [!code ++]
-
- return (
-
-
Dashboard
-
- );
-}
-```
-
-To provide a better user experience, add loading and redirecting states while the session is being verified.
-
-```tsx title="src/app/dashboard/page.tsx"
-"use client";
-
-import { useRouter } from "next/navigation";
-import { useSession } from "@/lib/auth-client";
-import { useEffect } from "react";
-
-export default function DashboardPage() {
- const router = useRouter();
- const { data: session, isPending } = useSession();
-
- useEffect(() => {
- if (!isPending && !session?.user) {
- router.push("/sign-in");
- }
- }, [isPending, session, router]);
-
- if (isPending) return
Loading...
; // [!code ++]
- if (!session?.user) return
Redirecting...
; // [!code ++]
-
- return (
-
-
Dashboard
-
- );
-}
-```
-
-Finally, if the user is authenticated, display their name and email from the `session` object. Also, import the `signOut` function and add a button that calls it, allowing the user to log out.
-
-```tsx title="src/app/dashboard/page.tsx"
-"use client";
-
-import { useRouter } from "next/navigation";
-import { useSession, signOut } from "@/lib/auth-client";
-import { useEffect } from "react";
-
-export default function DashboardPage() {
- const router = useRouter();
- const { data: session, isPending } = useSession();
-
- useEffect(() => {
- if (!isPending && !session?.user) {
- router.push("/sign-in");
- }
- }, [isPending, session, router]);
-
- if (isPending) return
- {" "}
- // [!code ++]
-
- );
-}
-```
-
-### 5.4. Home page
-
-Finally, update the home page to provide simple navigation to the sign-in and sign-up pages. Replace the contents of `src/app/page.tsx` with the following:
-
-```tsx title="src/app/page.tsx"
-"use client";
-
-import { useRouter } from "next/navigation";
-
-export default function Home() {
- const router = useRouter();
-
- return (
-
-
-
-
-
-
- );
-}
-```
-
-## 6. Test it out
-
-Your application is now fully configured.
-
-1. Start the development server to test it:
-
-```npm
-npm run dev
-```
-
-2. Navigate to `http://localhost:3000` in your browser. You should see the home page with "Sign Up" and "Sign In" buttons.
-
-3. Click on **Sign Up**, create a new account, and you should be redirected to the dashboard. You can then sign out and sign back in.
-
-4. To view the user data directly in your database, you can use Prisma Studio.
-
-```npm
-npx prisma studio
-```
-
-5. This will open a new tab in your browser where you can see the `User`, `Session`, and `Account` tables and their contents.
-
-:::success
-
-Congratulations! You now have a fully functional authentication system built with Better Auth, Prisma, and Next.js.
-
-:::
-
-## Next steps
-
-- Add support for social login or magic links
-- Implement password reset and email verification
-- Add user profile and account management pages
-- Deploy to Vercel and secure your environment variables
-- Extend your Prisma schema with custom application models
-
-## Further reading
-
-- [Better Auth documentation](https://www.better-auth.com/docs)
-- [Prisma documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Next.js App Router](https://nextjs.org/docs/app)
diff --git a/apps/docs/content/docs.v6/guides/bun.mdx b/apps/docs/content/docs.v6/guides/bun.mdx
deleted file mode 100644
index d28a2371f6..0000000000
--- a/apps/docs/content/docs.v6/guides/bun.mdx
+++ /dev/null
@@ -1,329 +0,0 @@
----
-title: Bun
-description: Learn how to use Prisma ORM in a Bun application with Prisma Postgres
-image: /img/guides/prisma-bun-cover-image.png
-url: /v6/guides/bun
-metaTitle: How to use Prisma ORM and Prisma Postgres with Bun
-metaDescription: Learn how to use Prisma ORM in a Bun application with Prisma Postgres
----
-
-## Introduction
-
-[Bun](https://bun.sh) is a fast JavaScript runtime that includes a bundler, test runner, and package manager. In this guide, you will set up a Bun project with Prisma ORM and a Prisma Postgres database. You will create a simple HTTP server and build a Bun executable for deployment.
-
-## Prerequisites
-
-- [Bun](https://bun.sh/docs/installation) installed in your system
-- A [Prisma Postgres database](/v6/postgres) (created during setup)
-- Basic knowledge of JavaScript/TypeScript
-
-## 1. Setting up your Bun project
-
-First, create a directory for your project and navigate to it:
-
-```bash
-mkdir bun-prisma
-cd bun-prisma
-```
-
-Then, initialise a new Bun project:
-
-```bash
-bun init -y
-```
-
-This creates a basic Bun project that includes a `package.json` file and an `index.ts` file.
-
-## 2. Installing and configuring Prisma
-
-### 2.1. Install dependencies
-
-Install the required Prisma packages and other dependencies:
-
-```bash
-bun add -d prisma @types/pg
-bun add @prisma/client @prisma/adapter-pg pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-### 2.2. Initialize Prisma ORM with Prisma Postgres
-
-Initialize Prisma ORM with Prisma Postgres in your project:
-
-```bash
-bunx --bun prisma init --db
-```
-
-:::note
-
-The `--bun` flag is required to ensure Prisma runs with the Bun runtime. Without it, Prisma falls back to Node.js due to the `#!/usr/bin/env node` shebang in the CLI.
-
-:::
-
-:::info
-
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My Bun Project"
-
-:::
-
-This command creates:
-
-- A `prisma/` directory with your `schema.prisma` file
-- A new Prisma Postgres database
-- A `prisma.config.ts` file
-- A `.env` file with your `DATABASE_URL`
-
-### 2.3. Configure environment variables for direct connection
-
-We're going to use a direct connection string for connecting to Prisma Postgres. To get your [direct connection string](/v6/postgres/database/direct-connections#how-to-connect-to-prisma-postgres-via-direct-tcp):
-
-1. Navigate to your recently created Prisma Postgres project dashboard (e.g. "My Bun Project")
-2. Click the **API Keys** tab in the project's sidebar
-3. Click the **Create API key** button
-4. Provide a name for the API key and click **Create**
-5. Copy the connection string starting with `postgres://`
-
-Update your `.env` file to replace the `DATABASE_URL` with the new connection string:
-
-```bash title=".env"
-DATABASE_URL="your_database_url_here" # [!code --]
-DATABASE_URL="your_direct_connection_string_here" # [!code ++]
-```
-
-### 2.4. Update your Prisma schema
-
-Open `prisma/schema.prisma` and update it to include your data model:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
-} // [!code ++]
-```
-
-## 3. Generate Prisma Client and run migrations
-
-Generate the Prisma client and apply your schema to the database:
-
-```bash
-bunx --bun prisma migrate dev --name init
-bunx --bun prisma generate
-```
-
-This command:
-
-- Creates the database tables based on your schema
-- Generates the Prisma client in the `generated/prisma` directory
-
-## 4. Setting up database configuration and creating a seed script
-
-### 4.1. Create a database utility file
-
-Create a `db.ts` file in your project root to configure `PrismaClient`:
-
-```typescript title="db.ts"
-import { PrismaClient } from "./generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-export const prisma = new PrismaClient({
- adapter,
-});
-```
-
-### 4.2. Create a seed script
-
-Create a seed script in the `prisma` folder to populate your database with sample data:
-
-```typescript title="prisma/seed.ts"
-import { PrismaClient } from "../generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-async function main() {
- // Create multiple users
- await prisma.user.createMany({
- data: [
- { email: "alice@example.com", name: "Alice" },
- { email: "bob@example.com", name: "Bob" },
- { email: "charlie@example.com", name: "Charlie" },
- { email: "diana@example.com", name: "Diana" },
- { email: "eve@example.com", name: "Eve" },
- { email: "frank@example.com", name: "Frank" },
- { email: "grace@example.com", name: "Grace" },
- { email: "henry@example.com", name: "Henry" },
- { email: "isabella@example.com", name: "Isabella" },
- { email: "jack@example.com", name: "Jack" },
- ],
- skipDuplicates: true, // prevents errors if you run the seed multiple times
- });
-
- console.log("Seed data inserted!");
-}
-
-main()
- .catch((e) => {
- console.error(e);
- process.exit(1);
- })
- .finally(async () => {
- await prisma.$disconnect();
- });
-```
-
-### 3.3. Add the seed script to Prisma Config
-
-Add the following content to the file:
-
-```typescript title="prisma.config.ts"
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: `bun run prisma/seed.ts`, // [!code ++]
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-Unlike Node.js, Bun automatically loads `.env` files, so the `import 'dotenv/config'` line is not needed. If you see this import in your generated `prisma.config.ts`, you can safely remove it.
-
-:::
-
-Run the seed script to populate your database:
-
-```bash
-bunx --bun prisma db seed
-```
-
-## 5. Creating your Bun server
-
-Replace the `index.ts` file contents with the following code to build a simple HTTP server that uses Prisma ORM to fetch and display users:
-
-```typescript title="index.ts"
-import { prisma } from "./db";
-
-const server = Bun.serve({
- port: 3000,
- async fetch(req) {
- const { pathname } = new URL(req.url);
-
- // Skip favicon route
- if (pathname === "/favicon.ico") {
- return new Response(null, { status: 204 }); // or serve an icon if you have one
- }
-
- // Return all users
- const users = await prisma.user.findMany();
-
- // Count all users
- const count = await prisma.user.count();
-
- // Format the response with JSON
- return new Response(
- JSON.stringify({
- users: users,
- totalUsers: count,
- }),
- { headers: { "Content-Type": "application/json" } },
- );
- },
-});
-
-console.log(`Listening on http://localhost:${server.port}`);
-```
-
-## 6. Running your application
-
-Start your Bun server:
-
-```bash
-bun run index.ts
-```
-
-You should see `Listening on http://localhost:3000` in the console. When you visit `http://localhost:3000` in your browser, you'll see a JSON response with all the users in your database and the total count.
-
-## 7. Building and running a Bun executable
-
-Bun can compile your [TypeScript application into a single executable file](https://bun.com/docs/bundler/executables), which is useful for deployment and distribution.
-
-### 7.1. Build the executable
-
-Build your application into an executable:
-
-```bash
-bun build --compile index.ts
-```
-
-This creates an executable file named `index` (or `index.exe` on Windows) in your project directory.
-
-### 7.2. Run the executable
-
-Run the compiled executable:
-
-```bash
-./index
-```
-
-You should see the same `Listening on http://localhost:3000` message, and your application will work exactly the same as before. The executable includes all dependencies and can be deployed to any compatible system without requiring Bun or Node.js to be installed.
-
-:::note
-
-Bun executables are useful for:
-
-- **Deployment**: Ship a single file instead of managing dependencies
-- **Distribution**: Share your application without requiring users to install Bun
-- **Performance**: Faster startup times compared to running TypeScript files
-- **Security**: Your source code is compiled and not easily readable
-
-:::
-
-## Next steps
-
-You can explore [this example](https://pris.ly/bun_ppg_example) to see a sample application built with Bun and Prisma.
-
-Now that you have a Bun application connected to a Prisma Postgres database, you can continue by:
-
-- Extending your Prisma schema with additional models and relationships
-- Implementing authentication and authorization
-- Adding input validation and error handling
-- Exploring Bun's built-in testing tools
-- Deploying your executable to production servers
-
-### More info
-
-- [Bun Documentation](https://bun.sh/docs)
-- [Prisma Config File](/v6/orm/reference/prisma-config-reference)
-- [Prisma Client without the Rust engine](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine)
-- [Prisma Postgres](/v6/postgres)
diff --git a/apps/docs/content/docs.v6/guides/clerk-astro.mdx b/apps/docs/content/docs.v6/guides/clerk-astro.mdx
deleted file mode 100644
index db86762c85..0000000000
--- a/apps/docs/content/docs.v6/guides/clerk-astro.mdx
+++ /dev/null
@@ -1,518 +0,0 @@
----
-title: Clerk (with Astro)
-description: Learn how to use Prisma ORM in an Astro app with Clerk Auth
-image: /img/guides/prisma-clerk-astro-cover.png
-url: /v6/guides/clerk-astro
-metaTitle: How to use Prisma ORM and Prisma Postgres with Clerk Auth and Astro
-metaDescription: Learn how to use Prisma ORM in an Astro app with Clerk Auth
----
-
-## Introduction
-
-[Clerk](https://clerk.com/) is a drop-in auth provider that handles sign-up, sign-in, user management, and webhooks so you don't have to.
-
-In this guide you'll wire Clerk into a brand-new [Astro](https://astro.build/) app and persist users in a [Prisma Postgres](https://prisma.io/postgres) database. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/clerk-astro).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- [Clerk account](https://clerk.com)
-- [ngrok account](https://ngrok.com)
-
-## 1. Set up your project
-
-Create a new Astro project:
-
-```npm
-npm create astro@latest
-```
-
-It will prompt you to customize your setup. Choose the defaults:
-
-:::info
-
-- _How would you like to start your new project?_ `Empty`
-- _Install dependencies?_ `Yes`
-- _Initialize a new git repository?_ `Yes`
-
-:::
-
-Navigate into the newly created project directory:
-
-```bash
-cd
-```
-
-## 2. Set up Clerk
-
-### 2.1. Create a new Clerk application
-
-[Sign in](https://dashboard.clerk.com/sign-in) to Clerk and navigate to the home page. From there, press the `Create Application` button to create a new application. Enter a title, select your sign-in options, and click `Create Application`.
-
-:::info
-
-For this guide, the Google, Github, and Email sign in options will be used.
-
-:::
-
-Install the Clerk Astro SDK and Node adapter:
-
-```npm
-npm install @clerk/astro @astrojs/node
-```
-
-In the Clerk Dashboard, navigate to the **API keys** page. In the **Quick Copy** section, copy your Clerk Publishable and Secret Keys. Paste your keys into `.env` in the root of your project:
-
-```bash title=".env"
-PUBLIC_CLERK_PUBLISHABLE_KEY=
-CLERK_SECRET_KEY=
-```
-
-### 2.2. Configure Astro with Clerk
-
-Astro needs to be configured for server-side rendering (SSR) with the Node adapter to work with Clerk. Update your `astro.config.mjs` file to include the Clerk integration and enable SSR:
-
-```javascript title="astro.config.mjs"
-import { defineConfig } from "astro/config";
-import node from "@astrojs/node"; // [!code ++]
-import clerk from "@clerk/astro"; // [!code ++]
-
-export default defineConfig({
- integrations: [clerk()], // [!code ++]
- adapter: node({ mode: "standalone" }), // [!code ++]
- output: "server", // [!code ++]
-});
-```
-
-### 2.3. Set up Clerk middleware
-
-The `clerkMiddleware` helper enables authentication across your entire application. Create a `middleware.ts` file in the `src` directory:
-
-```typescript title="src/middleware.ts"
-import { clerkMiddleware } from "@clerk/astro/server";
-
-export const onRequest = clerkMiddleware();
-```
-
-### 2.4. Add Clerk UI to your page
-
-Update your `src/pages/index.astro` file to import the Clerk authentication components:
-
-```html title="src/pages/index.astro"
----
-import { // [!code ++]
-SignedIn, // [!code ++]
-SignedOut, // [!code ++]
-UserButton, // [!code ++]
-SignInButton, // [!code ++]
-} from "@clerk/astro/components"; // [!code ++]
----
-
-
-
-
-
-
-
- Astro
-
-
-
-```
-
-Now add a header with conditional rendering to show sign-in buttons for unauthenticated users and a user button for authenticated users:
-
-```html title="src/pages/index.astro"
----
-import {
-SignedIn,
-SignedOut,
-UserButton,
-SignInButton,
-} from "@clerk/astro/components";
----
-
-
-
-
-
-
-
- Astro
-
-
-
- // [!code ++]
- // [!code ++] // [!code ++] // [!code
- ++] // [!code ++] // [!code ++] // [!code ++]
-
- // [!code ++]
-
-
-```
-
-## 3. Install and configure Prisma
-
-### 3.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for the database like "My Clerk Astro Project"
-:::
-
-This will create:
-
-- A `prisma/` directory with a `schema.prisma` file
-- A `prisma.config.ts` file with your Prisma configuration
-- A `.env` file with a `DATABASE_URL` already set
-
-### 3.2. Define your Prisma Schema
-
-Add a `User` model that will store authenticated user information from Clerk. The `clerkId` field uniquely links each database user to their Clerk account:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- clerkId String @unique // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
-} // [!code ++]
-```
-
-Run the following command to create the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-After the migration is complete, generate the Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-This generates the Prisma Client in the `src/generated/prisma` directory.
-
-### 3.3. Create TypeScript environment definitions
-
-Create an `env.d.ts` file in your `src` directory to provide TypeScript definitions for your environment variables:
-
-```bash
-touch src/env.d.ts
-```
-
-Add type definitions for all the environment variables your application uses:
-
-```typescript title="src/env.d.ts"
-interface ImportMetaEnv {
- readonly DATABASE_URL: string;
- readonly CLERK_WEBHOOK_SIGNING_SECRET: string;
- readonly CLERK_SECRET_KEY: string;
- readonly PUBLIC_CLERK_PUBLISHABLE_KEY: string;
-}
-
-interface ImportMeta {
- readonly env: ImportMetaEnv;
-}
-```
-
-### 3.4. Create a reusable Prisma Client
-
-In the `src` directory, create a `lib` directory and a `prisma.ts` file inside it:
-
-```bash
-mkdir src/lib
-touch src/lib/prisma.ts
-```
-
-Initialize the Prisma Client with the PostgreSQL adapter:
-
-```typescript title="src/lib/prisma.ts"
-import { PrismaClient } from "../generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: import.meta.env.DATABASE_URL,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-export default prisma;
-```
-
-## 4. Wire Clerk to the database
-
-### 4.1. Create a Clerk webhook endpoint
-
-Webhooks allow Clerk to notify your application when events occur, such as when a user signs up. You'll create an API route to handle these webhooks and sync user data to your database.
-
-Create the directory structure and file for the webhook endpoint:
-
-```bash
-mkdir -p src/pages/api/webhooks
-touch src/pages/api/webhooks/clerk.ts
-```
-
-Import the necessary dependencies:
-
-```typescript title="src/pages/api/webhooks/clerk.ts"
-import { verifyWebhook } from "@clerk/astro/webhooks";
-import type { APIRoute } from "astro";
-import prisma from "../../../lib/prisma";
-```
-
-Create the `POST` handler that Clerk will call. The `verifyWebhook` function validates that the request actually comes from Clerk using the signing secret:
-
-```typescript title="src/pages/api/webhooks/clerk.ts"
-import { verifyWebhook } from "@clerk/astro/webhooks";
-import type { APIRoute } from "astro";
-import prisma from "../../../lib/prisma";
-
-export const POST: APIRoute = async ({ request }) => {
- // [!code ++]
- try {
- // [!code ++]
- const evt = await verifyWebhook(request, {
- // [!code ++]
- signingSecret: import.meta.env.CLERK_WEBHOOK_SIGNING_SECRET, // [!code ++]
- }); // [!code ++]
- const { id } = evt.data; // [!code ++]
- const eventType = evt.type; // [!code ++]
- console.log(`Received webhook with ID ${id} and event type of ${eventType}`); // [!code ++]
- } catch (err) {
- // [!code ++]
- console.error("Error verifying webhook:", err); // [!code ++]
- return new Response("Error verifying webhook", { status: 400 }); // [!code ++]
- } // [!code ++]
-}; // [!code ++]
-```
-
-When a new user is created, they need to be stored in the database.
-
-You'll do that by checking if the event type is `user.created` and then using Prisma's `upsert` method to create a new user if they don't exist:
-
-```typescript title="src/pages/api/webhooks/clerk.ts"
-import { verifyWebhook } from "@clerk/astro/webhooks";
-import type { APIRoute } from "astro";
-import prisma from "../../../lib/prisma";
-
-export const POST: APIRoute = async ({ request }) => {
- try {
- const evt = await verifyWebhook(request, {
- signingSecret: import.meta.env.CLERK_WEBHOOK_SIGNING_SECRET,
- });
- const { id } = evt.data;
- const eventType = evt.type;
- console.log(`Received webhook with ID ${id} and event type of ${eventType}`);
-
- if (eventType === "user.created") {
- // [!code ++]
- const { id, email_addresses, first_name, last_name } = evt.data; // [!code ++]
- await prisma.user.upsert({
- // [!code ++]
- where: { clerkId: id }, // [!code ++]
- update: {}, // [!code ++]
- create: {
- // [!code ++]
- clerkId: id, // [!code ++]
- email: email_addresses[0].email_address, // [!code ++]
- name: `${first_name} ${last_name}`, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- } // [!code ++]
- } catch (err) {
- console.error("Error verifying webhook:", err);
- return new Response("Error verifying webhook", { status: 400 });
- }
-};
-```
-
-Finally, return a response to Clerk to confirm the webhook was received:
-
-```typescript title="src/pages/api/webhooks/clerk.ts"
-import { verifyWebhook } from "@clerk/astro/webhooks";
-import type { APIRoute } from "astro";
-import prisma from "../../../lib/prisma";
-
-export const POST: APIRoute = async ({ request }) => {
- try {
- const evt = await verifyWebhook(request, {
- signingSecret: import.meta.env.CLERK_WEBHOOK_SIGNING_SECRET,
- });
- const { id } = evt.data;
- const eventType = evt.type;
- console.log(`Received webhook with ID ${id} and event type of ${eventType}`);
-
- if (eventType === "user.created") {
- const { id, email_addresses, first_name, last_name } = evt.data;
- await prisma.user.upsert({
- where: { clerkId: id },
- update: {},
- create: {
- clerkId: id,
- email: email_addresses[0].email_address,
- name: `${first_name} ${last_name}`,
- },
- });
- }
-
- return new Response("Webhook received", { status: 200 }); // [!code ++]
- } catch (err) {
- console.error("Error verifying webhook:", err);
- return new Response("Error verifying webhook", { status: 400 });
- }
-};
-```
-
-### 4.2. Expose your local app for webhooks
-
-You'll need to expose your local app for webhooks with [ngrok](https://ngrok.com/). This will allow Clerk to reach your `/api/webhooks/clerk` route to push events like `user.created`.
-
-Start your development server:
-
-```npm
-npm run dev
-```
-
-In a separate terminal window, install ngrok globally and expose your local app:
-
-```npm
-npm install --global ngrok
-ngrok http 4321
-```
-
-Copy the ngrok `Forwarding URL` (e.g., `https://a65a60261342.ngrok-free.app`). This will be used to configure the webhook URL in Clerk.
-
-### 4.3. Configure Astro to allow ngrok connections
-
-Astro needs to be configured to accept connections from the ngrok domain. Update your `astro.config.mjs` to include the ngrok host in the allowed hosts list:
-
-```javascript title="astro.config.mjs"
-import { defineConfig } from "astro/config";
-import node from "@astrojs/node";
-import clerk from "@clerk/astro";
-
-export default defineConfig({
- integrations: [clerk()],
- adapter: node({ mode: "standalone" }),
- output: "server",
- server: {
- // [!code ++]
- allowedHosts: ["localhost", ".ngrok-free.app"], // [!code ++]
- }, // [!code ++]
-});
-```
-
-:::note
-
-Replace `` with the subdomain from your ngrok URL. For example, if your ngrok URL is `https://a65a60261342.ngrok-free.app`, use `a65a60261342.ngrok-free.app`.
-
-:::
-
-### 4.4. Register the webhook in Clerk
-
-Navigate to the **_Webhooks_** section of your Clerk application located near the bottom of the **_Configure_** tab under **_Developers_**.
-
-Click **_Add Endpoint_** and paste the ngrok URL into the **_Endpoint URL_** field and add `/api/webhooks/clerk` to the end. It should look similar to this:
-
-```text
-https://a65a60261342.ngrok-free.app/api/webhooks/clerk
-```
-
-Subscribe to the **user.created** event by checking the box next to it under **_Message Filtering_**.
-
-Click **_Create_** to save the webhook endpoint.
-
-Copy the **_Signing Secret_** and add it to your `.env` file:
-
-```bash title=".env"
-# Prisma
-DATABASE_URL=
-
-# Clerk
-PUBLIC_CLERK_PUBLISHABLE_KEY=
-CLERK_SECRET_KEY=
-CLERK_WEBHOOK_SIGNING_SECRET= # [!code ++]
-```
-
-Restart your dev server to pick up the new environment variable:
-
-```npm
-npm run dev
-```
-
-### 4.5. Test the integration
-
-Navigate to `http://localhost:4321` in your browser and sign in using any of the sign-up options you configured in Clerk.
-
-Open Prisma Studio to verify that the user was created in your database:
-
-```npm
-npx prisma studio
-```
-
-You should see a new user record with the Clerk ID, email, and name from your sign-up.
-
-:::note
-
-If you don't see a user record, there are a few things to check:
-
-- Delete your user from the Users tab in Clerk and try signing up again.
-- Check your ngrok URL and ensure it's correct _(it will change every time you restart ngrok)_.
-- Verify your Clerk webhook is pointing to the correct ngrok URL.
-- Make sure you've added `/api/webhooks/clerk` to the end of the webhook URL.
-- Ensure you've subscribed to the **user.created** event in Clerk.
-- Confirm you've added the ngrok host to `allowedHosts` in `astro.config.mjs` and removed `https://`.
-- Check the terminal running `npm run dev` for any error messages.
-
-:::
-
-You've successfully built an Astro application with Clerk authentication and Prisma, creating a foundation for a secure and scalable full-stack application that handles user management and data persistence with ease.
-
-## Next steps
-
-Now that you have a working Astro app with Clerk authentication and Prisma connected to a Prisma Postgres database, you can:
-
-- Add user profile management and update functionality
-- Build protected API routes that require authentication
-- Extend your schema with additional models related to users
-- Deploy to your preferred hosting platform and set your production webhook URL in Clerk
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-
-### More info
-
-- [Prisma Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Astro Documentation](https://docs.astro.build)
-- [Clerk Documentation](https://clerk.com/docs)
diff --git a/apps/docs/content/docs.v6/guides/clerk-nextjs.mdx b/apps/docs/content/docs.v6/guides/clerk-nextjs.mdx
deleted file mode 100644
index 2cf142ca10..0000000000
--- a/apps/docs/content/docs.v6/guides/clerk-nextjs.mdx
+++ /dev/null
@@ -1,834 +0,0 @@
----
-title: Clerk (with Next.js)
-description: Learn how to use Prisma ORM in a Next.js app with Clerk Auth
-image: /img/guides/prisma-clerk-nextjs-cover.png
-url: /v6/guides/clerk-nextjs
-metaTitle: How to use Prisma ORM and Prisma Postgres with Clerk Auth and Next.js
-metaDescription: Learn how to use Prisma ORM in a Next.js app with Clerk Auth
----
-
-## Introduction
-
-[Clerk](https://clerk.com/) is a drop-in auth provider that handles sign-up, sign-in, user management, and webhooks so you don't have to.
-
-In this guide you'll wire Clerk into a brand-new [Next.js](https://nextjs.org/) app, persist users in a [Prisma Postgres](https://prisma.io/postgres) database, and expose a tiny posts API. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/clerk-nextjs).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- [Clerk account](https://clerk.com)
-- [ngrok account](https://ngrok.com)
-
-## 1. Set up your project
-
-Create the app:
-
-```npm
-npx create-next-app@latest clerk-nextjs-prisma
-```
-
-It will prompt you to customize your setup. Choose the defaults:
-
-:::info
-
-- _Would you like to use TypeScript?_ `Yes`
-- _Would you like to use ESLint?_ `Yes`
-- _Would you like to use Tailwind CSS?_ `Yes`
-- _Would you like your code inside a `src/` directory?_ `No`
-- _Would you like to use App Router?_ (recommended) `Yes`
-- _Would you like to use Turbopack for `next dev`?_ `Yes`
-- _Would you like to customize the import alias (`@/_`by default)?*`No`
-
-:::
-
-Navigate to the project directory:
-
-```bash
-cd clerk-nextjs-prisma
-```
-
-## 2. Set up Clerk
-
-### 2.1. Create a new Clerk application
-
-[Sign in](https://dashboard.clerk.com/sign-in) to Clerk and navigate to the home page. From there, press the `Create Application` button to create a new application. Enter a title, select your sign-in options, and click `Create Application`.
-
-:::info
-
-For this guide, the Google, Github, and Email sign in options will be used.
-
-:::
-
-Install the Clerk Next.js SDK:
-
-```npm
-npm install @clerk/nextjs
-```
-
-Copy your Clerk keys and paste them into **.env** in the root of your project:
-
-```bash title=".env"
-# Clerk # [!code ++]
-NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY= # [!code ++]
-CLERK_SECRET_KEY= # [!code ++]
-```
-
-### 2.2. Protect routes with Clerk middleware
-
-The `clerkMiddleware` helper enables authentication and is where you'll configure your protected routes.
-
-Create a `middleware.ts` file in the root directory of your project:
-
-```tsx title="middleware.ts" showLineNumbers
-import { clerkMiddleware } from "@clerk/nextjs/server"; // [!code ++]
-
-export default clerkMiddleware(); // [!code ++]
-
-export const config = {
- // [!code ++]
- matcher: [
- // [!code ++]
- "/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)", // [!code ++]
- "/(api|trpc)(.*)", // [!code ++]
- ], // [!code ++]
-}; // [!code ++]
-```
-
-### 2.3. Add Clerk UI to your layout
-
-Next, you'll need to wrap your app in the `ClerkProvider` component to make authentication globally available.
-
-In your `layout.tsx` file, add the `ClerkProvider` component:
-
-```tsx title="app/layout.tsx" showLineNumbers
-import type { Metadata } from "next";
-import { Geist, Geist_Mono } from "next/font/google";
-import "./globals.css";
-import { ClerkProvider } from "@clerk/nextjs"; {/* [!code ++] */}
-
-const geistSans = Geist({
- variable: "--font-geist-sans",
- subsets: ["latin"],
-});
-
-const geistMono = Geist_Mono({
- variable: "--font-geist-mono",
- subsets: ["latin"],
-});
-
-export const metadata: Metadata = {
- title: "Create Next App",
- description: "Generated by create next app",
-};
-
-export default function RootLayout({
- children,
-}: Readonly<{
- children: React.ReactNode;
-}>) {
- return (
- {/* [!code ++] */}
-
-
- {children}
-
-
- {/* [!code ++] */}
- );
-}
-```
-
-Create a `Navbar` component which will be used to display the Sign In and Sign Up buttons as well as the User Button once a user is signed in:
-
-```tsx title="app/layout.tsx" showLineNumbers
-import type { Metadata } from "next";
-import { Geist, Geist_Mono } from "next/font/google";
-import "./globals.css";
-import {
- ClerkProvider,
- UserButton, // [!code ++]
- SignInButton, // [!code ++]
- SignUpButton, // [!code ++]
- SignedOut, // [!code ++]
- SignedIn, // [!code ++]
-} from "@clerk/nextjs";
-
-const geistSans = Geist({
- variable: "--font-geist-sans",
- subsets: ["latin"],
-});
-
-const geistMono = Geist_Mono({
- variable: "--font-geist-mono",
- subsets: ["latin"],
-});
-
-export const metadata: Metadata = {
- title: "Create Next App",
- description: "Generated by create next app",
-};
-
-export default function RootLayout({
- children,
-}: Readonly<{
- children: React.ReactNode;
-}>) {
- return (
-
-
-
- {/* [!code ++] */}
- {children}
-
-
-
- );
-}
-
-const Navbar = () => {
- // [!code ++]
- return (
- // [!code ++]
-
- {" "}
- // [!code ++]
-
- {" "}
- // [!code ++]
- // [!code ++]
- // [!code ++]
- {" "}
- // [!code ++]
-
- {" "}
- // [!code ++]
- // [!code ++]
- {" "}
- // [!code ++]
- // [!code ++]
- ); // [!code ++]
-}; // [!code ++]
-```
-
-## 3. Install and configure Prisma
-
-### 3.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../app/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for the database like "My Clerk NextJS Project"
-:::
-This will create:
-
-- A `prisma/` directory with a `schema.prisma` file
-- A `DATABASE_URL` in `.env`
-
-### 3.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, add the following models:
-
-```prisma title="prisma/schema.prisma" showLineNumbers
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- clerkId String @unique // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- createdAt DateTime @default(now()) // [!code ++]
-} // [!code ++]
-```
-
-This will create two models: `User` and `Post`, with a one-to-many relationship between them.
-
-Create a `prisma.config.ts` file to configure Prisma:
-
-```typescript title="prisma.config.ts" showLineNumbers
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config"; // [!code ++]
-
-export default defineConfig({
- // [!code ++]
- schema: "prisma/schema.prisma", // [!code ++]
- migrations: {
- // [!code ++]
- path: "prisma/migrations", // [!code ++]
- }, // [!code ++]
- datasource: {
- // [!code ++]
- url: env("DATABASE_URL"), // [!code ++]
- }, // [!code ++]
-}); // [!code ++]
-```
-
-:::note
-
-You'll need to install the `dotenv` package:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-Now, run the following command to create the database tables and generate the Prisma Client:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-```npm
-npx prisma generate
-```
-
-:::warning
-
-It is recommended that you add `/app/generated/prisma` to your `.gitignore` file.
-
-:::
-
-### 3.3. Create a reusable Prisma Client
-
-In the root directory, create a `lib` directory and a `prisma.ts` file inside it:
-
-```tsx title="lib/prisma.ts" showLineNumbers
-import { PrismaClient } from "../app/generated/prisma/client"; // [!code ++]
-import { PrismaPg } from "@prisma/adapter-pg"; // [!code ++]
-
-const adapter = new PrismaPg({
- // [!code ++]
- connectionString: process.env.DATABASE_URL!, // [!code ++]
-}); // [!code ++]
-
-const globalForPrisma = global as unknown as {
- // [!code ++]
- prisma: PrismaClient; // [!code ++]
-}; // [!code ++]
-
-const prisma = // [!code ++]
- globalForPrisma.prisma || // [!code ++]
- new PrismaClient({
- // [!code ++]
- adapter, // [!code ++]
- }); // [!code ++]
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma; // [!code ++]
-
-export default prisma; // [!code ++]
-```
-
-## 4. Wire Clerk to the database
-
-### 4.1. Create a Clerk webhook endpoint
-
-Create a new API route at `app/api/webhooks/clerk/route.ts`:
-
-Import the necessary dependencies:
-
-```tsx title="app/api/webhooks/clerk/route.ts" showLineNumbers
-import { verifyWebhook } from "@clerk/nextjs/webhooks"; // [!code ++]
-import { NextRequest } from "next/server"; // [!code ++]
-import prisma from "@/lib/prisma"; // [!code ++]
-```
-
-Create the `POST` method that Clerk will call and verify the webhook:
-
-```tsx title="app/api/webhooks/clerk/route.ts" showLineNumbers
-import { verifyWebhook } from "@clerk/nextjs/webhooks";
-import { NextRequest } from "next/server";
-import prisma from "@/lib/prisma";
-
-export async function POST(req: NextRequest) {
- // [!code ++]
- try {
- // [!code ++]
- const evt = await verifyWebhook(req); // [!code ++]
- const { id } = evt.data; // [!code ++]
- const eventType = evt.type; // [!code ++]
- console.log(`Received webhook with ID ${id} and event type of ${eventType}`); // [!code ++]
- } catch (err) {
- // [!code ++]
- console.error("Error verifying webhook:", err); // [!code ++]
- return new Response("Error verifying webhook", { status: 400 }); // [!code ++]
- } // [!code ++]
-} // [!code ++]
-```
-
-When a new user is created, they need to be stored in the database.
-
-You'll do that by checking if the event type is `user.created` and then using Prisma's `upsert` method to create a new user if they don't exist:
-
-```tsx title="app/api/webhooks/clerk/route.ts" showLineNumbers
-import { verifyWebhook } from "@clerk/nextjs/webhooks";
-import { NextRequest } from "next/server";
-import prisma from "@/lib/prisma";
-
-export async function POST(req: NextRequest) {
- try {
- const evt = await verifyWebhook(req);
- const { id } = evt.data;
- const eventType = evt.type;
- console.log(`Received webhook with ID ${id} and event type of ${eventType}`);
-
- if (eventType === "user.created") {
- // [!code ++]
- const { id, email_addresses, first_name, last_name } = evt.data; // [!code ++]
- await prisma.user.upsert({
- // [!code ++]
- where: { clerkId: id }, // [!code ++]
- update: {}, // [!code ++]
- create: {
- // [!code ++]
- clerkId: id, // [!code ++]
- email: email_addresses[0].email_address, // [!code ++]
- name: `${first_name} ${last_name}`, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- } // [!code ++]
- } catch (err) {
- console.error("Error verifying webhook:", err);
- return new Response("Error verifying webhook", { status: 400 });
- }
-}
-```
-
-Finally, return a response to Clerk to confirm the webhook was received:
-
-```tsx title="app/api/webhooks/clerk/route.ts" showLineNumbers
-import { verifyWebhook } from "@clerk/nextjs/webhooks";
-import { NextRequest } from "next/server";
-import prisma from "@/lib/prisma";
-
-export async function POST(req: NextRequest) {
- try {
- const evt = await verifyWebhook(req);
- const { id } = evt.data;
- const eventType = evt.type;
- console.log(`Received webhook with ID ${id} and event type of ${eventType}`);
-
- if (eventType === "user.created") {
- const { id, email_addresses, first_name, last_name } = evt.data;
- await prisma.user.upsert({
- where: { clerkId: id },
- update: {},
- create: {
- clerkId: id,
- email: email_addresses[0].email_address,
- name: `${first_name} ${last_name}`,
- },
- });
- }
-
- return new Response("Webhook received", { status: 200 });
- {
- /* [!code ++] */
- }
- } catch (err) {
- console.error("Error verifying webhook:", err);
- return new Response("Error verifying webhook", { status: 400 });
- }
-}
-```
-
-### 4.2. Expose your local app for webhooks
-
-You'll need to expose your local app for webhooks with [ngrok](https://ngrok.com/). This will allow Clerk to reach your `/api/webhooks/clerk` route to push events like `user.created`.
-
-Install ngrok and expose your local app:
-
-```npm
-npm install --global ngrok
-ngrok http 3000
-```
-
-Copy the ngrok `Forwarding URL`. This will be used to set the webhook URL in Clerk.
-
-Navigate to the **_Webhooks_** section of your Clerk application located near the bottom of the **_Configure_** tab under **_Developers_**.
-
-Click **_Add Endpoint_** and paste the ngrok URL into the **_Endpoint URL_** field and add `/api/webhooks/clerk` to the end of the URL. It should look similar to this:
-
-```text
-https://a60b-99-42-62-240.ngrok-free.app/api/webhooks/clerk
-```
-
-Copy the **_Signing Secret_** and add it to your `.env` file:
-
-```bash title=".env"
-# Prisma
-DATABASE_URL=
-
-# Clerk
-NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
-CLERK_SECRET_KEY=
-CLERK_WEBHOOK_SIGNING_SECRET= # [!code ++]
-```
-
-On the home page, press Sign Up and create an account using any of the sign-up options
-
-Open Prisma Studio and you should see a user record.
-
-```npm
-npx prisma studio
-```
-
-:::note
-
-If you don't see a user record, there are a few things to check:
-
-- Delete your user from the Users tab in Clerk and try again.
-- Check your ngrok URL and ensure it's correct _(it will change everytime you restart ngrok)_.
-- Check your Clerk webhook is pointing to the correct ngrok URL.
-- Make sure you've added `/api/webhooks/clerk` to the end of the URL.
-
-:::
-
-## 5. Build a posts API
-
-To create posts under a user, you'll need to create a new API route at `app/api/posts/route.ts`:
-
-Start by importing the necessary dependencies:
-
-```tsx title="app/api/posts/route.ts" showLineNumbers
-import { auth } from "@clerk/nextjs/server"; // [!code ++]
-import prisma from "@/lib/prisma"; // [!code ++]
-```
-
-Get the `clerkId` of the authenticated user. If there's no user, return a `401` Unauthorized response:
-
-```tsx title="app/api/posts/route.ts" showLineNumbers
-import { auth } from "@clerk/nextjs/server";
-import prisma from "@/lib/prisma";
-
-export async function POST(req: Request) {
- // [!code ++]
- const { userId: clerkId } = await auth(); // [!code ++]
- if (!clerkId) return new Response("Unauthorized", { status: 401 }); // [!code ++]
-} // [!code ++]
-```
-
-Match the Clerk user to a user in the database. If none is found, return a `404` Not Found response:
-
-```tsx title="app/api/posts/route.ts" showLineNumbers
-import { auth } from "@clerk/nextjs/server";
-import prisma from "@/lib/prisma";
-
-export async function POST(req: Request) {
- const { userId: clerkId } = await auth();
- if (!clerkId) return new Response("Unauthorized", { status: 401 });
-
- const user = await prisma.user.findUnique({
- // [!code ++]
- where: { clerkId }, // [!code ++]
- }); // [!code ++]
-
- if (!user) return new Response("User not found", { status: 404 }); // [!code ++]
-}
-```
-
-Destructure the title and content from the incoming request and create a post. Once done, return a `201` Created response:
-
-```tsx title="app/api/posts/route.ts" showLineNumbers
-import { auth } from "@clerk/nextjs/server";
-import prisma from "@/lib/prisma";
-
-export async function POST(req: Request) {
- const { userId: clerkId } = await auth();
- if (!clerkId) return new Response("Unauthorized", { status: 401 });
-
- const { title, content } = await req.json();
- {
- /* [!code ++] */
- }
-
- const user = await prisma.user.findUnique({
- where: { clerkId },
- });
-
- if (!user) return new Response("User not found", { status: 404 });
-
- const post = await prisma.post.create({
- // [!code ++]
- data: {
- // [!code ++]
- title, // [!code ++]
- content, // [!code ++]
- authorId: user.id, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
-
- return new Response(JSON.stringify(post), { status: 201 });
- {
- /* [!code ++] */
- }
-}
-```
-
-## 6. Add a Post creation UI
-
-In `/app`, create a `/components` directory and a `PostInputs.tsx` file inside it:
-
-```tsx title="app/components/PostInputs.tsx" showLineNumbers
-"use client";
-{
- /* [!code ++] */
-}
-
-import { useState } from "react";
-{
- /* [!code ++] */
-}
-
-export default function PostInputs() {
- // [!code ++]
- const [title, setTitle] = useState(""); // [!code ++]
- const [content, setContent] = useState(""); // [!code ++]
-} // [!code ++]
-```
-
-This component uses `"use client"` to ensure the component is rendered on the client. The title and content are stored in their own `useState` hooks.
-
-Create a function that will be called when a form is submitted:
-
-```tsx title="app/components/PostInputs.tsx" showLineNumbers
-"use client";
-
-import { useState } from "react";
-
-export default function PostInputs() {
- const [title, setTitle] = useState("");
- const [content, setContent] = useState("");
-
- async function createPost(e: React.FormEvent) {
- // [!code ++]
- e.preventDefault(); // [!code ++]
- if (!title || !content) return; // [!code ++]
-
- await fetch("/api/posts", {
- // [!code ++]
- method: "POST", // [!code ++]
- headers: { "Content-Type": "application/json" }, // [!code ++]
- body: JSON.stringify({ title, content }), // [!code ++]
- }); // [!code ++]
-
- setTitle(""); // [!code ++]
- setContent(""); // [!code ++]
- location.reload(); // [!code ++]
- } // [!code ++]
-}
-```
-
-You'll be using a form to create a post and call the `POST` route you created earlier:
-
-```tsx title="app/components/PostInputs.tsx" showLineNumbers
-"use client";
-
-import { useState } from "react";
-
-export default function PostInputs() {
- const [title, setTitle] = useState("");
- const [content, setContent] = useState("");
-
- async function createPost(e: React.FormEvent) {
- e.preventDefault();
- if (!title || !content) return;
-
- await fetch("/api/posts", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ title, content }),
- });
-
- setTitle("");
- setContent("");
- location.reload();
- }
-
- return (
- // [!code ++]
- // [!code ++]
- ); // [!code ++]
-}
-```
-
-On submit:
-
-- It sends a `POST` request to the `/api/posts` route
-- Clears the input fields
-- Reloads the page to show the new post
-
-## 7. Set up `page.tsx`
-
-Now, update the `page.tsx` file to fetch posts, show the form, and render the list.
-
-Delete everything within `page.tsx`, leaving only the following:
-
-```tsx title="app/page.tsx" showLineNumbers
-export default function Home() {
- return ()
-}
-```
-
-Import the necessary dependencies:
-
-```tsx title="app/page.tsx" showLineNumbers
-import { currentUser } from "@clerk/nextjs/server"; // [!code ++]
-import prisma from "@/lib/prisma"; // [!code ++]
-import PostInputs from "@/app/components/PostInputs"; // [!code ++]
-
-export default function Home() {
- return ()
-}
-```
-
-To ensure only signed-in users can access the post functionality, update the `Home` component to check for a user:
-
-```tsx title="app/page.tsx" showLineNumbers
-import { currentUser } from "@clerk/nextjs/server"; // [!code ++]
-import prisma from "@/lib/prisma"; // [!code ++]
-import PostInputs from "@/app/components/PostInputs"; // [!code ++]
-
-export default async function Home() {
- const user = await currentUser(); // [!code ++]
- if (!user) return
Sign in to post
; // [!code ++]
-
- return ()
-}
-```
-
-Once a user is found, fetch that user's posts from the database:
-
-```tsx title="app/page.tsx" showLineNumbers
-import { currentUser } from "@clerk/nextjs/server"; // [!code ++]
-import prisma from "@/lib/prisma"; // [!code ++]
-import PostInputs from "@/app/components/PostInputs"; // [!code ++]
-
-export default async function Home() {
- const user = await currentUser();
- if (!user) return
Sign in to post
;
-
- const posts = await prisma.post.findMany({ // [!code ++]
- where: { author: { clerkId: user.id } }, // [!code ++]
- orderBy: { createdAt: "desc" }, // [!code ++]
- }); // [!code ++]
-
- return ()
-}
-```
-
-Finally, render the form and post list:
-
-```tsx title="app/page.tsx" showLineNumbers
-import { currentUser } from "@clerk/nextjs/server";
-import prisma from "@/lib/prisma";
-import PostInputs from "@/app/components/PostInputs";
-
-export default async function Home() {
- const user = await currentUser();
- if (!user) return
{" "}
- // [!code ++]
- // [!code ++]
- );
-}
-```
-
-You've successfully built a Next.js application with Clerk authentication and Prisma, creating a foundation for a secure and scalable full-stack application that handles user management and data persistence with ease.
-
-Below are some next steps to explore, as well as some more resources to help you get started expanding your project.
-
-## Next Steps
-
-- Add delete functionality to posts and users.
-- Add a search bar to filter posts.
-- Deploy to Vercel and set your production webhook URL in Clerk.
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-
-### More Info
-
-- [Prisma Docs](/v6/orm/overview/introduction/what-is-prisma)
-- [Next.js Docs](https://nextjs.org/docs)
-- [Clerk Docs](https://clerk.com/docs)
diff --git a/apps/docs/content/docs.v6/guides/cloudflare-d1.mdx b/apps/docs/content/docs.v6/guides/cloudflare-d1.mdx
deleted file mode 100644
index 0a947a8ede..0000000000
--- a/apps/docs/content/docs.v6/guides/cloudflare-d1.mdx
+++ /dev/null
@@ -1,318 +0,0 @@
----
-title: Cloudflare D1
-description: Learn how to use Prisma ORM with Cloudflare D1
-image: /img/guides/prisma-d1-setup-cover.png
-url: /v6/guides/cloudflare-d1
-metaTitle: How to use Prisma ORM with Cloudflare D1
-metaDescription: Learn how to use Prisma ORM with Cloudflare D1
----
-
-## Introduction
-
-This guide shows you how to use Prisma ORM with Cloudflare D1, a serverless SQL database that runs on Cloudflare's edge network. You'll learn how to set up Prisma ORM with D1, handle migrations, and deploy your application to Cloudflare Workers. You can find a [deployment-ready example on GitHub](https://github.com/prisma/prisma-examples/blob/latest/deployment-platforms/edge/cloudflare-workers/with-d1).
-
-## Prerequisites
-
-Before starting this guide, make sure you have:
-
-- A Cloudflare account
-- Node.js installed (version 20 or higher)
-- Wrangler CLI installed (version 3.39.0 or higher)
-- Basic familiarity with Cloudflare Workers and D1
-
-## 1. Create a new Cloudflare Worker and initialize Prisma ORM
-
-Run the following command to create a [new Cloudflare Worker project](https://developers.cloudflare.com/d1/get-started/#1-create-a-worker):
-
-```npm
-npm create cloudflare@latest d1-tutorial -- --type=hello-world --ts=true --git=true --deploy=false
-```
-
-Then navigate into the newly created directory:
-
-```bash
-cd d1-tutorial
-```
-
-And initialize Prisma ORM in the project:
-
-```npm
-npx prisma init --datasource-provider sqlite
-```
-
-And install the Prisma ORM CLI as a development dependency:
-
-```npm
-npm install --save-dev prisma
-```
-
-## 2. Configure Prisma schema
-
-In your Prisma schema, set the `provider` of the `datasource` to `sqlite`. If you just bootstrapped the Prisma schema with `prisma init`, also be sure to add the `runtime = "cloudflare"` to the generator block and the following `User` model:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
- runtime = "cloudflare"
-}
-
-datasource db {
- provider = "sqlite"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
-} // [!code ++]
-```
-
-## 3. Install dependencies
-
-Next, install the required packages:
-
-```npm
-npm install @prisma/client @prisma/adapter-d1 dotenv
-```
-
-Also, be sure to use a version of the Wrangler CLI that's above [`wrangler@^3.39.0`](https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%403.39.0), otherwise the `--remote` flag that's used in the next sections won't be available.
-
-## 4. Create a D1 database
-
-Run the following command to create a new D1 database:
-
-```npm
-npx wrangler@latest d1 create __YOUR_D1_DATABASE_NAME__
-```
-
-:::note
-
-The `__YOUR_D1_DATABASE_NAME__` is a placeholder that should be replaced with the name you want to give your D1 database. For example, you can use `prisma-d1-example`.
-
-:::
-
-This command will authenticate you with Cloudflare and ask you to select a Cloudflare account. After that, it will create a new D1 database and output the database ID and name:
-
-```bash
-✅ Successfully created DB '__YOUR_D1_DATABASE_NAME__' in region __REGION__
-Created your new D1 database.
-
-{
- "d1_databases": [
- {
- "binding": "DB",
- "database_name": "__YOUR_D1_DATABASE_NAME__",
- "database_id": ""
- }
- ]
-}
-```
-
-Copy the terminal output and add the content to your `wrangler.jsonc` file. This file is used to configure your Cloudflare Worker and its bindings.
-
-To connect your Workers with the D1 instance, add the following binding to your `wrangler.jsonc`:
-
-```json title="wrangler.jsonc"
-{
- "$schema": "node_modules/wrangler/config-schema.json",
- "name": "d1-tutorial",
- "main": "src/index.ts",
- "compatibility_date": "2025-08-05",
- "d1_databases": [
- {
- "binding": "DB",
- "database_name": "__YOUR_D1_DATABASE_NAME__", // to be replaced
- "database_id": "__YOUR_D1_DATABASE_ID__" // to be replaced
- }
- ]
-}
-```
-
-:::note
-
-The `__YOUR_D1_DATABASE_NAME__` and `__YOUR_D1_DATABASE_ID__` in the snippet above are placeholders that should be replaced with the database name and ID of your own D1 instance.
-
-If you weren't able to grab the database ID from the terminal output, you can also find it in the Cloudflare Dashboard or by running `npx wrangler d1 list` and `npx wrangler d1 info __YOUR_D1_DATABASE_NAME__` in your terminal.
-
-:::
-
-## 5. Set up database migrations
-
-For Cloudflare D1, you'll use Prisma's migration workflow combined with Wrangler CLI to manage your database schema. Since D1 is a serverless SQLite database, we'll use `prisma migrate diff` to generate migration SQL and then apply it using Wrangler.
-
-### 5.1 Set up environment variables
-
-Add a `.env` file in the root of your project with your local database URL:
-
-```bash title=".env"
-DATABASE_URL="file:./prisma/db.sqlite"
-```
-
-Also create a `prisma.config.ts` file in the root of your project:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 5.2 Generate migration SQL
-
-First, create a migrations directory inside the `prisma` folder and create a file named `0001_init.sql`:
-
-```bash
-mkdir -p prisma/migrations
-```
-
-Now use `prisma migrate diff` to generate the SQL needed to create your database schema:
-
-```npm
-npx prisma migrate diff \
- --from-empty \
- --to-schema prisma/schema.prisma \
- --script > prisma/migrations/0001_init.sql
-```
-
-This command generates a SQL file that contains the statements needed to create your database tables. You can inspect the generated SQL in `prisma/migrations/0001_init.sql`.
-
-### 5.3 Apply migrations to D1
-
-Now apply the migration to both your local and remote D1 databases using Wrangler:
-
-```npm
-# Apply to local database
-npx wrangler d1 execute __YOUR_D1_DATABASE_NAME__ --local --title="./prisma/migrations/0001_init.sql"
-
-# Apply to remote database
-npx wrangler d1 execute __YOUR_D1_DATABASE_NAME__ --remote --title="./prisma/migrations/0001_init.sql"
-```
-
-:::note
-
-Replace `__YOUR_D1_DATABASE_NAME__` with the actual name of your D1 database that you created in step 4.
-
-:::
-
-### 5.4 Add sample data
-
-Let's create some dummy data that we can query once the Worker is running:
-
-```npm
-# For the local database
-npx wrangler d1 execute __YOUR_D1_DATABASE_NAME__ --command "INSERT INTO \"User\" (\"email\", \"name\") VALUES ('jane@prisma.io', 'Jane Doe (Local)');" --local
-
-# For the remote database
-npx wrangler d1 execute __YOUR_D1_DATABASE_NAME__ --command "INSERT INTO \"User\" (\"email\", \"name\") VALUES ('jane@prisma.io', 'Jane Doe (Remote)');" --remote
-```
-
-:::info
-
-For future schema changes, you can generate new migration files using:
-
-```npm
-npx prisma migrate diff \
- --from-local-d1 \
- --to-schema prisma/schema.prisma \
- --script > migrations/0002_add_new_field.sql
-```
-
-Then apply them using the same `wrangler d1 execute` commands as shown above.
-
-:::
-
-## 6. Implement the Worker
-
-Before adding a Prisma Client query to your Worker, you need to generate Prisma Client with the following command:
-
-```npm
-npx prisma generate
-```
-
-In order to query your database from the Worker using Prisma ORM, you need to:
-
-1. Add the `DB` binding to the `Env` interface. This `DB` name matches the binding name you configured in `wrangler.jsonc`. (Alternatively, you can run [`npx wrangler types`](https://developers.cloudflare.com/workers/wrangler/commands/#types) to generate the `Env` type from the binding in a separate file called `worker-configuration.d.ts`.)
-2. Instantiate `PrismaClient` using the `PrismaD1` driver adapter, passing `env.DB` which accesses your D1 database binding.
-3. Send a query using Prisma Client and return the result.
-
-Open `src/index.ts` and replace the entire content with the following:
-
-```typescript title="src/index.ts"
-import { PrismaClient } from "./generated/prisma/client";
-import { PrismaD1 } from "@prisma/adapter-d1";
-
-export interface Env {
- DB: D1Database;
-}
-
-export default {
- async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise {
- const adapter = new PrismaD1(env.DB);
- const prisma = new PrismaClient({ adapter });
-
- const users = await prisma.user.findMany();
- const result = JSON.stringify(users);
- ctx.waitUntil(prisma.$disconnect()); // or just await prisma.$disconnect()
- return new Response(result);
- },
-};
-```
-
-We explicitly call `prisma.$disconnect()` here to guarantee timely release of resources or else the
-worker might run out of memory.
-
-## 7. Run the Worker locally
-
-With the database query in place and Prisma Client generated, you can run the Worker locally.
-
-If your Worker needs any environment variables, create a `.dev.vars` file in the root of your project. For this example, we don't need any additional environment variables since the D1 binding is already configured in `wrangler.jsonc`.
-
-Now run the Worker locally:
-
-```npm
-npm run dev
-```
-
-Now you can open your browser at [`http://localhost:8787`](http://localhost:8787/) to see the result of the database query:
-
-```js no-copy
-[{ id: 1, email: "jane@prisma.io", name: "Jane Doe (Local)" }];
-```
-
-## 8. Deploy the Worker
-
-To deploy the Worker, run the following command:
-
-```npm
-npm run deploy
-```
-
-Your deployed Worker is accessible via `https://d1-tutorial.USERNAME.workers.dev` (replace `USERNAME` with your Cloudflare account username). If you navigate your browser to that URL, you should see the following data that's queried from your remote D1 database:
-
-```js no-copy
-[{ id: 1, email: "jane@prisma.io", name: "Jane Doe (Remote)" }];
-```
-
-## Next steps
-
-Now that you've set up Prisma ORM with Cloudflare D1, you can:
-
-- Add more complex queries using Prisma's powerful query API
-- Set up Prisma Studio for database management
-- Implement database monitoring
-- Add automated tests
-
-For more information:
-
-- [Prisma ORM documentation](/v6/orm)
-- [Prisma Client API reference](/v6/orm/prisma-client/setup-and-configuration/introduction)
-- [Cloudflare D1 documentation](https://developers.cloudflare.com/d1)
diff --git a/apps/docs/content/docs.v6/guides/cloudflare-workers.mdx b/apps/docs/content/docs.v6/guides/cloudflare-workers.mdx
deleted file mode 100644
index 52b14c66fd..0000000000
--- a/apps/docs/content/docs.v6/guides/cloudflare-workers.mdx
+++ /dev/null
@@ -1,414 +0,0 @@
----
-title: Cloudflare Workers
-description: Learn how to use Prisma ORM in a Cloudflare Workers project
-image: /img/guides/prisma-cloudflare-workers-cover.png
-url: /v6/guides/cloudflare-workers
-metaTitle: How to use Prisma ORM and Prisma Postgres with Cloudflare Workers
-metaDescription: Learn how to use Prisma ORM in a Cloudflare Workers project
----
-
-## Introduction
-
-Prisma ORM provides type-safe database access, and [Cloudflare Workers](https://workers.cloudflare.com/) enables you to deploy serverless code at the edge. Together with [Prisma Postgres](https://www.prisma.io/postgres), you get a globally distributed backend with low-latency database access.
-
-In this guide, you'll learn to integrate Prisma ORM with a Prisma Postgres database in a Cloudflare Workers project. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/cloudflare-workers).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- A [Cloudflare account](https://dash.cloudflare.com/sign-up/workers-and-pages)
-
-## 1. Set up your project
-
-Create a new Cloudflare Workers project:
-
-```npm
-npm create cloudflare@latest prisma-cloudflare-worker -- --type=hello-world --ts=true --git=true --deploy=false
-```
-
-Navigate into the newly created project directory:
-
-```bash
-cd prisma-cloudflare-worker
-```
-
-## 2. Install and configure Prisma
-
-### 2.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma dotenv-cli @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My Cloudflare Workers Project"
-:::
-
-This will create:
-
-- A `prisma/` directory with a `schema.prisma` file
-- A `prisma.config.ts` file with your Prisma configuration
-- A `.env` file with a `DATABASE_URL` already set
-
-### 2.2. Enable Node.js compatibility in Cloudflare Workers
-
-Cloudflare Workers needs Node.js compatibility enabled to work with Prisma. Add the `nodejs_compat` compatibility flag to your `wrangler.jsonc`:
-
-```json title="wrangler.jsonc"
-{
- "name": "prisma-cloudflare-worker",
- "main": "src/index.ts",
- "compatibility_flags": ["nodejs_compat"], // [!code ++]
- "compatibility_date": "2024-01-01"
-}
-```
-
-### 2.3. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, add the following `User` model and set the runtime to `cloudflare`:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- runtime = "cloudflare" // [!code ++]
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String // [!code ++]
- name String // [!code ++]
-} // [!code ++]
-```
-
-:::note
-
-Both the `cloudflare` and `workerd` runtimes are supported. Read more about runtimes [here](/v6/orm/prisma-schema/overview/generators#field-reference).
-
-:::
-
-This creates a `User` model with an auto-incrementing ID, email, and name.
-
-### 2.4. Configure Prisma scripts
-
-Add the following scripts to your `package.json` to work with Prisma in the Cloudflare Workers environment:
-
-```json title="package.json"
-{
- "scripts": {
- "migrate": "prisma migrate dev", // [!code ++]
- "generate": "prisma generate", // [!code ++]
- "studio": "prisma studio" // [!code ++]
- // ... existing scripts
- }
-}
-```
-
-### 2.5. Run migrations and generate Prisma Client
-
-Now, run the following command to create the database tables:
-
-```npm
-npm run migrate
-```
-
-When prompted, name your migration (e.g., `init`).
-
-Then generate the Prisma Client:
-
-```npm
-npm run generate
-```
-
-This generates the Prisma Client in the `src/generated/prisma/client` directory.
-
-## 3. Integrate Prisma into Cloudflare Workers
-
-### 3.1. Import Prisma Client and configure types
-
-At the top of `src/index.ts`, import the generated Prisma Client and the PostgreSQL adapter, and define the `Env` interface for type-safe environment variables:
-
-```typescript title="src/index.ts"
-import { PrismaClient } from "./generated/prisma/client"; // [!code ++]
-import { PrismaPg } from "@prisma/adapter-pg"; // [!code ++]
-
-export interface Env {
- // [!code ++]
- DATABASE_URL: string; // [!code ++]
-} // [!code ++]
-
-export default {
- async fetch(request, env, ctx): Promise {
- return new Response("Hello World!");
- },
-} satisfies ExportedHandler;
-```
-
-### 3.2. Handle favicon requests
-
-Add a check to filter out favicon requests, which browsers automatically send and can clutter your logs:
-
-```typescript title="src/index.ts"
-import { PrismaClient } from "./generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-export interface Env {
- DATABASE_URL: string;
-}
-
-export default {
- async fetch(request, env, ctx): Promise {
- const path = new URL(request.url).pathname; // [!code ++]
- if (path === "/favicon.ico")
- // [!code ++]
- return new Response("Resource not found", {
- // [!code ++]
- status: 404, // [!code ++]
- headers: {
- // [!code ++]
- "Content-Type": "text/plain", // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
-
- return new Response("Hello World!");
- },
-} satisfies ExportedHandler;
-```
-
-### 3.3. Initialize the Prisma Client
-
-Create a database adapter and initialize Prisma Client with it. This must be done for each request in edge environments:
-
-```typescript title="src/index.ts"
-import { PrismaClient } from "./generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-export interface Env {
- DATABASE_URL: string;
-}
-
-export default {
- async fetch(request, env, ctx): Promise {
- const path = new URL(request.url).pathname;
- if (path === "/favicon.ico")
- return new Response("Resource not found", {
- status: 404,
- headers: {
- "Content-Type": "text/plain",
- },
- });
-
- const adapter = new PrismaPg({
- // [!code ++]
- connectionString: env.DATABASE_URL, // [!code ++]
- }); // [!code ++]
-
- const prisma = new PrismaClient({
- // [!code ++]
- adapter, // [!code ++]
- }); // [!code ++]
-
- return new Response("Hello World!");
- },
-} satisfies ExportedHandler;
-```
-
-:::warning
-
-In edge environments like Cloudflare Workers, you create a new Prisma Client instance per request. This is different from long-running Node.js servers where you typically instantiate a single client and reuse it.
-
-:::
-
-### 3.4. Create a user and query the database
-
-Now use Prisma Client to create a new user and count the total number of users:
-
-```typescript title="src/index.ts"
-import { PrismaClient } from "./generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-export interface Env {
- DATABASE_URL: string;
-}
-
-export default {
- async fetch(request, env, ctx): Promise {
- const path = new URL(request.url).pathname;
- if (path === "/favicon.ico")
- return new Response("Resource not found", {
- status: 404,
- headers: {
- "Content-Type": "text/plain",
- },
- });
-
- const adapter = new PrismaPg({
- connectionString: env.DATABASE_URL,
- });
-
- const prisma = new PrismaClient({
- adapter,
- });
-
- const user = await prisma.user.create({
- // [!code ++]
- data: {
- // [!code ++]
- email: `Prisma-Postgres-User-${Math.ceil(Math.random() * 1000)}@gmail.com`, // [!code ++]
- name: "Jon Doe", // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
-
- const userCount = await prisma.user.count(); // [!code ++]
-
- return new Response("Hello World!");
- },
-} satisfies ExportedHandler;
-```
-
-### 3.5. Return the results
-
-Finally, update the response to display the newly created user and the total user count:
-
-```typescript title="src/index.ts"
-import { PrismaClient } from "./generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-export interface Env {
- DATABASE_URL: string;
-}
-
-export default {
- async fetch(request, env, ctx): Promise {
- const path = new URL(request.url).pathname;
- if (path === "/favicon.ico")
- return new Response("Resource not found", {
- status: 404,
- headers: {
- "Content-Type": "text/plain",
- },
- });
-
- const adapter = new PrismaPg({
- connectionString: env.DATABASE_URL,
- });
-
- const prisma = new PrismaClient({
- adapter,
- });
-
- const user = await prisma.user.create({
- data: {
- email: `Prisma-Postgres-User-${Math.ceil(Math.random() * 1000)}@gmail.com`,
- name: "Jon Doe",
- },
- });
-
- const userCount = await prisma.user.count();
-
- //edit-start
- return new Response(`\
- Created new user: ${user.name} (${user.email}).
- Number of users in the database: ${userCount}.
- `);
- //edit-end
- },
-} satisfies ExportedHandler;
-```
-
-### 3.6. Test your Worker locally
-
-First, generate the TypeScript types for your Worker environment:
-
-```npm
-npx wrangler types --no-strict-vars
-```
-
-Then start the development server:
-
-```npm
-npm run dev
-```
-
-Open [`http://localhost:8787`](http://localhost:8787) in your browser. Each time you refresh the page, a new user will be created. You should see output similar to:
-
-```
-Created new user: Jon Doe (Prisma-Postgres-User-742@gmail.com).
-Number of users in the database: 5.
-```
-
-### 3.7. Inspect your data with Prisma Studio
-
-To view your database contents, open Prisma Studio:
-
-```npm
-npm run studio
-```
-
-This will open a browser window where you can view and edit your `User` table data.
-
-## 4. Deploy to Cloudflare Workers
-
-### 4.1. Set your database URL as a secret
-
-Before deploying, you need to set your `DATABASE_URL` as a secret in Cloudflare Workers. This keeps your database connection string secure in production.
-
-```npm
-npx wrangler secret put DATABASE_URL
-```
-
-When prompted, paste your database connection string from the `.env` file.
-
-### 4.2. Deploy your Worker
-
-Deploy your Worker to Cloudflare:
-
-```npm
-npm run deploy
-```
-
-Once deployed, Cloudflare will provide you with a URL where your Worker is live (e.g., `https://prisma-postgres-worker.your-subdomain.workers.dev`).
-
-Visit the URL in your browser, and you'll see your Worker creating users in production!
-
-## Summary
-
-You've successfully created a Cloudflare Workers application with Prisma ORM connected to a Prisma Postgres database. Your Worker is now running at the edge with low-latency database access.
-
-## Next steps
-
-Now that you have a working Cloudflare Workers app connected to a Prisma Postgres database, you can:
-
-- Add routes to handle different HTTP methods (GET, POST, PUT, DELETE)
-- Extend your Prisma schema with more models and relationships
-- Implement authentication and authorization
-- Use [Hono](https://hono.dev/) for a more robust routing framework with Cloudflare Workers (see our [Hono guide](/v6/guides/hono))
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-
-### More info
-
-- [Prisma Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)
-- [Deploy to Cloudflare](/v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare)
diff --git a/apps/docs/content/docs.v6/guides/data-dog.mdx b/apps/docs/content/docs.v6/guides/data-dog.mdx
deleted file mode 100644
index 75179a0d33..0000000000
--- a/apps/docs/content/docs.v6/guides/data-dog.mdx
+++ /dev/null
@@ -1,504 +0,0 @@
----
-title: Datadog
-description: 'Learn how to configure Datadog tracing for a Prisma ORM project. Capture spans for every query using the @prisma/instrumentation package, dd-trace, and view them in Datadog.'
-image: /img/guides/datadog-tracing-prisma.png
-url: /v6/guides/data-dog
-metaTitle: How to set up Datadog tracing with Prisma ORM and Prisma Postgres
-metaDescription: 'Learn how to configure Datadog tracing for a Prisma ORM project. Capture spans for every query using the @prisma/instrumentation package, dd-trace, and view them in Datadog.'
----
-
-## Introduction
-
-In this guide, you'll learn how to set up Datadog tracing for a new Prisma project. By combining the `@prisma/instrumentation` package with Prisma Client extensions, you can capture detailed spans for every database query. These spans are enriched with query metadata and sent to Datadog [using `dd-trace`](https://www.npmjs.com/package/dd-trace), Datadog's official APM library for Node.js, enabling you to monitor, analyze, and gain visibility into your application's database activity.
-
-### What are spans and tracing?
-
-- **Spans** are the individual operations or units of work within a distributed system or complex application. Each database query, service call, or external request is represented by a span.
-- **Tracing** ties these spans together to form a complete, end-to-end picture of a request’s lifecycle. With tracing, you can visualize bottlenecks, identify problematic queries, and pinpoint where errors occur from your queries.
-
-### Why use Datadog with Prisma ORM?
-
-[Datadog](https://www.datadoghq.com/) provides application performance monitoring (APM), metrics, logs, and dashboards to help you observe and debug production systems.
-
-While Prisma ORM abstracts away SQL and boosts developer productivity, it can obscure query performance without proper instrumentation. By integrating Datadog with Prisma using `@prisma/instrumentation` and [`dd-trace`](https://www.npmjs.com/package/dd-trace), you can automatically capture spans for every database query.
-
-This enables you to:
-
-- Measure latency per query.
-- Inspect query arguments and raw SQL.
-- Trace Prisma operations in the context of application-level requests.
-- Identify bottlenecks related to database access.
-
-This integration provides runtime visibility into Prisma queries with minimal effort, helping you catch slow queries and errors in real time.
-
-## Prerequisites
-
-Before you begin, ensure you have the following:
-
-- **Node.js** installed (v18+ recommended).
-- A local or hosted **PostgreSQL** database.
-- A **Datadog** account. If you do not have one, [sign up here](https://www.datadoghq.com/).
-- The **Datadog Agent** installed and running on your machine or server where this application will run. You can follow the [Datadog Agent installation docs](https://docs.datadoghq.com/agent/) to set it up.
-
-## 1. Create a new project
-
-We will start by creating a new Node.js project to demonstrate tracing with Datadog and Prisma ORM. This will be a minimal, standalone setup focused on running and tracing Prisma queries, to understand the instrumentation flow in isolation.
-
-If you're integrating tracing into an existing Prisma project, you can skip this step and directly follow from [the setup tracing section](#4-set-up-datadog-tracing). Just make sure you apply the changes in your project's equivalent folder structure.
-
-```npm
-mkdir prisma-datadog-tracing
-cd prisma-datadog-tracing
-npm init -y
-```
-
-In this setup, you'll:
-
-- Define a Prisma schema with basic models.
-- Connect to a Postgres database (Prisma Postgres or your own).
-- Configure Datadog tracing for all queries using `@prisma/instrumentation` and `dd-trace`.
-- Run a sample script that executes Prisma operations and sends spans to Datadog.
-
-## 2. Set up Prisma ORM
-
-In this section, you will install Prisma, create your schema, and generate the Prisma Client. This prepares your application to run database queries—queries that you will trace with Datadog.
-
-### 2.1. Install and initialize Prisma ORM
-
-Run the following commands to install Prisma and a minimal TypeScript runner:
-
-```npm
-npm install -D prisma tsx
-```
-
-Then initialize Prisma with the `--db` flag to create a [new Prisma Postgres](/v6/postgres) instance:
-
-```npm
-npx prisma init --db --output ../src/generated/prisma
-```
-
-:::note
-
-You will be prompted to name your database and select the closest region. For clarity, choose a memorable name (e.g., `My Datadog Project`).
-
-:::
-
-This command does the following:
-
-- Creates a `prisma` directory with a `schema.prisma` file.
-- Generates the Prisma Client in the `/src/generated/prisma` directory (as specified in the `--output` flag).
-- Creates a `.env` file at the project root with your database connection string (`DATABASE_URL`).
-
-The `.env` file should contain a standard connection string:
-
-```bash title=".env"
-# Placeholder url you have to replace
-DATABASE_URL="postgresql://janedoe:mypassword@localhost:5432/mydb?schema=sample"
-```
-
-Install the driver adapter for PostgreSQL:
-
-```npm
-npm i @prisma/adapter-pg pg
-```
-
-```npm
-npm i -D @types/pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-### 2.2. Define models
-
-Now, open `prisma/schema.prisma` and update your generator block and models. Replace the `generator` block with the following, and add a `User` and a `Post` model:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-```
-
-Create a `prisma.config.ts` file to configure Prisma:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config"; // [!code ++]
-
-export default defineConfig({
- // [!code ++]
- schema: "prisma/schema.prisma", // [!code ++]
- migrations: {
- // [!code ++]
- path: "prisma/migrations", // [!code ++]
- }, // [!code ++]
- datasource: {
- // [!code ++]
- url: env("DATABASE_URL"), // [!code ++]
- }, // [!code ++]
-}); // [!code ++]
-```
-
-:::note
-
-You'll need to install the `dotenv` package if you haven't already:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-### 2.3. Generate the Prisma Client and run migrations
-
-Generate the Prisma Client and apply your schema to your database:
-
-```npm
-npx prisma generate
-```
-
-```npm
-npx prisma migrate dev --name "init"
-```
-
-This creates the tables according to your schema in the Postgres database and generates a client for you to interact with the database.
-
-## 3. Install required dependencies for tracing
-
-In addition to Prisma, you will need the following packages for Datadog tracing:
-
-```npm
-npm install @prisma/instrumentation \
- dd-trace
-```
-
-Also ensure you have development dependencies for TypeScript:
-
-```npm
-npm install -D typescript
-```
-
-Here's a quick overview:
-
-- **`@prisma/instrumentation`**: Instruments Prisma queries so they appear as spans in your tracer.
-- **`dd-trace`**: Official Node.js tracing library from Datadog.
-
-## 4. Set up Datadog tracing
-
-Create a `tracer.ts` file in the `src` folder to instantiate your tracing logic:
-
-```bash
-touch src/tracer.ts
-```
-
-### 4.1. Configure the tracer
-
-Open `src/tracer.ts` and add the following code:
-
-```ts title="src/tracer.ts"
-import tracer from "dd-trace";
-
-tracer.init({
- profiling: true,
- logInjection: true,
- runtimeMetrics: true,
- dbmPropagationMode: "full",
- env: "dev",
- sampleRate: 1,
- service: "prisma-datadog-tracing",
- version: "1.0.0",
-});
-
-export { tracer };
-```
-
-#### Explanation
-
-- **`tracer.init`** configures `dd-trace` with a `service` name. This name appears in Datadog under your `APM` > `Services` list.
-- **`@prisma/instrumentation`** automatically logs each Prisma query as a Datadog span.
-
-## 5. Instantiate Prisma and run queries
-
-### 5.1. Create the Prisma Client instance
-
-Create a `src/client.ts` to hold your Prisma Client instantiation:
-
-```ts title="src/client.ts"
-import { tracer } from "./tracer";
-import { PrismaClient } from "./generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
- log: [{ emit: "event", level: "query" }],
-})
- .$on("query", (e) => {
- const span = tracer.startSpan(`prisma_raw_query`, {
- childOf: tracer.scope().active() || undefined,
- tags: {
- "prisma.rawquery": e.query,
- },
- });
- span.finish();
- })
- .$extends({
- query: {
- async $allOperations({ operation, model, args, query }) {
- const span = tracer.startSpan(`prisma_query_${model?.toLowerCase()}_${operation}`, {
- tags: {
- "prisma.operation": operation,
- "prisma.model": model,
- "prisma.args": JSON.stringify(args),
- "prisma.rawQuery": query,
- },
- childOf: tracer.scope().active() || undefined,
- });
-
- try {
- const result = await query(args);
- span.finish();
- return result;
- } catch (error) {
- span.setTag("error", error);
- span.finish();
- throw error;
- }
- },
- },
- });
-
-export { prisma };
-```
-
-The setup above gives you more control over how queries are traced:
-
-- Tracing is initialized as early as possible by importing the `tracer` before creating the Prisma Client.
-- The `$on("query")` hook captures raw SQL queries and sends them as standalone spans.
-- The `$allOperations` extension wraps all Prisma operations in custom spans, allowing you to tag them with metadata like the model, operation type, and arguments.
-
-Unlike the `@prisma/instrumentation` package, which offers automatic tracing out of the box, this manual setup gives you full control over how each span is structured and tagged. It's helpful when you need custom span names, additional metadata, a simpler setup, or when working around limitations or compatibility issues in the OpenTelemetry ecosystem. It also allows you to adapt tracing behavior based on query context, which can be especially useful in complex applications.
-
-### 5.2. Add a script that performs queries
-
-Create a `src/index.ts` file and add code to perform queries to your database and send traces to Datadog:
-
-```typescript title="src/index.ts"
-import { tracer } from "./tracer";
-import { PrismaInstrumentation, registerInstrumentations } from "@prisma/instrumentation";
-import { prisma } from "./client";
-
-const provider = new tracer.TracerProvider();
-
-registerInstrumentations({
- instrumentations: [new PrismaInstrumentation()],
- tracerProvider: provider,
-});
-
-provider.register();
-
-async function main() {
- const user1Email = `alice${Date.now()}@prisma.io`;
- const user2Email = `bob${Date.now()}@prisma.io`;
-
- let alice, bob;
-
- // 1. Create users concurrently
- try {
- [alice, bob] = await Promise.all([
- prisma.user.create({
- data: {
- email: user1Email,
- name: "Alice",
- posts: {
- create: {
- title: "Join the Prisma community on Discord",
- content: "https://pris.ly/discord",
- published: true,
- },
- },
- },
- include: { posts: true },
- }),
- prisma.user.create({
- data: {
- email: user2Email,
- name: "Bob",
- posts: {
- create: [
- {
- title: "Check out Prisma on YouTube",
- content: "https://pris.ly/youtube",
- published: true,
- },
- {
- title: "Follow Prisma on Twitter",
- content: "https://twitter.com/prisma/",
- published: false,
- },
- ],
- },
- },
- include: { posts: true },
- }),
- ]);
- console.log(
- `✅ Created users: ${alice.name} (${alice.posts.length} post) and ${bob.name} (${bob.posts.length} posts)`,
- );
- } catch (err) {
- console.error("❌ Error creating users:", err);
- return;
- }
-
- // 2. Fetch all published posts
- try {
- const publishedPosts = await prisma.post.findMany({
- where: { published: true },
- });
- console.log(`✅ Retrieved ${publishedPosts.length} published post(s).`);
- } catch (err) {
- console.error("❌ Error fetching published posts:", err);
- }
-
- // 3. Create & publish a post for Alice
- let post;
- try {
- post = await prisma.post.create({
- data: {
- title: "Join the Prisma Discord community",
- content: "https://pris.ly/discord",
- published: false,
- author: { connect: { email: user1Email } },
- },
- });
- console.log(`✅ Created draft post for Alice (ID: ${post.id})`);
- } catch (err) {
- console.error("❌ Error creating draft post for Alice:", err);
- return;
- }
-
- try {
- post = await prisma.post.update({
- where: { id: post.id },
- data: { published: true },
- });
- console.log("✅ Published Alice’s post:", post);
- } catch (err) {
- console.error("❌ Error publishing Alice's post:", err);
- }
-
- // 4. Fetch all posts by Alice
- try {
- const alicePosts = await prisma.post.findMany({
- where: { author: { email: user1Email } },
- });
- console.log(`✅ Retrieved ${alicePosts.length} post(s) by Alice.`, alicePosts);
- } catch (err) {
- console.error("❌ Error fetching Alice's posts:", err);
- }
-}
-
-// Entrypoint
-main()
- .catch((err) => {
- console.error("❌ Unexpected error:", err);
- process.exit(1);
- })
- .finally(async () => {
- await prisma.$disconnect();
- console.log("🔌 Disconnected from database.");
- });
-```
-
-:::note
-
-If you encounter a linting error on the line `tracerProvider: provider` due to incompatible types, it's likely caused by a version mismatch in the `@opentelemetry/api` package.
-
-To resolve this, add the following override to your package.json:
-
-```json
-"overrides": { // [!code ++]
- "@opentelemetry/api": "1.8.0" // [!code ++]
-} // [!code ++]
-```
-
-This is necessary because [`dd-trace` does not yet support version `1.9.0` or above of `@opentelemetry/api`](https://github.com/DataDog/dd-trace-js#datadog-with-opentelemetery).
-
-After updating the `package.json`, reinstall your dependencies:
-
-```npm
-npm i
-```
-
-This should resolve the linting error.
-
-:::
-
-## 6. Run your queries and see the traces
-
-Run the queries:
-
-```npm
-npx tsx src/index.ts
-```
-
-This executes your script, which:
-
-- Registers the Datadog tracer.
-- Performs multiple Prisma queries.
-- Logs the result of each operation.
-
-Then, confirm the traces in Datadog:
-
-- Open your [Datadog APM page](https://docs.datadoghq.com/tracing/).
-- Navigate to **APM > Traces > Explorer** in the side panel.
-- Explore the list of traces and spans, each representing a Prisma query (e.g. `prisma:query`).
-
-:::info
-Depending on your Datadog setup, it may take a minute or two for new data to appear. Refresh or wait briefly if you do not see traces right away.
-:::
-
-## Next steps
-
-You have successfully:
-
-- Created a Prisma ORM project with [Prisma Postgres](/v6/postgres).
-- Set up Datadog tracing using `@prisma/instrumentation` and `dd-trace`.
-- Verified that database operations show up as spans in Datadog.
-
-To improve your observability further:
-
-- Add more instrumentation for your HTTP server or other services (e.g., Express, Fastify).
-- [Create Dashboards to view](https://docs.datadoghq.com/dashboards/) key metrics from your data.
-
-For additional guidance, check out:
-
-- [Datadog APM documentation](https://docs.datadoghq.com/tracing/).
-- [Prisma tracing docs](/v6/orm/prisma-client/observability-and-logging/opentelemetry-tracing).
diff --git a/apps/docs/content/docs.v6/guides/data-migration.mdx b/apps/docs/content/docs.v6/guides/data-migration.mdx
deleted file mode 100644
index 911281d487..0000000000
--- a/apps/docs/content/docs.v6/guides/data-migration.mdx
+++ /dev/null
@@ -1,281 +0,0 @@
----
-title: Expand-and-contract migrations
-description: Learn how to perform data migrations using the expand and contract pattern with Prisma ORM
-image: /img/guides/data-migration-cover.png
-url: /v6/guides/data-migration
-metaTitle: How to migrate data with Prisma ORM using the expand and contract pattern
-metaDescription: Learn how to perform data migrations using the expand and contract pattern with Prisma ORM
----
-
-## Introduction
-
-When making changes to your database schema in production, it's crucial to ensure data consistency and avoid downtime. This guide shows you how to use the expand and contract pattern to safely migrate data between columns. We'll walk through a practical example of replacing a boolean field with an enum field while preserving existing data.
-
-## Prerequisites
-
-Before starting this guide, make sure you have:
-
-- Node.js installed (version 20 or higher)
-- A Prisma ORM project with an existing schema
-- A supported database (PostgreSQL, MySQL, SQLite, SQL Server, etc.)
-- Access to both development and production databases
-- Basic understanding of Git branching
-- Basic familiarity with TypeScript
-
-## 1. Set up your environment
-
-### 1.1. Review initial schema
-
-Start with a basic schema containing a Post model:
-
-```prisma
-generator client {
- provider = "prisma-client"
- output = "./generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean @default(false)
-}
-```
-
-### 1.2. Configure Prisma
-
-Create a `prisma.config.ts` file in the root of your project with the following content:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-You'll need to install the required packages. If you haven't already, install them using your package manager:
-
-```npm
-npm install prisma @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg dotenv
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-:::
-
-### 1.3. Create a development branch
-
-Create a new branch for your changes:
-
-```bash
-git checkout -b create-status-field
-```
-
-## 2. Expand the schema
-
-### 2.1. Add new column
-
-Update your schema to add the new Status enum and field:
-
-```prisma
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean? @default(false)
- status Status @default(Unknown)
-}
-
-enum Status {
- Unknown
- Draft
- InProgress
- InReview
- Published
-}
-```
-
-### 2.2. Create migration
-
-Generate the migration:
-
-```npm
-npx prisma migrate dev --name add-status-column
-```
-
-Then generate Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 3. Migrate the data
-
-### 3.1. Create migration script
-
-Create a new TypeScript file for the data migration:
-
-```typescript
-import { PrismaClient } from "../generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-import "dotenv/config";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-async function main() {
- await prisma.$transaction(async (tx) => {
- const posts = await tx.post.findMany();
- for (const post of posts) {
- await tx.post.update({
- where: { id: post.id },
- data: {
- status: post.published ? "Published" : "Unknown",
- },
- });
- }
- });
-}
-
-main()
- .catch(async (e) => {
- console.error(e);
- process.exit(1);
- })
- .finally(async () => await prisma.$disconnect());
-```
-
-### 3.2. Set up migration script
-
-Add the migration script to your package.json:
-
-```json
-{
- "scripts": {
- "data-migration:add-status-column": "tsx ./prisma/migrations//data-migration.ts"
- }
-}
-```
-
-### 3.3. Execute migration
-
-1. Update your DATABASE_URL to point to the production database
-2. Run the migration script:
-
-```npm
-npm run data-migration:add-status-column
-```
-
-## 4. Contract the schema
-
-### 4.1. Create cleanup branch
-
-Create a new branch for removing the old column:
-
-```bash
-git checkout -b drop-published-column
-```
-
-### 4.2. Remove old column
-
-Update your schema to remove the published field:
-
-```prisma
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- status Status @default(Unknown)
-}
-
-enum Status {
- Draft
- InProgress
- InReview
- Published
-}
-```
-
-### 4.3. Generate cleanup migration
-
-Create and run the final migration:
-
-```npm
-npx prisma migrate dev --name drop-published-column
-```
-
-Then generate Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-## 5. Deploy to production
-
-### 5.1. Set up deployment
-
-Add the following command to your CI/CD pipeline:
-
-```npm
-npx prisma migrate deploy
-```
-
-### 5.2. Monitor deployment
-
-Watch for any errors in your logs and monitor your application's behavior after deployment.
-
-## Troubleshooting
-
-### Common issues and solutions
-
-1. **Migration fails due to missing default**
- - Ensure you've added a proper default value
- - Check that all existing records can be migrated
-
-2. **Data loss prevention**
- - Always backup your database before running migrations
- - Test migrations on a copy of production data first
-
-3. **Transaction rollback**
- - If the data migration fails, the transaction will automatically rollback
- - Fix any errors and retry the migration
-
-## Next steps
-
-Now that you've completed your first expand and contract migration, you can:
-
-- Learn more about [Prisma Migrate](/v6/orm/prisma-migrate/getting-started)
-- Explore [schema prototyping](/v6/orm/prisma-migrate/workflows/prototyping-your-schema)
-- Understand [customizing migrations](/v6/orm/prisma-migrate/workflows/customizing-migrations)
-
-For more information:
-
-- [Expand and Contract Pattern Documentation](https://www.prisma.io/dataguide/types/relational/expand-and-contract-pattern)
-- [Prisma Migrate Workflows](/v6/orm/prisma-migrate/workflows/development-and-production)
diff --git a/apps/docs/content/docs.v6/guides/deno-integration.mdx b/apps/docs/content/docs.v6/guides/deno-integration.mdx
deleted file mode 100644
index 2fded95a86..0000000000
--- a/apps/docs/content/docs.v6/guides/deno-integration.mdx
+++ /dev/null
@@ -1,274 +0,0 @@
----
-title: Prisma Postgres on Deno
-description: Learn how to integrate Prisma Postgres in a Deno Deploy project using a simple Deno application.
-image: /img/guides/prisma-deno-integration-cover.png
-url: /v6/guides/deno-integration
-metaTitle: Integrate Prisma Postgres with Deno Deploy
-metaDescription: Learn how to integrate Prisma Postgres in a Deno Deploy project using a simple Deno application.
----
-
-[Deno Deploy](https://deno.com/deploy) includes a feature that allows you to provision a Prisma Postgres database directly within the platform. This guide demonstrates how to integrate Prisma Postgres in a Deno Deploy project using a minimal Deno application that logs HTTP requests to the database.
-
-By the end of this guide, you will have a deployed Deno app that writes to and reads from a Prisma Postgres database provisioned in Deno Deploy, using Prisma Client with `runtime = "deno"`.
-
-## Prerequisites
-
-- A [Deno Deploy](https://deno.com/deploy) account
-- Deno runtime installed ([installation guide](https://docs.deno.com/runtime/#install-deno))
-- [Deno extension for VS Code](https://docs.deno.com/runtime/reference/vscode/)
-
-## 1. Create and set up a new Deno project
-
-Create a new Deno project using the `deno init` command, which generates a basic project structure with a main entry file and configuration.
-
-```bash
-deno init prisma-postgres-deno-deploy
-cd prisma-postgres-deno-deploy
-```
-
-### 1.1 Configure VS Code for Deno
-
-To ensure VS Code recognizes this as a Deno project and provides proper TypeScript validation, you need to initialize the workspace. Without this, VS Code will show errors when using Deno-specific APIs like `Deno.serve`.
-
-Install the [Deno extension for VS Code](https://docs.deno.com/runtime/reference/vscode/), then:
-
-1. Select **View** > **Command Palette** _(or press `Cmd+Shift+P` on macOS or `Ctrl+Shift+P` on Windows)_
-2. Run the command **Deno: Initialize Workspace Configuration**
-
-### 1.2 Create a basic HTTP server
-
-Update the `main.ts` file to create a simple HTTP server that responds with "Hello, World!", establishing the foundation for your application before adding database functionality.
-
-```tsx title="main.ts"
-function handler(_req: Request): Response {
- return new Response("Hello, World!");
-}
-
-Deno.serve(handler);
-```
-
-You can test the server locally by running:
-
-```bash
-deno run dev
-```
-
-Visit `localhost:8000` in your browser to see the application running.
-
-### 1.3 Push initial project to GitHub
-
-To connect your project to Deno Deploy and get a database connection string, you need to have a successful deployment. Set up a GitHub repository and push your project to it.
-
-## 2. Deploy the project to Deno Deploy
-
-Deploy your repository to Deno Deploy. Any subsequent commits will trigger automatic redeployments. You need to deploy now, as the database string requires a successful deployment to generate.
-
-1. Navigate to the [Deno Deploy dashboard](https://dash.deno.com/) and select **New App**
-2. Configure GitHub app permissions by following GitHub's prompts
-3. Choose your GitHub repository in the Deno Deploy interface
-4. Click **Create App** to complete the deployment
-
-The application will deploy automatically.
-
-## 3. Provision a Prisma Postgres database
-
-Provision a Prisma Postgres database in Deno Deploy, and link it to your application:
-
-1. Go to the **Databases** section in the Deno Deploy dashboard
-2. Select **Provision Database** and choose **Prisma Postgres**
-3. Complete the database configuration and confirm provisioning
-4. Click **Assign** and select your application
-5. Copy the **Production connection string**
-6. Add the connection string to your `.env` file:
-
-```text
-DATABASE_URL="postgresql://:@db.prisma.io:5432/-production"
-```
-
-## 4. Configure Prisma ORM
-
-### 4.1 Enable environment variables
-
-To access the database connection string during local development, configure Deno to load environment variables from your `.env` file using the `--env-file` flag.
-
-Update the `dev` task in `deno.json`:
-
-```json title="deno.json"
-{
- "tasks": {
- "dev": "deno run --watch --env-file main.ts" // [!code highlight]
- }
-}
-```
-
-### 4.2 Initialize Prisma and create schema
-
-Install the Prisma Client, PostgreSQL adapter, and development dependencies:
-
-```bash
-deno install npm:@prisma/client npm:@prisma/adapter-pg npm:pg npm:prisma npm:@types/pg
-```
-
-Initialize Prisma in your project, which creates the necessary configuration files and folder structure for defining your database models.
-
-```npm
-npx prisma init
-```
-
-Update the Prisma schema with these changes:
-
-1. Change the client output from `prisma-client-js` to `prisma-client`.
-2. Add the Deno runtime configuration. _(This is required for Deno to run properly)_
-3. Add the Log model for storing request information.
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client" // [!code highlight]
- output = "../generated/prisma"
- runtime = "deno" // [!code ++]
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model Log { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- level Level // [!code ++]
- message String // [!code ++]
- meta Json // [!code ++]
-} // [!code ++]
-
-enum Level { // [!code ++]
- Info // [!code ++]
- Warn // [!code ++]
- Error // [!code ++]
-} // [!code ++]
-```
-
-### 4.3 Generate and apply migrations
-
-Migrations create the actual database tables based on your Prisma schema. This command generates SQL migration files and executes them against your database, creating the `Log` table with the specified fields.
-
-```bash
-deno run -A npm:prisma migrate dev --name init
-deno run -A npm:prisma generate
-```
-
-## 5. Update the application to use Prisma
-
-Now that the database is configured, update your application to interact with it. This implementation creates a logging system that captures every HTTP request, stores it in the database, and returns the logged entry as JSON.
-
-```tsx title="main.ts"
-import { PrismaClient } from "./generated/prisma/client.ts";
-import { PrismaPg } from "npm:@prisma/adapter-pg";
-import process from "node:process";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-async function handler(request: Request) {
- const url = new URL(request.url);
- if (url.pathname === "/favicon.ico") {
- return new Response(null, { status: 204 });
- }
-
- const log = await prisma.log.create({
- data: {
- level: "Info",
- message: `${request.method} ${request.url}`,
- meta: {
- headers: JSON.stringify(request.headers),
- },
- },
- });
- const body = JSON.stringify(log, null, 2);
- return new Response(body, {
- headers: { "content-type": "application/json; charset=utf-8" },
- });
-}
-
-Deno.serve(handler);
-```
-
-Test the application locally by running:
-
-```bash
-deno run dev
-```
-
-:::note
-
-It may ask you for access to your environment variables. Select **Allow** to grant access.
-
-:::
-
-Visit `localhost:8000` in your browser to see the application running. You should see a JSON response containing the log entry:
-
-```json
-{
- "id": 1,
- "level": "Info",
- "message": "GET http://localhost:8000/",
- "meta": {
- "headers": "..."
- }
-}
-```
-
-## 6. Deploy the application
-
-The build command must generate the Prisma Client code to ensure it is available in production.
-
-### 6.1 Update build command in Deno Deploy
-
-1. Go to the application in Deno Deploy and click **Settings**
-2. Under **Build configuration**, hit **Edit** and add `deno run -A npm:prisma generate` to the build command
-3. Click **Save**
-
-### 6.2 Push changes to GitHub
-
-Commit and push your changes to trigger an automatic deployment:
-
-```bash
-git add .
-git commit -m "added prisma"
-git push
-```
-
-Navigate back to Deno Deploy and you should see a successful build. Once deployed, click the deployment URL at the top right of the dashboard.
-
-### 6.3 Verify the deployment
-
-When you visit your deployed application, you should see a response that looks like this:
-
-```json
-{
- "id": 1,
- "level": "Info",
- "message": "GET https://prisma-postgres-deno-deploy..deno.net/",
- "meta": {
- "headers": "{}"
- }
-}
-```
-
-You're done! Each time you refresh the page, a new log entry is created in your database.
-
-## Next Steps
-
-Now that you have a working Deno app connected to a Prisma Postgres database, you can:
-
-- **Enhance your data model** - Add relationships, validations, and indexes to your Prisma schema
-- **Secure your API** - Implement authentication, rate limiting, and proper error handling
-- **Improve deployment** - Set up CI/CD, monitoring, and database backups for production
-
-## More info
-
-- [Prisma ORM Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Deno Deploy Documentation](https://docs.deno.com/deploy)
diff --git a/apps/docs/content/docs.v6/guides/docker.mdx b/apps/docs/content/docs.v6/guides/docker.mdx
deleted file mode 100644
index 091adfae6d..0000000000
--- a/apps/docs/content/docs.v6/guides/docker.mdx
+++ /dev/null
@@ -1,563 +0,0 @@
----
-title: Docker
-description: Learn step-by-step configure a Prisma ORM app in Docker
-image: /img/guides/prisma-orm-docker.png
-url: /v6/guides/docker
-metaTitle: How to use Prisma in Docker
-metaDescription: Learn step-by-step configure a Prisma ORM app in Docker
----
-
-
-Questions answered in this page
-
-- How to run Prisma in Docker containers?
-- How to configure Docker Compose with Prisma?
-- How to handle migrations in Docker?
-
-
-
-This guide walks you through setting up a Prisma ORM application within a Docker environment. You'll learn how to configure a Node.js project, integrate Prisma for database management, and orchestrate the application using Docker Compose. By the end, you'll have a fully functional Prisma application running in a Docker container.
-
-## Prerequisites
-
-- [Docker](https://docs.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) installed
-- Node.js version: A [compatible Node.js version](/v6/orm/more/upgrades/to-v7#minimum-supported-nodejs--typescript-versions), required for Prisma 6.
-
-:::warning
-
-Prisma 7.0.0 has updated minimum Node.js requirements:
-
-- Node.js 20: >= 20.19.0
-- Node.js 22: >= 22.12.0
-- Node.js 24: >= 24.0.0+
-
-If you're using Prisma 7.0.0 or higher with Docker, ensure your application's Docker base image uses Node.js 22 or 24. Update your Dockerfile to use `node:22-alpine` or `node:24-alpine` instead of older Node.js 20 images.
-
-:::
-
-Before starting, ensure that no PostgreSQL services are running locally, and that the following ports are free to avoid conflicts: `5432` (PostgreSQL), `3000` (application server) or `5555` (Prisma Studio server).
-
-To stop existing PostgreSQL services, use:
-
-```bash
-sudo systemctl stop postgresql # Linux
-brew services stop postgresql # macOS
-net stop postgresql # Windows (Run as Administrator)
-```
-
-To stop all running Docker containers and free up ports:
-
-```bash
-docker ps -q | xargs docker stop
-```
-
-## 1. Set up your Node.js and Prisma application
-
-Let's start by creating a simple Node.js application with Prisma ORM and [Express.js](https://expressjs.com/).
-
-### 1.1. Initialize your project
-
-First, create a new project directory and initialize a Node.js project:
-
-```npm
-mkdir docker-test
-cd docker-test
-npm init -y
-```
-
-This will generate a `package.json` file:
-
-```json title="package.json"
-{
- "name": "docker-test",
- "version": "1.0.0",
- "description": "",
- "main": "index.js",
- "scripts": {},
- "keywords": [],
- "author": "",
- "license": "ISC"
-}
-```
-
-### 1.2. Install required dependencies
-
-Next, install the Prisma CLI as a development dependency and Express.js for the server:
-
-```npm
-npm install prisma @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg dotenv express
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-### 1.3. Set up Prisma ORM
-
-Now, initialize Prisma to generate the necessary files:
-
-```npm
-npx prisma init --output ../generated/prisma
-```
-
-This creates:
-
-- A `prisma` folder containing `schema.prisma`, where you will define your database schema.
-- An `.env` file in the project root, which stores environment variables.
-
-Add a `User` model to the `schema.prisma` file located in the `prisma/schema.prisma` folder:
-
-```prisma title="prisma/schema.prisma"
-datasource db {
- provider = "postgresql"
-}
-
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma_client" // [!code ++]
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- createdAt DateTime @default(now()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
-} // [!code ++]
-```
-
-:::note
-
-In the `schema.prisma` file, we specify a [custom `output` path](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path) where Prisma will generate its types. This ensures Prisma's types are resolved correctly across different package managers and can be accessed by application consistently inside the container without any permission issues. In this guide, the types will be generated in the `./generated/prisma_client` directory.
-
-:::
-
-Now, create a `prisma.config.ts` file in the root of your project:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-You'll need to install the `dotenv` package to load environment variables:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-### 1.4. Create an Express.js server
-
-With the Prisma schema in place, let's create an Express.js server to interact with the database. Start by creating an `index.js` file:
-
-```bash
-touch index.js
-```
-
-Add the following code to set up a basic Express server:
-
-```js title="index.js"
-const express = require("express"); // [!code ++]
-const { PrismaClient } = require("./generated/prisma_client/client"); // [!code ++]
-const { PrismaPg } = require("@prisma/adapter-pg"); // [!code ++]
-
-const adapter = new PrismaPg({
- // [!code ++]
- connectionString: process.env.DATABASE_URL, // [!code ++]
-}); // [!code ++]
-
-const app = express(); // [!code ++]
-const prisma = new PrismaClient({
- // [!code ++]
- adapter, // [!code ++]
-}); // [!code ++]
-app.use(express.json()); // [!code ++]
-
-// Get all users // [!code ++]
-app.get("/", async (req, res) => {
- // [!code ++]
- const userCount = await prisma.user.count(); // [!code ++]
- res.json(
- // [!code ++]
- userCount == 0 // [!code ++]
- ? "No users have been added yet." // [!code ++]
- : "Some users have been added to the database.", // [!code ++]
- ); // [!code ++]
-}); // [!code ++]
-
-const PORT = 3000; // [!code ++]
-
-app.listen(PORT, () => {
- // [!code ++]
- console.log(`Server is running on http://localhost:${PORT}`); // [!code ++]
-}); // [!code ++]
-```
-
-Update the `package.json` scripts to include commands for running the server and deploying migrations:
-
-```json title="package.json"
-"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1", // [!code --]
- "dev": "node index.js", // [!code ++]
- "db:deploy": "npx prisma migrate deploy && npx prisma generate" // [!code ++]
-}
-```
-
-Now that the application is set up, let's move on to configuring a PostgreSQL database using Docker Compose.
-
-## 2. Set up a PostgreSQL database with Docker Compose
-
-To perform database migrations, we'll create a standalone PostgreSQL database using Docker Compose.
-
-### 2.1. Create a Docker Compose file for PostgreSQL
-
-Create a `docker-compose.postgres.yml` file in the root directory:
-
-```yml title="docker-compose.postgres.yml"
-version: "3.7" # [!code ++]
-
-services: # [!code ++]
- postgres: # [!code ++]
- image: postgres:15 # [!code ++]
- restart: always # [!code ++]
- environment: # [!code ++]
- - POSTGRES_DB=postgres # [!code ++]
- - POSTGRES_USER=postgres # [!code ++]
- - POSTGRES_PASSWORD=prisma # [!code ++]
- ports: # [!code ++]
- - "5432:5432" # [!code ++]
- networks: # [!code ++]
- - prisma-network # [!code ++]
- healthcheck: # [!code ++]
- test: ["CMD-SHELL", "pg_isready -U prisma -d postgres"] # [!code ++]
- interval: 5s # [!code ++]
- timeout: 2s # [!code ++]
- retries: 20 # [!code ++]
- volumes: # [!code ++]
- - postgres_data:/var/lib/postgresql/data # [!code ++]
- command: postgres -c listen_addresses='*' # [!code ++]
- logging: # [!code ++]
- options: # [!code ++]
- max-size: "10m" # [!code ++]
- max-file: "3" # [!code ++]
-
-networks: # [!code ++]
- prisma-network: # [!code ++]
-
-volumes: # [!code ++]
- postgres_data: # [!code ++]
-```
-
-### 2.2. Start the PostgreSQL container
-
-Run the following command to start the database:
-
-```bash
-docker compose -f docker-compose.postgres.yml up -d
-```
-
-### 2.3. Perform database migrations
-
-With the database running, update the `.env` file with the following database connection url:
-
-```bash title=".env"
-DATABASE_URL="postgresql://postgres:prisma@localhost:5432/postgres?schema=public" # [!code highlight]
-```
-
-Run the migration to create the database schema:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-Then generate Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-This should generate a `migrations` folder in the `prisma` folder and the Prisma Client in the `generated/prisma_client` directory.
-
-### 2.4. Test the application
-
-Start the server and verify it works:
-
-```npm
-npm run dev
-```
-
-Visit [`http://localhost:3000`](http://localhost:3000) to see the message:
-
-```bash
-No users have been added yet.
-```
-
-Stop the local server.
-
-### 2.5. Clean up the standalone database
-
-Once testing is complete, remove the standalone PostgreSQL container:
-
-```bash
-docker compose -f docker-compose.postgres.yml down --remove-orphans
-```
-
-This command will:
-
-- Stop running containers.
-- Remove containers.
-- Remove the default network created by Docker Compose.
-- Remove associated volumes (if not named explicitly).
-
-Now that we've tested the application locally, let's containerize it using Docker.
-
-## 3. Run the app and database together with Docker Compose
-
-We'll now containerize the application using Docker, ensuring it can run in any environment.
-
-To do that create a `Dockerfile` in project root:
-
-```bash
-touch Dockerfile
-```
-
-For the next step, you'll need to choose between two options for the base image: `node:alpine` (lightweight) or `node:slim` (stable). Both options are fully supported by Prisma ORM, but may have to be configured differently.
-
-### 3.1. Option 1: Use Linux Alpine (`node:alpine`) as a base image
-
-The node:alpine image is based on Alpine Linux, a lightweight Linux distribution that uses the `musl` C standard library. It's perfect if you want to keep your container small and efficient. Prisma supports Alpine on `amd64` out of the box, and supports it on `arm64` since `prisma@4.10.0`.
-
-Add the following content to the `Dockerfile`:
-
-```shell title="Dockerfile"
-FROM node:lts-alpine3.17
-
-WORKDIR /usr/src/app
-
-COPY package.json package-lock.json ./
-
-RUN npm ci
-
-COPY . .
-
-CMD ["sh", "-c", "npm run db:deploy && npm run dev"]
-```
-
-:::note
-
-When running on Linux Alpine, Prisma downloads engines that are compiled for the `musl` C standard library. Please don't install `glibc` on Alpine (e.g., via the `libc6-compat` package), as that would prevent Prisma from running successfully.
-
-:::
-
-Related Docker images:
-
-- `node:lts-alpine`
-- `node:16-alpine`
-- `node:14-alpine`
-
-### 3.1. Option 2: Use Linux Debian (`node:slim`) as a base image
-
-The `node:slim` image is based on Linux Debian, a stable and widely supported distribution that uses the `glibc` C standard library. It is mostly supported out of the box on `amd64` and `arm64`, making it a good choice if you're running into compatibility issues with Alpine or need a more production-ready environment. However, some older versions of this image may come without `libssl` installed, so it's sometimes necessary to install it manually.
-
-Add the following content to the `Dockerfile`:
-
-```shell title="Dockerfile"
-FROM node:slim
-
-RUN apt-get update -y \
-&& apt-get install -y openssl
-
-WORKDIR /usr/src/app
-
-COPY package.json package-lock.json ./
-
-RUN npm ci
-
-COPY . .
-
-CMD ["sh", "-c", "npm run db:deploy && npm run dev"]
-```
-
-Related Docker images:
-
-- `node:lts-slim`
-- `node:bullseye-slim`
-- `node:buster-slim`
-- `node:stretch-slim`
-
-### 3.2. Create and configure a Docker Compose file
-
-Now that the `Dockerfile` is ready, we'll use Docker Compose to manage both the app and the database together. This makes it easy to start, stop, and manage the entire setup.
-
-Create a `docker-compose.yml` file in your project folder:
-
-```bash
-touch docker-compose.yml
-```
-
-Add the following configuration to the file:
-
-```yml title="docker-compose.yml"
-version: "3.7" # [!code ++]
-
-services: # [!code ++]
- postgres_db: # [!code ++]
- image: postgres:15 # [!code ++]
- hostname: postgres_db # [!code ++]
- container_name: postgres_db # [!code ++]
- restart: always # [!code ++]
- environment: # [!code ++]
- POSTGRES_DB: postgres # [!code ++]
- POSTGRES_USER: postgres # [!code ++]
- POSTGRES_PASSWORD: prisma # [!code ++]
- ports: # [!code ++]
- - "5432:5432" # [!code ++]
- networks: # [!code ++]
- - prisma-network # [!code ++]
- healthcheck: # [!code ++]
- test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"] # [!code ++]
- interval: 5s # [!code ++]
- timeout: 2s # [!code ++]
- retries: 20 # [!code ++]
-
- server: # [!code ++]
- build: # [!code ++]
- context: . # [!code ++]
- dockerfile: Dockerfile # [!code ++]
- ports: # [!code ++]
- - "3000:3000" # [!code ++]
- stdin_open: true # [!code ++]
- tty: true # Keeps the container running for debugging # [!code ++]
- depends_on: # [!code ++]
- postgres_db: # [!code ++]
- condition: service_healthy # [!code ++]
- env_file: # [!code ++]
- - .env.prod # [!code ++]
- networks: # [!code ++]
- - prisma-network # [!code ++]
-networks: # [!code ++]
- prisma-network: # [!code ++]
- name: prisma-network # [!code ++]
-```
-
-### 3.3. Configure environment variable for the container
-
-Before running the app, we need to configure the environment variables. Create a `.env.prod` file:
-
-```
-touch .env.prod
-```
-
-Add the following database connection url to the `.env.prod` file:
-
-```bash title=".env.prod"
-DATABASE_URL="postgresql://postgres:prisma@postgres_db:5432/postgres?schema=public" # [!code highlight]
-```
-
-### 3.4. Build and run the application
-
-With everything set up, it's time to build and run the app using Docker Compose. Run the following command:
-
-```bash
-docker compose -f docker-compose.yml up --build -d
-```
-
-Visit `http://localhost:3000` to see your app running with the message:
-
-```bash
-No users have been added yet.
-```
-
-### 3.5. Bonus: Add Prisma Studio for database management
-
-[Prisma Studio](/v6/orm/tools/prisma-studio) offers a graphical user interface (GUI) that allows you to view and manage your database directly in the browser. It's a great tool for debugging and managing your data during development.
-
-To add Prisma Studio to your Docker setup, update the `docker-compose.yml` file:
-
-```yml title="docker.compose.yml"
-version: "3.7"
-
-services:
- postgres_db:
- image: postgres:15
- hostname: postgres_db
- container_name: postgres_db
- restart: always
- environment:
- POSTGRES_DB: postgres
- POSTGRES_USER: postgres
- POSTGRES_PASSWORD: prisma
- ports:
- - "5432:5432"
- networks:
- - prisma-network
- healthcheck:
- test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
- interval: 5s
- timeout: 2s
- retries: 20
-
- server:
- build:
- context: .
- dockerfile: Dockerfile
- ports:
- - "3000:3000"
- stdin_open: true
- tty: true # Keeps the container running for debugging
- depends_on:
- postgres_db:
- condition: service_healthy
- env_file:
- - .env.prod
- networks:
- - prisma-network
- prisma-studio: # [!code ++]
- image: node:lts-alpine3.17 # [!code ++]
- working_dir: /usr/src/app # [!code ++]
- volumes: # [!code ++]
- - .:/usr/src/app # [!code ++]
- command: npx prisma studio --port 5555 --browser none # [!code ++]
- ports: # [!code ++]
- - "5555:5555" # [!code ++]
- env_file: # [!code ++]
- - .env.prod # [!code ++]
- networks: # [!code ++]
- - prisma-network # [!code ++]
- depends_on: # [!code ++]
- postgres_db: # [!code ++]
- condition: service_healthy # [!code ++]
- server: # [!code ++]
- condition: service_started # [!code ++]
-networks:
- prisma-network:
- name: prisma-network
-```
-
-This will start Prisma Studio at [`http://localhost:5555`](http://localhost:5555) alongside the main app at [`http://localhost:3000`](http://localhost:3000). You can use Prisma Studio to manage your database with a GUI.
-
-Run the following command to start everything:
-
-```bash
-docker compose -f docker-compose.yml up --build -d
-```
-
-By following this guide, you've successfully containerized your Prisma app and database using Docker Compose.
diff --git a/apps/docs/content/docs.v6/guides/elysia.mdx b/apps/docs/content/docs.v6/guides/elysia.mdx
deleted file mode 100644
index 4b7c718501..0000000000
--- a/apps/docs/content/docs.v6/guides/elysia.mdx
+++ /dev/null
@@ -1,444 +0,0 @@
----
-title: Elysia
-description: Learn how to use Prisma ORM in an Elysia app
-image: /img/guides/prisma-elysia-cover.png
-url: /v6/guides/elysia
-metaTitle: How to use Prisma ORM and Prisma Postgres with Elysia
-metaDescription: Learn how to use Prisma ORM in an Elysia app
----
-
-## Introduction
-
-[Elysia](https://elysiajs.com/) is an ergonomic web framework for building high-performance backend servers with Bun. It offers end-to-end type safety, an expressive API, and exceptional performance. Combined with Prisma ORM and [Prisma Postgres](https://www.prisma.io/postgres), you get a fast, type-safe backend stack.
-
-In this guide, you'll learn to integrate Prisma ORM with a Prisma Postgres database in an Elysia application. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/elysia).
-
-## Prerequisites
-
-- [Bun](https://bun.sh/docs/installation) installed on your system
-
-## 1. Set up your project
-
-Create a new Elysia project using the Bun scaffolding command:
-
-```bash
-bun create elysia elysia-prisma
-```
-
-Navigate to the project directory:
-
-```bash
-cd elysia-prisma
-```
-
-## 2. Install and configure Prisma
-
-### 2.1. Install dependencies
-
-Install the required Prisma packages, database adapter, and Prismabox (for generated TypeBox schemas):
-
-```bash
-bun add -d prisma bun-types
-bun add @prisma/client @prisma/adapter-pg pg prismabox
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```bash
-bunx --bun prisma init --db --output ../src/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My Elysia Project"
-:::
-
-This will create:
-
-- A `prisma/` directory with a `schema.prisma` file
-- A `prisma.config.ts` file for configuring Prisma
-- A `.env` file with a `DATABASE_URL` already set
-
-### 2.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, mirror the example app structure with Prismabox TypeBox generators and a `Todo` model:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-generator prismabox {
- provider = "prismabox"
- typeboxImportDependencyName = "elysia"
- typeboxImportVariableName = "t"
- inputModel = true
- output = "../src/generated/prismabox"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model Todo { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- completed Boolean @default(false) // [!code ++]
- createdAt DateTime @default(now()) // [!code ++]
- updatedAt DateTime @updatedAt // [!code ++]
-} // [!code ++]
-```
-
-This matches the Prisma Elysia example: it generates Prisma Client to `src/generated/prisma` and Prismabox TypeBox schemas to `src/generated/prismabox`.
-
-#### What is Prismabox?
-
-- A Prisma generator that reads your Prisma schema and emits Elysia-friendly TypeBox models.
-- Generates files like `src/generated/prismabox/Todo.ts` (and one per model) with `TodoPlain`, `TodoPlainInputCreate`, etc.
-- Use those generated models in routes to validate requests/responses and keep Elysia types in sync with your Prisma schema (also useful for OpenAPI/Eden).
-
-### 2.3. Run migrations and generate Prisma Client
-
-Run the following commands to create the database tables and generate the Prisma Client:
-
-```bash
-bunx --bun prisma migrate dev --name init
-bunx --bun prisma generate
-```
-
-### 2.4. Seed the database
-
-Add some seed data to populate the database with sample todos (mirrors the example repo).
-
-Create a new file called `seed.ts` in the `prisma/` directory:
-
-```typescript title="prisma/seed.ts"
-import { PrismaClient } from "../src/generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-if (!process.env.DATABASE_URL) {
- throw new Error("DATABASE_URL is not set");
-}
-
-const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
-const prisma = new PrismaClient({ adapter });
-
-const todoData = [
- { title: "Learn Elysia" },
- { title: "Learn Prisma" },
- { title: "Build something awesome", completed: true },
-];
-
-async function main() {
- console.log("Start seeding...");
- for (const todo of todoData) {
- const created = await prisma.todo.create({
- data: todo,
- });
- console.log(`Created todo with id: ${created.id}`);
- }
- console.log("Seeding finished.");
-}
-
-main()
- .then(async () => {
- await prisma.$disconnect();
- })
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the seed script:
-
-```bash
-bunx --bun prisma db seed
-```
-
-And open Prisma Studio to inspect your data:
-
-```bash
-bunx --bun prisma studio
-```
-
-## 3. Integrate Prisma into Elysia
-
-### 3.1. Create a Prisma Client instance
-
-Inside the `src/` directory, create a `lib` directory with a `prisma.ts` file. This file will create and export your Prisma Client instance and add the following code:
-
-```typescript title="src/lib/prisma.ts"
-import { PrismaClient } from "../generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const databaseUrl = process.env.DATABASE_URL;
-
-if (!databaseUrl) {
- throw new Error("DATABASE_URL is not set");
-}
-
-const adapter = new PrismaPg({ connectionString: databaseUrl });
-export const prisma = new PrismaClient({ adapter });
-```
-
-### 3.2. Create API routes
-
-Update your `src/index.ts` file to match the Prisma Elysia example, including Prismabox-generated validation types:
-
-```typescript title="src/index.ts"
-import { Elysia, t } from "elysia";
-import { prisma } from "./lib/prisma";
-import { TodoPlain, TodoPlainInputCreate, TodoPlainInputUpdate } from "./generated/prismabox/Todo";
-
-const app = new Elysia()
- // Health check
- .get("/", () => {
- return { message: "Hello Elysia with Prisma!" };
- })
-
- // Get all todos
- .get(
- "/todos",
- async () => {
- const todos = await prisma.todo.findMany({
- orderBy: { createdAt: "desc" },
- });
- return todos;
- },
- {
- response: t.Array(TodoPlain),
- },
- )
-
- // Get a single todo by ID
- .get(
- "/todos/:id",
- async ({ params, set }) => {
- const id = Number(params.id);
- const todo = await prisma.todo.findUnique({
- where: { id },
- });
-
- if (!todo) {
- set.status = 404;
- return { error: "Todo not found" };
- }
-
- return todo;
- },
- {
- params: t.Object({
- id: t.Numeric(),
- }),
- response: {
- 200: TodoPlain,
- 404: t.Object({
- error: t.String(),
- }),
- },
- },
- )
-
- // Create a new todo
- .post(
- "/todos",
- async ({ body }) => {
- const todo = await prisma.todo.create({
- data: {
- title: body.title,
- },
- });
- return todo;
- },
- {
- body: TodoPlainInputCreate,
- response: TodoPlain,
- },
- )
-
- // Update a todo
- .put(
- "/todos/:id",
- async ({ params, body, set }) => {
- const id = Number(params.id);
-
- try {
- const todo = await prisma.todo.update({
- where: { id },
- data: {
- title: body.title,
- completed: body.completed,
- },
- });
- return todo;
- } catch {
- set.status = 404;
- return { error: "Todo not found" };
- }
- },
- {
- params: t.Object({
- id: t.Numeric(),
- }),
- body: TodoPlainInputUpdate,
- response: {
- 200: TodoPlain,
- 404: t.Object({
- error: t.String(),
- }),
- },
- },
- )
-
- // Toggle todo completion
- .patch(
- "/todos/:id/toggle",
- async ({ params, set }) => {
- const id = Number(params.id);
-
- try {
- const todo = await prisma.todo.findUnique({
- where: { id },
- });
-
- if (!todo) {
- set.status = 404;
- return { error: "Todo not found" };
- }
-
- const updated = await prisma.todo.update({
- where: { id },
- data: { completed: !todo.completed },
- });
-
- return updated;
- } catch {
- set.status = 404;
- return { error: "Todo not found" };
- }
- },
- {
- params: t.Object({
- id: t.Numeric(),
- }),
- response: {
- 200: TodoPlain,
- 404: t.Object({
- error: t.String(),
- }),
- },
- },
- )
-
- // Delete a todo
- .delete(
- "/todos/:id",
- async ({ params, set }) => {
- const id = Number(params.id);
-
- try {
- const todo = await prisma.todo.delete({
- where: { id },
- });
- return todo;
- } catch {
- set.status = 404;
- return { error: "Todo not found" };
- }
- },
- {
- params: t.Object({
- id: t.Numeric(),
- }),
- response: {
- 200: TodoPlain,
- 404: t.Object({
- error: t.String(),
- }),
- },
- },
- )
-
- .listen(3000);
-
-console.log(`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`);
-```
-
-This creates the same endpoints as the official example:
-
-- `GET /` - Health check
-- `GET /todos` - Fetch all todos (newest first)
-- `GET /todos/:id` - Fetch a single todo
-- `POST /todos` - Create a todo
-- `PUT /todos/:id` - Update a todo
-- `PATCH /todos/:id/toggle` - Toggle completion
-- `DELETE /todos/:id` - Delete a todo
-
-Prismabox generates the `TodoPlain`/`TodoPlainInput*` TypeBox schemas so responses and request bodies are validated and typed.
-
-### 3.3. Run the application
-
-Start your Elysia server:
-
-```bash
-bun run dev
-```
-
-You should see `🦊 Elysia is running at localhost:3000` in the console.
-
-### 3.4. Test the API
-
-Test the endpoints using `curl`:
-
-```bash
-# Health check
-curl http://localhost:3000/ | jq
-
-# Get all todos
-curl http://localhost:3000/todos | jq
-
-# Get a single todo
-curl http://localhost:3000/todos/1 | jq
-
-# Create a new todo
-curl -X POST http://localhost:3000/todos \
- -H "Content-Type: application/json" \
- -d '{"title": "Ship the Prisma + Elysia guide"}' | jq
-
-# Toggle completion
-curl -X PATCH http://localhost:3000/todos/1/toggle | jq
-
-# Update a todo
-curl -X PUT http://localhost:3000/todos/1 \
- -H "Content-Type: application/json" \
- -d '{"title": "Updated title", "completed": true}' | jq
-
-# Delete a todo
-curl -X DELETE http://localhost:3000/todos/1 | jq
-```
-
-You're done! You've created an Elysia app with Prisma that's connected to a Prisma Postgres database.
-
-## Next steps
-
-Now that you have a working Elysia app connected to a Prisma Postgres database, you can:
-
-- Extend your Prisma schema with more models and relationships
-- Add update and delete endpoints
-- Explore authentication with [Elysia plugins](https://elysiajs.com/plugins/overview.html)
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-- Use [Eden](https://elysiajs.com/eden/overview.html) for end-to-end type-safe API calls
-
-### More info
-
-- [Prisma Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Elysia Documentation](https://elysiajs.com/)
-- [Elysia with Prisma Guide](https://elysiajs.com/integrations/prisma.html)
diff --git a/apps/docs/content/docs.v6/guides/embed-studio-nextjs.mdx b/apps/docs/content/docs.v6/guides/embed-studio-nextjs.mdx
deleted file mode 100644
index 6cd748d532..0000000000
--- a/apps/docs/content/docs.v6/guides/embed-studio-nextjs.mdx
+++ /dev/null
@@ -1,493 +0,0 @@
----
-title: Embedded Prisma Studio (with Next.js)
-description: Learn how to embed Prisma Studio directly in your Next.js application for database management
-image: /img/guides/prisma-studio-embedded-in-nextjs.png
-url: /v6/guides/embed-studio-nextjs
-metaTitle: How to embed Prisma Studio in a Next.js app
-metaDescription: Learn how to embed Prisma Studio directly in your Next.js application for database management
----
-
-Prisma Studio can be embedded directly into your Next.js application using the [`@prisma/studio-core`](https://www.npmjs.com/package/@prisma/studio-core) package. This guide walks you through the setup so you can manage your database from within your app instead of running Prisma Studio separately.
-
-After completing the guide, you'll have a Next.js app with Prisma Studio embedded, allowing you to browse and edit your database directly from your application interface:
-
-
-
-Embedding Prisma Studio can be useful in scenarios such as:
-
-- Building a quick admin dashboard for editing data
-- Supporting multi-tenant applications where each user has their own database
-- Giving users an easy way to view and edit their data
-
-:::note
-
-[**Embeddable Prisma Studio**](/v6/postgres/database/prisma-studio/embedding-studio) is _free_ and licensed under Apache 2.0.
-
-✔️ Free to use in production
-⚠️ Prisma branding must remain visible and unchanged
-🔐 To remove branding or learn about upcoming partner-only features, reach out at [partnerships@prisma.io](mailto:partnerships@prisma.io)
-
-Currently, Embedded Prisma Studio supports [**Prisma Postgres**](/v6/postgres), with additional databases coming soon.
-
-:::
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- Basic knowledge of React and Next.js
-- A Prisma Postgres database
-
-## 1. Setting up Next.js
-
-First, create a new Next.js project from the directory where you want to build your app:
-
-```npm
-npx create-next-app@latest nextjs-studio-embed
-```
-
-You will be prompted to answer a few questions about your project. Select all of the defaults.
-
-:::info
-
-For reference, those are:
-
-- TypeScript
-- ESLint
-- Tailwind CSS
-- No `src` directory
-- App Router
-- Turbopack
-- Select default import alias
-
-:::
-
-Then, navigate to the project directory:
-
-```bash
-cd nextjs-studio-embed
-```
-
-## 2. Setting up Prisma ORM and Prisma Postgres
-
-### 2.1. Install Prisma dependencies
-
-Install the required Prisma packages:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/extension-accelerate @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-### 2.2. Initialize Prisma with Prisma Postgres
-
-Initialize Prisma in your project and create a Prisma Postgres database:
-
-```npm
-npx prisma init --db --output ../app/generated/prisma
-```
-
-:::info
-
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My \***\*\_\_\*\*** Project"
-
-:::
-
-The `prisma init --db` command creates:
-
-- A `prisma/` directory with your `schema.prisma` file
-- A `prisma.config.ts` file for configuring Prisma
-- A new Prisma Postgres database
-- A `.env` file with your `DATABASE_URL`
-- An output directory at `app/generated/prisma` for the Prisma Client
-
-### 2.3. Define your database schema
-
-Open `prisma/schema.prisma` and replace the content with:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- name String // [!code ++]
- email String @unique // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
- createdAt DateTime @default(now()) // [!code ++]
-} // [!code ++]
-
-```
-
-### 2.4 Add `dotenv` to `prisma.config.ts`
-
-To get access to the variables in the `.env` file, they can either be loaded by your runtime, or by using `dotenv`.
-Include an import for `dotenv` at the top of the `prisma.config.ts`
-
-```ts
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.5. Apply the schema to your database
-
-Generate the Prisma Client and apply the schema:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-```npm
-npx prisma generate
-```
-
-This creates the tables in your Prisma Postgres database and generates the Prisma Client.
-
-### 2.6. Seed your database (optional)
-
-Create a seed file to add some sample data. Create a `seed.ts` file in the `prisma` folder and add the following code:
-
-```typescript title="prisma/seed.ts"
-import { PrismaClient } from "../app/generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-async function main() {
- // Create users
- const user1 = await prisma.user.create({
- data: {
- name: "Alice Johnson",
- email: "alice@example.com",
- },
- });
-
- const user2 = await prisma.user.create({
- data: {
- name: "Bob Smith",
- email: "bob@example.com",
- },
- });
-
- // Create posts
- await prisma.post.create({
- data: {
- title: "Getting Started with Next.js",
- content: "Next.js is a powerful React framework...",
- published: true,
- authorId: user1.id,
- },
- });
-
- await prisma.post.create({
- data: {
- title: "Database Management with Prisma",
- content: "Prisma makes database management easy...",
- published: false,
- authorId: user2.id,
- },
- });
-
- console.log("Database seeded successfully!");
-}
-
-main()
- .catch((e) => {
- console.error(e);
- process.exit(1);
- })
- .finally(async () => {
- await prisma.$disconnect();
- });
-```
-
-Add a seed script to your `prisma.config.ts`:
-
-```ts title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: `tsx prisma/seed.ts`,
- },
- datasource: {
- url: env("DIRECT_URL"),
- },
-});
-```
-
-Run the seed script:
-
-```npm
-npx prisma db seed
-```
-
-## 3. Setting up the embedded Prisma Studio in your app
-
-Now that you have Prisma ORM and Prisma Postgres set up, you can embed Prisma Studio in your Next.js app.
-
-### 3.1. Install the Prisma Studio Core package
-
-Install the [`@prisma/studio-core` package](https://www.npmjs.com/package/@prisma/studio-core) that provides the embeddable components:
-
-```npm
-npm install @prisma/studio-core
-```
-
-:::note
-
-If you encounter a dependency resolution error while installing `@prisma/studio-core`, you can force the install with:
-
-```npm
-npm install @prisma/studio-core --force
-```
-
-If you are using yarn, pnpm, or another package manager, use the equivalent flag for your tool.
-:::
-
-The `@prisma/studio-core` provides `Studio`, a React component which renders Prisma Studio for your database. The `Studio` component accepts an _executor_ which accesses a custom endpoint in your backend. The backend uses your API key to identify the correct Prisma Postgres instance and sends the SQL query to it.
-
-### 3.2. Create a Studio wrapper component
-
-Create a `components` folder and add a new file called `StudioWrapper.tsx`. This file will wrap the Studio component and provide a consistent layout:
-
-```tsx title="components/StudioWrapper.tsx"
-"use client";
-import "@prisma/studio-core/ui/index.css";
-import { ReactNode } from "react";
-
-interface StudioWrapperProps {
- children: ReactNode;
-}
-
-export default function StudioWrapper({ children }: StudioWrapperProps) {
- return (
-
-
-
-
-
Database Studio
-
Powered by Prisma Studio
-
-
-
-
-
{children}
-
-
- );
-}
-```
-
-### 3.3. Create an API endpoint to send the SQL queries to Prisma Studio
-
-Next, set up a backend endpoint that Prisma Studio can communicate with. This endpoint receives SQL queries from the embedded Studio UI, forwards them to your Prisma Postgres database, and then returns the results (or errors) back to the frontend.
-
-To do this, create a new folder called `api` inside the `app` directory. Inside it, add a `studio` folder with a `route.ts` file. This file will handle all requests sent to `/api/studio` and act as the bridge between the Studio component in your frontend and the database in your backend:
-
-```typescript title="app/api/studio/route.ts"
-import "dotenv/config";
-import { createPrismaPostgresHttpClient } from "@prisma/studio-core/data/ppg";
-import { serializeError } from "@prisma/studio-core/data/bff";
-
-const CORS_HEADERS = {
- "Access-Control-Allow-Origin": "*", // Change to your domain in production
- "Access-Control-Allow-Methods": "GET, POST, OPTIONS",
- "Access-Control-Allow-Headers": "Content-Type, Authorization",
-};
-
-// Use dynamic rendering for database operations
-export const dynamic = "force-dynamic";
-
-export async function GET() {
- return Response.json({ message: "Studio API endpoint is running" }, { headers: CORS_HEADERS });
-}
-
-export async function POST(request: Request) {
- try {
- const body = await request.json();
- const query = body.query;
-
- if (!query) {
- return Response.json([serializeError(new Error("Query is required"))], {
- status: 400,
- headers: CORS_HEADERS,
- });
- }
-
- const url = process.env.DATABASE_URL;
- if (!url) {
- const message = "❌ Environment variable DATABASE_URL is missing.";
- return Response.json([serializeError(new Error(message))], {
- status: 500,
- headers: CORS_HEADERS,
- });
- }
-
- const [error, results] = await createPrismaPostgresHttpClient({
- url,
- }).execute(query);
-
- if (error) {
- return Response.json([serializeError(error)], {
- headers: CORS_HEADERS,
- });
- }
-
- return Response.json([null, results], { headers: CORS_HEADERS });
- } catch (err) {
- return Response.json([serializeError(err)], {
- status: 400,
- headers: CORS_HEADERS,
- });
- }
-}
-
-// Handle preflight requests for CORS
-export async function OPTIONS() {
- return new Response(null, { status: 204, headers: CORS_HEADERS });
-}
-```
-
-### 3.4. Create the main Studio page
-
-Open the `app/page.tsx` file and replace the existing code to render the embedded Studio with the following:
-
-```tsx title="app/page.tsx"
-"use client";
-
-import dynamic from "next/dynamic";
-import { createPostgresAdapter } from "@prisma/studio-core/data/postgres-core";
-import { createStudioBFFClient } from "@prisma/studio-core/data/bff";
-import { useMemo, Suspense } from "react";
-import StudioWrapper from "@/components/StudioWrapper";
-
-// Dynamically import Studio with no SSR to avoid hydration issues
-const Studio = dynamic(() => import("@prisma/studio-core/ui").then((mod) => mod.Studio), {
- ssr: false,
-});
-
-// Loading component
-const StudioLoading = () => (
-
-
-
-
Loading Studio...
-
-
-);
-
-// Client-only Studio component
-const ClientOnlyStudio = () => {
- const adapter = useMemo(() => {
- // Create the HTTP client that communicates with our API endpoint
- const executor = createStudioBFFClient({
- url: "/api/studio",
- });
-
- // Create the Postgres adapter using the executor
- return createPostgresAdapter({ executor });
- }, []);
-
- return ;
-};
-
-export default function App() {
- return (
-
- }>
-
-
-
- );
-}
-```
-
-### 3.5. Start your development server and test the embedded Studio
-
-Start your Next.js development server:
-
-```npm
-npm run dev
-```
-
-Open your browser and go to `http://localhost:3000`. You should now see Prisma Studio running inside your application:
-
-
-
-Here's what to look for:
-
-1. **Prisma Studio interface**: The full Prisma Studio UI should render within your app layout.
-2. **Your data**: The `User` and `Post` tables you defined (plus any seeded data) should appear.
-3. **Interactive features**:
- - Browse and filter records in your tables
- - Edit values inline by double-clicking cells
- - Add new records using the "Add record" button
- - Delete records you no longer need
- - Explore relationships by navigating between related tables
-
-Verify whether everything works by testing the basics:
-
-- Click on different tables to confirm your data loads.
-- Update a record to check that changes are saved.
-- Add a new record and confirm it appears instantly.
-- Try filtering data to make sure queries run correctly.
-- Navigate through relationships (for example, view a user's posts) to confirm associations work.
-
-Once these actions work as expected, your embedded Prisma Studio is set up and connected to your Prisma Postgres database.
-
-## Next steps
-
-At this point you have Prisma Studio running inside your Next.js application and connected to your Prisma Postgres database. You can browse, edit, and manage your data without leaving your app. To make this setup production-ready, consider these improvements:
-
-1. **Add authentication**: Currently, anyone who can open your app has access to Prisma Studio. [Add user authentication](/v6/postgres/database/prisma-studio/embedding-studio#adding-user-authentication) and only allow specific roles (for example, admins) to use the embedded Studio. You can do this by checking authentication tokens in your `/api/studio` endpoint before running queries.
-
-2. **Use environment-specific configuration**: In development you may want a test database, while in production you'll need a separate live database. Update your `.env` file to use different `DATABASE_URL` values for each environment, and confirm that your `/api/studio` endpoint is reading the correct one.
-
-3. **Apply custom styling**: The Studio component ships with a default look. Pass in [your own theme](/v6/postgres/database/prisma-studio/embedding-studio#custom-styling) and adjust colors, typography, or branding to match the rest of your application. This helps Studio feel like a native part of your app rather than a standalone tool.
-
-By adding authentication, environment-specific settings, and styling, you move from a working demo to a secure and polished production setup.
-
-For more patterns and examples, see the [Prisma Studio Core demo repository](https://github.com/prisma/studio-core-demo), which includes an alternative implementation using Hono.js and React. If you prefer a guided walkthrough, watch the YouTube video: [**Use Prisma Studio in Your Own Applications
-**](https://www.youtube.com/watch?v=Up5vG2YHPvc).
diff --git a/apps/docs/content/docs.v6/guides/github-actions.mdx b/apps/docs/content/docs.v6/guides/github-actions.mdx
deleted file mode 100644
index 35da8b0801..0000000000
--- a/apps/docs/content/docs.v6/guides/github-actions.mdx
+++ /dev/null
@@ -1,648 +0,0 @@
----
-title: GitHub Actions
-description: Provision and manage Prisma Postgres databases per pull request using GitHub Actions and Prisma Management API
-image: /img/guides/prisma-postgres-github-actions-cover.png
-url: /v6/guides/github-actions
-metaTitle: How to provision preview databases with GitHub Actions and Prisma Postgres
-metaDescription: Provision and manage Prisma Postgres databases per pull request using GitHub Actions and Prisma Management API
----
-
-## Overview
-
-This guide shows you how to automatically create and delete [Prisma Postgres](https://www.prisma.io/postgres) databases using GitHub Actions and [the Prisma Postgres management API](https://api.prisma.io/v1/swagger-editor). The setup provisions a new database for every pull request, seeds it with sample data, and the `github-actions` bot leaves a comment with the database name and the status.
-
-
-
-After the PR is closed, the database is automatically deleted. This allows you to test changes in isolation without affecting the main development database.
-
-## Prerequisites
-
-Make sure you have the following:
-
-- Node.js 20 or later
-- A [Prisma Data Platform](https://console.prisma.io?utm_source=actions_guide&utm_medium=docs) account
-- GitHub repository
-
-## 1. Set up your project
-
-Initialize your project:
-
-```npm
-mkdir prisma-gha-demo && cd prisma-gha-demo
-npm init -y
-```
-
-## 2. Install and configure Prisma
-
-In this section, you'll set up Prisma in your project and verify that it works locally before integrating it into GitHub Actions. This involves installing Prisma's dependencies, connecting to a Prisma Postgres database, defining your data models, applying your schema, and seeding the database with sample data.
-
-By the end of this section, your project will be fully prepared to use Prisma both locally and in a CI workflow.
-
-### 2.1. Install dependencies
-
-To get started with Prisma, install the required dependencies:
-
-```npm
-npm install prisma tsx @types/pg dotenv --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma:
-
-```npm
-npx prisma init --db --output ../src/generated/prisma
-```
-
-This creates:
-
-- A `prisma/` directory with `schema.prisma`
-- A `.env` file with `DATABASE_URL`
-- A generated client in `src/generated/prisma`
-
-### 2.2. Define your Prisma schema
-
-Edit `prisma/schema.prisma` to:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User {
- id Int @id @default(autoincrement())
- email String @unique
- name String?
- posts Post[]
-}
-
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean @default(false)
- authorId Int
- author User @relation(fields: [authorId], references: [id])
-}
-```
-
-Create a `prisma.config.ts` file to configure Prisma with seeding:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config"; // [!code ++]
-
-export default defineConfig({
- // [!code ++]
- schema: "prisma/schema.prisma", // [!code ++]
- migrations: {
- // [!code ++]
- path: "prisma/migrations", // [!code ++]
- seed: `tsx src/seed.ts`, // [!code ++]
- }, // [!code ++]
- datasource: {
- // [!code ++]
- url: env("DATABASE_URL"), // [!code ++]
- }, // [!code ++]
-}); // [!code ++]
-```
-
-:::note
-
-You'll need to install the `dotenv` package:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-### 2.3. Run initial migration and generate client
-
-```npm
-npx prisma migrate dev --name init
-```
-
-Then generate Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-This pushes your schema and prepares the client.
-
-### 2.4. Seed the database
-
-Create a file at `src/seed.ts`:
-
-```tsx title="src/seed.ts"
-import { PrismaClient } from "../src/generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-import "dotenv/config";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-const userData = [
- {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: [
- {
- title: "Join the Prisma Discord",
- content: "https://pris.ly/discord",
- published: true,
- },
- {
- title: "Prisma on YouTube",
- content: "https://pris.ly/youtube",
- },
- ],
- },
- },
- {
- name: "Bob",
- email: "bob@prisma.io",
- posts: {
- create: [
- {
- title: "Follow Prisma on Twitter",
- content: "https://twitter.com/prisma",
- published: true,
- },
- ],
- },
- },
-];
-
-export async function main() {
- for (const u of userData) {
- await prisma.user.create({ data: u });
- }
-}
-
-main()
- .catch(console.error)
- .finally(() => prisma.$disconnect());
-```
-
-Update your `package.json`:
-
-```json title="package.json"
-{
- {
- "name": "prisma-gha-demo",
- "version": "1.0.0",
- "description": "",
- "scripts": {
- "seed": "tsx src/seed.ts" // [!code ++]
- },
- // other configurations...
-}
-```
-
-Then run:
-
-```npm
-npm run seed
-npx prisma studio
-```
-
-Navigate to `http://localhost:5555` and verify that the database has been seeded with sample data. Now you're ready to automate this process with GitHub Actions.
-
-## 3. Add the GitHub Actions workflow
-
-In this step, you will set up a GitHub Actions workflow that automatically provisions a Prisma Postgres database when a new pull request (PR) is opened. Once the PR is closed, the workflow will clean up the database.
-
-### 3.1 Create the workflow file
-
-Start by creating the required directory and file:
-
-```bash
-mkdir -p .github/workflows
-touch .github/workflows/prisma-postgres-management.yml
-```
-
-This file will contain the logic to manage databases on a per-PR basis. This GitHub Actions workflow:
-
-- Provisions a temporary Prisma Postgres database when a PR is opened
-- Seeds the database with test data
-- Cleans up the database when the PR is closed
-- Supports manual execution for both provisioning and cleanup
-
-:::note
-
-This workflow uses `us-east-1` as the default region for Prisma Postgres. You can change this to your preferred region by modifying the `region` parameter in the API calls, or even by adding a `region` input to the workflow.
-
-:::
-
-### 3.2. Add the base configuration
-
-Paste the following into `.github/workflows/prisma-postgres-management.yml`. This sets up when the workflow runs and provides required environment variables.
-
-```yaml title=".github/workflows/prisma-postgres-management.yml"
-name: Prisma Postgres Management API Workflow
-
-on:
- pull_request:
- types: [opened, reopened, closed]
- workflow_dispatch:
- inputs:
- action:
- description: "Action to perform"
- required: true
- default: "provision"
- type: choice
- options:
- - provision
- - cleanup
- database_name:
- description: "Database name (for testing, will be sanitized)"
- required: false
- type: string
-
-env:
- PRISMA_POSTGRES_SERVICE_TOKEN: ${{ secrets.PRISMA_POSTGRES_SERVICE_TOKEN }}
- PRISMA_PROJECT_ID: ${{ secrets.PRISMA_PROJECT_ID }}
- # Sanitize database name once at workflow level
- DB_NAME: ${{ github.event.pull_request.number != null && format('pr-{0}-{1}', github.event.pull_request.number, github.event.pull_request.head.ref) || (inputs.database_name != '' && inputs.database_name || format('test-{0}', github.run_number)) }}
-
-# Prevent concurrent runs of the same PR
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-```
-
-Now you will be adding the provision and cleanup jobs to this workflow. These jobs will handle the creation and deletion of Prisma Postgres databases based on the pull request events.
-
-### 3.3. Add a provision job to the workflow
-
-Now add a job to provision the database when the PR is opened or when triggered manually. The provision job:
-
-- Installs dependencies
-- Checks for existing databases
-- Creates a new one if needed
-- Seeds the database
-- Comments on the PR with status
-
-Append the following under the `jobs:` key in your workflow file:
-
-```yaml title=".github/workflows/prisma-postgres-management.yml"
-jobs:
- provision-database:
- if: (github.event_name == 'pull_request' && github.event.action != 'closed') || (github.event_name == 'workflow_dispatch' && inputs.action == 'provision')
- runs-on: ubuntu-latest
- permissions: write-all
- timeout-minutes: 15
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: "22"
- cache: "npm"
-
- - name: Install Dependencies
- run: npm install
-
- - name: Validate Environment Variables
- run: |
- if [ -z "${{ env.PRISMA_POSTGRES_SERVICE_TOKEN }}" ]; then
- echo "Error: PRISMA_POSTGRES_SERVICE_TOKEN secret is not set"
- exit 1
- fi
- if [ -z "${{ env.PRISMA_PROJECT_ID }}" ]; then
- echo "Error: PRISMA_PROJECT_ID secret is not set"
- exit 1
- fi
-
- - name: Sanitize Database Name
- run: |
- # Sanitize the database name to match Prisma's requirements
- DB_NAME="$(echo "${{ env.DB_NAME }}" | tr '/' '_' | tr '-' '_' | tr '[:upper:]' '[:lower:]')"
- echo "DB_NAME=$DB_NAME" >> $GITHUB_ENV
-
- - name: Check If Database Exists
- id: check-db
- run: |
- echo "Fetching all databases..."
- RESPONSE=$(curl -s -X GET \
- -H "Authorization: Bearer ${{ env.PRISMA_POSTGRES_SERVICE_TOKEN }}" \
- -H "Content-Type: application/json" \
- "https://api.prisma.io/v1/projects/${{ env.PRISMA_PROJECT_ID }}/databases")
-
- echo "Looking for database with name: ${{ env.DB_NAME }}"
-
- # Extract database ID using jq to properly parse JSON
- DB_EXISTS=$(echo "$RESPONSE" | jq -r ".data[]? | select(.name == \"${{ env.DB_NAME }}\") | .id")
-
- if [ ! -z "$DB_EXISTS" ] && [ "$DB_EXISTS" != "null" ]; then
- echo "Database ${{ env.DB_NAME }} exists with ID: $DB_EXISTS."
- echo "exists=true" >> $GITHUB_OUTPUT
- echo "db-id=$DB_EXISTS" >> $GITHUB_OUTPUT
- else
- echo "No existing database found with name ${{ env.DB_NAME }}"
- echo "exists=false" >> $GITHUB_OUTPUT
- fi
-
- - name: Create Database
- id: create-db
- if: steps.check-db.outputs.exists != 'true'
- run: |
- echo "Creating database ${{ env.DB_NAME }}..."
- RESPONSE=$(curl -s -X POST \
- -H "Authorization: Bearer ${{ env.PRISMA_POSTGRES_SERVICE_TOKEN }}" \
- -H "Content-Type: application/json" \
- -d "{\"name\": \"${{ env.DB_NAME }}\", \"region\": \"us-east-1\"}" \
- "https://api.prisma.io/v1/projects/${{ env.PRISMA_PROJECT_ID }}/databases")
-
- # Check if response contains an id (success case)
- if echo "$RESPONSE" | grep -q '"id":'; then
- echo "Database created successfully"
- CONNECTION_STRING=$(echo "$RESPONSE" | jq -r '.data.connectionString')
- echo "connection-string=$CONNECTION_STRING" >> $GITHUB_OUTPUT
- else
- echo "Failed to create database"
- echo "$RESPONSE"
- exit 1
- fi
-
- - name: Get Connection String for Existing Database
- id: get-connection
- if: steps.check-db.outputs.exists == 'true'
- run: |
- echo "Creating new connection string for existing database..."
- CONNECTION_RESPONSE=$(curl -s -X POST \
- -H "Authorization: Bearer ${{ env.PRISMA_POSTGRES_SERVICE_TOKEN }}" \
- -H "Content-Type: application/json" \
- -d '{"name":"read_write_key"}' \
- "https://api.prisma.io/v1/databases/${{ steps.check-db.outputs.db-id }}/connections")
-
- CONNECTION_STRING=$(echo "$CONNECTION_RESPONSE" | jq -r '.data.connectionString')
- echo "connection-string=$CONNECTION_STRING" >> $GITHUB_OUTPUT
-
- - name: Setup Database Schema
- run: |
- # Get connection string from appropriate step
- if [ "${{ steps.check-db.outputs.exists }}" = "true" ]; then
- CONNECTION_STRING="${{ steps.get-connection.outputs.connection-string }}"
- else
- CONNECTION_STRING="${{ steps.create-db.outputs.connection-string }}"
- fi
-
- # Set the DATABASE_URL
- export DATABASE_URL="$CONNECTION_STRING"
-
- # Generate Prisma Client
- npx prisma generate
-
- # Push schema to database
- npx prisma db push
-
- - name: Seed Database
- run: |
- # Get connection string from appropriate step
- if [ "${{ steps.check-db.outputs.exists }}" = "true" ]; then
- CONNECTION_STRING="${{ steps.get-connection.outputs.connection-string }}"
- else
- CONNECTION_STRING="${{ steps.create-db.outputs.connection-string }}"
- fi
-
- # Set the DATABASE_URL environment variable for the seed script
- export DATABASE_URL="$CONNECTION_STRING"
-
- # Generate Prisma Client
- npx prisma generate
-
- # Run the seed script
- npm run seed
-
- - name: Comment PR
- if: success() && github.event_name == 'pull_request'
- uses: actions/github-script@v7
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- github.rest.issues.createComment({
- issue_number: context.issue.number,
- owner: context.repo.owner,
- repo: context.repo.repo,
- body: `🗄️ Database provisioned successfully!\n\nDatabase name: ${{ env.DB_NAME }}\nStatus: Ready and seeded with sample data`
- })
-
- - name: Output Database Info
- if: success() && github.event_name == 'workflow_dispatch'
- run: |
- echo "🗄️ Database provisioned successfully!"
- echo "Database name: ${{ env.DB_NAME }}"
- echo "Status: Ready and seeded with sample data"
-```
-
-### 3.4. Add a cleanup job to the workflow
-
-When a pull request is closed, you can automatically remove the associated database by adding a cleanup job. The cleanup job:
-
-- Finds the database by name
-- Deletes it from the Prisma Postgres project
-- Can also be triggered manually with `action: cleanup`
-
-Append the following to your `jobs:` section, after the `provision-database` job:
-
-```yaml title=".github/workflows/prisma-postgres-management.yml"
-cleanup-database:
- if: (github.event_name == 'pull_request' && github.event.action == 'closed') || (github.event_name == 'workflow_dispatch' && inputs.action == 'cleanup')
- runs-on: ubuntu-latest
- timeout-minutes: 5
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Validate Environment Variables
- run: |
- if [ -z "${{ env.PRISMA_POSTGRES_SERVICE_TOKEN }}" ]; then
- echo "Error: PRISMA_POSTGRES_SERVICE_TOKEN secret is not set"
- exit 1
- fi
- if [ -z "${{ env.PRISMA_PROJECT_ID }}" ]; then
- echo "Error: PRISMA_PROJECT_ID secret is not set"
- exit 1
- fi
-
- - name: Sanitize Database Name
- run: |
- # Sanitize the database name
- DB_NAME="$(echo "${{ env.DB_NAME }}" | tr '/' '_' | tr '-' '_' | tr '[:upper:]' '[:lower:]')"
- echo "DB_NAME=$DB_NAME" >> $GITHUB_ENV
-
- - name: Delete Database
- run: |
- echo "Fetching all databases..."
- RESPONSE=$(curl -s -X GET \
- -H "Authorization: Bearer ${{ env.PRISMA_POSTGRES_SERVICE_TOKEN }}" \
- -H "Content-Type: application/json" \
- "https://api.prisma.io/v1/projects/${{ env.PRISMA_PROJECT_ID }}/databases")
-
- echo "Looking for database with name: ${{ env.DB_NAME }}"
-
- # Extract database ID using jq to properly parse JSON
- DB_EXISTS=$(echo "$RESPONSE" | jq -r ".data[]? | select(.name == \"${{ env.DB_NAME }}\") | .id")
-
- if [ ! -z "$DB_EXISTS" ] && [ "$DB_EXISTS" != "null" ]; then
- echo "Database ${{ env.DB_NAME }} exists with ID: $DB_EXISTS. Deleting..."
- DELETE_RESPONSE=$(curl -s -X DELETE \
- -H "Authorization: Bearer ${{ env.PRISMA_POSTGRES_SERVICE_TOKEN }}" \
- -H "Content-Type: application/json" \
- "https://api.prisma.io/v1/databases/$DB_EXISTS")
-
- echo "Delete API Response: $DELETE_RESPONSE"
-
- if echo "$DELETE_RESPONSE" | grep -q '"error":'; then
- ERROR_MSG=$(echo "$DELETE_RESPONSE" | jq -r '.message // "Unknown error"')
- echo "Failed to delete database: $ERROR_MSG"
- exit 1
- else
- echo "Database deletion initiated successfully"
- fi
- else
- echo "No existing database found with name ${{ env.DB_NAME }}"
- fi
-```
-
-This completes your Prisma Postgres management workflow setup. In the next step, you'll configure the required GitHub secrets to authenticate with the Prisma API.
-
-## 4. Store the code in GitHub
-
-Initialize a git repository and push to [GitHub](https://github.com/):
-
-If you don't have a repository in GitHub yet, [create one on GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository). Once the repository is ready, run the following commands:
-
-```bash
-git add .
-git commit -m "Initial commit with Prisma Postgres integration"
-git branch -M main
-git remote add origin https://github.com//.git
-git push -u origin main
-```
-
-:::note
-
-Replace `` and `` with your GitHub username and the name of your repository.
-
-:::
-
-## 5. Retrieve the secrets for the workflow
-
-### 5.1. Retrieve your Prisma Postgres service token
-
-To manage Prisma Postgres databases, you also need a service token. Follow these steps to retrieve it:
-
-1. Make sure you are in the same workspace where you created your project in the last step.
-2. Navigate to the **Settings** page of your workspace and select **Service Tokens**.
-3. Click **New Service Token**.
-4. Copy the generated token and save it in your `.env` file as `PRISMA_POSTGRES_SERVICE_TOKEN`. This token is required for the next step's script and must also be added to your GitHub Actions secrets.
-
-### 5.2 Retrieve the project ID where you want to provision Prisma Postgres databases
-
-To avoid conflicts with your development databases, you'll now create a dedicated project specifically for CI workflows. Use the following curl command to create a new Prisma Postgres project using the Prisma Postgres Management API:
-
-```bash
-curl -X POST https://api.prisma.io/v1/projects \
- -H "Authorization: Bearer $PRISMA_POSTGRES_SERVICE_TOKEN" \
- -H "Content-Type: application/json" \
- -d "{\"region\": \"us-east-1\", \"name\": \"$PROJECT_NAME\"}"
-```
-
-:::note
-
-Make sure to replace the `$PRISMA_POSTGRES_SERVICE_TOKEN` variable with the service token you stored earlier.
-
-:::
-
-Replace the $PRISMA_POSTGRES_SERVICE_TOKEN with the service token and the `$PROJECT_NAME`with a name for your project (e.g.,`my-gha-preview`). The script will create a new Prisma Postgres project in the `us-east-1` region.
-
-The CLI output will then look like this:
-
-```json
-{
- "data": {
- "id": "$PRISMA_PROJECT_ID",
- "type": "project",
- "name": "$PROJECT_NAME",
- "createdAt": "2025-07-15T08:35:10.546Z",
- "workspace": {
- "id": "$PRISMA_WORKSPACE_ID",
- "name": "$PRISMA_WORKSPACE_NAME"
- }
- }
-}
-```
-
-Copy and store the `$PRISMA_PROJECT_ID` from the output. This is your Prisma project ID, which you will use in the next step.
-
-## 6. Add secrets in GitHub
-
-To add secrets:
-
-1. Go to your GitHub repository.
-2. Navigate to **Settings**.
-3. Click and expand the **Secrets and variables** section.
-4. Click **Actions**.
-5. Click **New repository secret**.
-6. Add the following:
- - `PRISMA_PROJECT_ID` - Your Prisma project ID from the Prisma Console.
- - `PRISMA_POSTGRES_SERVICE_TOKEN` - Your service token.
-
-These secrets will be accessed in the workflow file via `env`.
-
-## 7. Try the workflow
-
-You can test the setup in two ways:
-
-**Option 1: Automatic trigger via PR**
-
-1. Open a pull request on the repository.
-2. GitHub Actions will provision a new Prisma Postgres database.
-3. It will push your schema and seed the database.
-4. A comment will be added to the PR confirming database creation.
-5. When the PR is closed, the database will be deleted automatically.
-
-**Option 2: Manual trigger**
-
-1. Go to the **Actions** tab in your repository.
-2. Select the **Prisma Postgres Management API Workflow** on the left sidebar.
-3. Click the **Run workflow** dropdown
-4. Choose `provision` as the action and optionally provide a custom database name. You can also choose `cleanup` to delete an _existing_ database.
-5. Click **Run workflow**.
-
-## Next steps
-
-You now have a fully automated GitHub Actions setup for managing ephemeral Prisma Postgres databases.
-
-This gives you:
-
-- Isolated databases for every pull request.
-- Automatic schema sync and seed.
-- Cleanup of unused databases after merges.
-
-This setup improves confidence in changes and reduces the risk of shared database conflicts. You can extend this by integrating test suites, or integrating it in your workflow.
diff --git a/apps/docs/content/docs.v6/guides/hono.mdx b/apps/docs/content/docs.v6/guides/hono.mdx
deleted file mode 100644
index 529747df6f..0000000000
--- a/apps/docs/content/docs.v6/guides/hono.mdx
+++ /dev/null
@@ -1,358 +0,0 @@
----
-title: Hono
-description: Learn how to use Prisma ORM in a Hono app
-image: /img/guides/prisma-hono-cover.png
-url: /v6/guides/hono
-metaTitle: How to use Prisma ORM and Prisma Postgres with Hono
-metaDescription: Learn how to use Prisma ORM in a Hono app
----
-
-## Introduction
-
-Prisma ORM offers type-safe database access, and [Hono](https://hono.dev/) is built for fast, lightweight web apps. Together with [Prisma Postgres](https://www.prisma.io/postgres), you get a fast, lightweight backend, that can be deployed through Node.js, Cloudflare, or many other runtimes.
-
-In this guide, you'll learn to integrate Prisma ORM with a Prisma Postgres database in a Hono backend application. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/hono).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-
-## 1. Set up your project
-
-Create a new Hono project:
-
-```npm
-npm create hono@latest
-```
-
-:::info
-
-- _Target directory?_ `my-app`
-- _Which template do you want to use?_ `nodejs`
-- _Install dependencies? (recommended)_ `Yes`
-- _Which package manager do you want to use?_ `npm`
- :::
-
-## 2. Install and configure Prisma
-
-### 2.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../src/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My Hono Project"
-:::
-This will create:
-
-- A `prisma/` directory with a `schema.prisma` file
-- A `prisma.config.ts` with your Prisma configuration
-- A `.env` file with a `DATABASE_URL` already set
-
-### 2.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, add the following models and change the generator to use the `prisma-client` provider:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-```
-
-This creates two models: `User` and `Post`, with a one-to-many relationship between them.
-
-In `prisma.config.ts`, import `dotenv` at the top of the file
-
-```typescript title="prisma.config.ts"
-import { defineConfig, env } from "prisma/config";
-import "dotenv/config"; // [!code ++]
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.3. Configure the Prisma Client generator
-
-Now, run the following command to create the database tables and generate the Prisma Client:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-```npm
-npx prisma generate
-```
-
-### 2.4. Seed the database
-
-Let's add some seed data to populate the database with sample users and posts.
-
-Create a new file called `seed.ts` in the `prisma/` directory:
-
-```typescript title="prisma/seed.ts"
-import { PrismaClient, Prisma } from "../src/generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-const userData: Prisma.UserCreateInput[] = [
- {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: [
- {
- title: "Join the Prisma Discord",
- content: "https://pris.ly/discord",
- published: true,
- },
- {
- title: "Prisma on YouTube",
- content: "https://pris.ly/youtube",
- },
- ],
- },
- },
- {
- name: "Bob",
- email: "bob@prisma.io",
- posts: {
- create: [
- {
- title: "Follow Prisma on Twitter",
- content: "https://www.twitter.com/prisma",
- published: true,
- },
- ],
- },
- },
-];
-
-export async function main() {
- for (const u of userData) {
- await prisma.user.create({ data: u });
- }
-}
-
-main()
- .catch((e) => {
- console.error(e);
- process.exit(1);
- })
- .finally(async () => {
- await prisma.$disconnect();
- });
-```
-
-Now, tell Prisma how to run this script by updating your `prisma.config.ts`:
-
-```typescript title="prisma.config.ts"
-import { defineConfig, env } from "prisma/config";
-import "dotenv/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: "tsx prisma/seed.ts", // [!code ++]
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Run the seed script:
-
-```npm
-npx prisma db seed
-```
-
-And open Prisma Studio to inspect your data:
-
-```npm
-npx prisma studio
-```
-
-## 3. Integrate Prisma into Hono
-
-### 3.1. Create a Prisma middleware
-
-Inside of `/src`, create a `lib` directory and a `prisma.ts` file inside it. This file will be used to create and export your Prisma Client instance. Set up the Prisma client like this:
-
-```tsx title="src/lib/prisma.ts"
-import type { Context, Next } from "hono";
-import { PrismaClient } from "../generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-import "dotenv/config";
-
-const databaseUrl = process.env.DATABASE_URL;
-if (!databaseUrl) {
- throw new Error("DATABASE_URL is not set");
-}
-
-const adapter = new PrismaPg({
- connectionString: databaseUrl,
-});
-
-const prisma = new PrismaClient({ adapter });
-
-function withPrisma(c: Context, next: Next) {
- if (!c.get("prisma")) {
- c.set("prisma", prisma);
- }
- return next();
-}
-
-export default withPrisma;
-```
-
-:::warning
-We recommend using a connection pooler (like [Prisma Accelerate](https://www.prisma.io/accelerate)) to manage database connections efficiently.
-
-If you choose not to use one, in long-lived environments (for example, a Node.js server) instantiate a single `PrismaClient` and reuse it across requests to avoid exhausting database connections. In serverless environments or when using a pooler (for example, Accelerate), creating a client per request is acceptable.
-:::
-
-### 3.2 Environment Variables & Types
-
-By default, Hono does not load any environment variables from a `.env`. `dotenv` handles this and will be read that file and expose them via `process.env`. Hono can get additional types to know that the `withPrisma` middleware will set a `prisma`
-key on the Hono context
-
-```ts title="src/index.ts"
-import { Hono } from "hono";
-import { serve } from "@hono/node-server";
-import type { PrismaClient } from "./generated/prisma/client.js"; // [!code ++]
-
-type ContextWithPrisma = {
- // [!code ++]
- Variables: {
- // [!code ++]
- prisma: PrismaClient; // [!code ++]
- }; // [!code ++]
-}; // [!code ++]
-
-const app = new Hono(); // [!code highlight]
-
-app.get("/", (c) => {
- return c.text("Hello Hono!");
-});
-
-serve(
- {
- fetch: app.fetch,
- port: 3000,
- },
- (info) => {
- console.log(`Server is running on http://localhost:${info.port}`);
- },
-);
-```
-
-If using Cloudflare Workers, the environment variables will automatically be set to Hono's contenxt, so `dotenv` can be skipped.
-
-### 3.3. Create A GET Route
-
-Fetch data from the database using Hono's `app.get` function. This will perform any database queries
-and return the data as JSON.
-
-Create a new route inside of `src/index.ts`:
-
-Now, create a GET route that fetches the `Users` data from your database, making sure to include each user's `Posts` by adding them to the `include` field:
-
-```ts title="src/index.ts"
-import withPrisma from "./lib/prisma.js";
-
-app.get("/users", withPrisma, async (c) => {
- const prisma = c.get("prisma");
- const users = await prisma.user.findMany({
- include: { posts: true },
- });
- return c.json({ users });
-});
-```
-
-### 3.4. Display The Data
-
-Start the Hono app by call the `dev` script in the `package.json`
-
-```npm
-npm run dev
-```
-
-There should be a "Server is running on http://localhost:3000" log printed out. From here, the data
-can be viewed by visting `http://localhost:3000/users` or by running `curl` from the command line
-
-```bash
-curl http://localhost:3000/users | jq
-```
-
-You're done! You've created a Hono app with Prisma that's connected to a Prisma Postgres database.
-For next steps there are some resources below for you to explore as well as next steps for expanding
-your project.
-
-## Next Steps
-
-Now that you have a working Hono app connected to a Prisma Postgres database, you can:
-
-- Extend your Prisma schema with more models and relationships
-- Add create/update/delete routes and forms
-- Explore authentication and validation
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-
-### More Info
-
-- [Prisma Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Hono Documentation](https://hono.dev/docs/)
diff --git a/apps/docs/content/docs.v6/guides/implementing-schema-changes.mdx b/apps/docs/content/docs.v6/guides/implementing-schema-changes.mdx
deleted file mode 100644
index 9b2ecf7a84..0000000000
--- a/apps/docs/content/docs.v6/guides/implementing-schema-changes.mdx
+++ /dev/null
@@ -1,248 +0,0 @@
----
-title: Schema management in teams
-description: Learn how to use Prisma Migrate effectively when collaborating on a project as a team
-image: /img/guides/schema-migration-cover.png
-url: /v6/guides/implementing-schema-changes
-metaTitle: How to manage schema changes in a team with Prisma Migrate and Prisma ORM
-metaDescription: Learn how to use Prisma Migrate effectively when collaborating on a project as a team
----
-
-## Introduction
-
-When working in a team, managing database schema changes can be challenging. This guide shows you how to effectively collaborate on schema changes using Prisma Migrate, ensuring that all team members can safely contribute to and incorporate schema changes.
-
-## Prerequisites
-
-Before starting this guide, make sure you have:
-
-- Node.js installed (version 20 or higher)
-- A Prisma project set up with migrations
-- A relational database (PostgreSQL, MySQL, SQLite, SQL Server, etc.)
-- Basic understanding of Git
-- Basic familiarity with Prisma Migrate
-
-:::warning
-
-This guide **does not apply for MongoDB**.
-Instead of `migrate dev`, [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/v6/orm/overview/databases/mongodb).
-
-:::
-
-## 1. Understand migration basics
-
-### 1.1. Migration order
-
-Migrations are **applied in the same order as they were created**. The creation date is part of the migration subfolder name - for example, `20210316081837-updated-fields` was created on `2021-03-16-08:18:37`.
-
-### 1.2. Source control requirements
-
-You should commit the following files to source control:
-
-- The contents of the `.prisma/migrations` folder, including the `migration_lock.toml` file
-- The Prisma Schema (`schema.prisma`)
-
-Source-controlling the `schema.prisma` file is not enough - you must include your migration history because:
-
-- Customized migrations contain information that cannot be represented in the Prisma schema
-- The `prisma migrate deploy` command only runs migration files
-
-### 1.3. Configure Prisma
-
-Create a `prisma.config.ts` file in the root of your project with the following content:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-You'll need to install the `dotenv` package to load environment variables. If you haven't already, install it using your package manager:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-## 2. Incorporate team changes
-
-### 2.1. Pull latest changes
-
-To incorporate changes from collaborators:
-
-1. Pull the changed Prisma schema and `./prisma/migrations` folder
-2. Run the migrate command:
-
-```npm
-npx prisma migrate dev
-```
-
-### 2.2. Example scenario
-
-Let's walk through a sample scenario with three developers sharing schema changes:
-
-```prisma title="schema.prisma" tab="Before"
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean @default(false)
- author User? @relation(fields: [authorId], references: [id])
- authorId Int?
-}
-
-model User {
- id Int @id @default(autoincrement())
- email String @unique
- name String?
- posts Post[]
-}
-```
-
-```prisma title="schema.prisma" tab="After"
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean @default(false)
- author User? @relation(fields: [authorId], references: [id])
- authorId Int?
-}
-
-model User {
- id Int @id @default(autoincrement())
- email String @unique
- name String?
- favoriteColor String? // Added by Ania // [!code ++]
- bestPacmanScore Int? // Added by you // [!code ++]
- posts Post[]
-}
-
-// Added by Javier // [!code ++]
-model Tag { // [!code ++]
- tagName String @id // [!code ++]
- tagCategory Category // [!code ++]
-} // [!code ++]
-```
-
-## 3. Handle concurrent changes
-
-### 3.1. Developer A's changes
-
-Ania adds a new field:
-
-```prisma
-model User {
- /* ... */
- favoriteColor String?
-}
-```
-
-And generates a migration:
-
-```npm
-npx prisma migrate dev --name new-field
-```
-
-```npm
-npx prisma generate
-```
-
-### 3.2. Developer B's changes
-
-Javier adds a new model:
-
-```prisma
-model Tag {
- tagName String @id
- tagCategory Category
-}
-```
-
-And generates a migration:
-
-```npm
-npx prisma migrate dev --name new-model
-```
-
-```npm
-npx prisma generate
-```
-
-### 3.3. Merge changes
-
-The migration history now has two new migrations:
-
-
-
-## 4. Integrate your changes
-
-### 4.1. Pull team changes
-
-1. Pull the most recent changes:
- - Two new migrations
- - Updated schema file
-
-2. Review the merged schema:
-
-```prisma
-model User {
- /* ... */
- favoriteColor String?
- bestPacmanScore Int?
-}
-
-model Tag {
- tagName String @id
- tagCategory Category
- posts Post[]
-}
-```
-
-### 4.2. Generate your migration
-
-Run the migrate command:
-
-```npm
-npx prisma migrate dev
-```
-
-```npm
-npx prisma generate
-```
-
-This will:
-
-1. Apply your team's migrations
-2. Create a new migration for your changes
-3. Apply your new migration
-
-### 4.3. Commit changes
-
-Commit:
-
-- The merged `schema.prisma`
-- Your new migration file
-
-## Next steps
-
-Now that you understand team schema management, you can:
-
-- Learn about [customizing migrations](/v6/orm/prisma-migrate/workflows/customizing-migrations)
-- Explore [deployment workflows](/v6/orm/prisma-migrate/workflows/development-and-production)
-
-For more information:
-
-- [Prisma Migrate documentation](/v6/orm/prisma-migrate/getting-started)
-- [Team development workflows](/v6/orm/prisma-migrate/workflows/team-development)
diff --git a/apps/docs/content/docs.v6/guides/index.mdx b/apps/docs/content/docs.v6/guides/index.mdx
deleted file mode 100644
index f13a327834..0000000000
--- a/apps/docs/content/docs.v6/guides/index.mdx
+++ /dev/null
@@ -1,17 +0,0 @@
----
-title: Guides
-description: A collection of guides for various tasks and workflows.
-url: /v6/guides
-metaTitle: Prisma Guides
-metaDescription: A collection of guides for various tasks and workflows.
----
-
-Welcome to the Guides section! Here you'll find practical, step-by-step guides to help you accomplish specific tasks with Prisma products, including Prisma ORM, Prisma Accelerate, Prisma Postgres, and more.
-
-Browse through our guides using the sidebar navigation or use the search to find specific topics.
-
-## Getting started
-
-- [Next.js](/v6/guides/nextjs) - Learn how to use Prisma ORM in a Next.js app and deploy it to Vercel
-- [Hono](/v6/guides/hono) - Learn how to use Prisma ORM in a Hono app
-- [SvelteKit](/v6/guides/sveltekit) - Learn how to use Prisma ORM in a SvelteKit app
diff --git a/apps/docs/content/docs.v6/guides/management-api-basic.mdx b/apps/docs/content/docs.v6/guides/management-api-basic.mdx
deleted file mode 100644
index 18a0687e14..0000000000
--- a/apps/docs/content/docs.v6/guides/management-api-basic.mdx
+++ /dev/null
@@ -1,186 +0,0 @@
----
-title: Programmatically manage Prisma Postgres
-description: Learn how to get started with the Prisma Management API
-image: /img/guides/prisma-management-api-cover.png
-url: /v6/guides/management-api-basic
-metaTitle: Get started with the Prisma Management API
-metaDescription: Learn how to get started with the Prisma Management API
----
-
-## Overview
-
-This guide walks you through setting up a basic TypeScript project that uses the [Prisma Postgres Management API](/v6/postgres/introduction/management-api) to create a new [Prisma Console project](/v6/platform/about#project) with a [Prisma Postgres](/v6/postgres/introduction/overview) database, and print out all connection details.
-
-You'll authenticate via a [service token](/v6/postgres/introduction/management-api#service-tokens), set up your environment, and run a script to interact with the API.
-
-:::tip[OpenApi]
-The API reference is also available via an [OpenAPI 3.1. spec](https://api.prisma.io/v1/swagger-editor).
-:::
-
-## Prerequisites
-
-- Node.js and `npm` installed
-- A [Prisma Data Platform](https://console.prisma.io/) account
-
-## 1. Create a service token in Prisma Console
-
-First, you need to create a service token to be able to access the Management API:
-
-1. Open the [Prisma Console](https://console.prisma.io/)
-2. Navigate to the **Settings** page of your workspace and select **Service Tokens**
-3. Click **New Service Token**
-4. Copy and save the generated service token securely, you'll use it in step 2.2.
-
-## 2. Set up your project directory
-
-### 2.1. Create a basic TypeScript project
-
-Open your terminal and run the following commands:
-
-```bash
-mkdir management-api-demo
-cd management-api-demo
-```
-
-Next, initialize npm and install dependencies required for using TypeScript:
-
-```npm
-npm init -y
-npm install tsx typescript @types/node --save-dev
-touch index.ts
-```
-
-You now have an `index.ts` file that you can execute with `npx tsx index.ts`. It's still empty, you'll start writing code in step 3.
-
-### 2.2. Configure service token environment variable
-
-Create your `.env` file:
-
-```bash
-touch .env
-```
-
-Next, install the [`dotenv`](https://github.com/motdotla/dotenv) library for loading environment variables from the `.env` file:
-
-```npm
-npm install dotenv
-```
-
-Finally, add your service token (from step 1.) to `.env`:
-
-```bash
-PRISMA_SERVICE_TOKEN="ey..."
-```
-
-### 2.3. Install the `axios` library for HTTP request
-
-You're going to use [`axios`](https://github.com/axios/axios/tree/main) as your HTTP client to interact with the Management API. Install it as follows:
-
-```npm
-npm install axios
-```
-
-You're all set, let's write some code to create a project and provision a Prisma Postgres database!
-
-## 3. Programmatically create a new project with a database
-
-Paste the following code into `index.ts`:
-
-```ts
-import axios from "axios";
-import dotenv from "dotenv";
-
-// Load environment variables
-dotenv.config();
-
-const API_URL = "https://api.prisma.io/v1";
-const SERVICE_TOKEN = process.env.PRISMA_SERVICE_TOKEN;
-
-if (!SERVICE_TOKEN) {
- throw new Error("PRISMA_SERVICE_TOKEN is not set in the environment");
-}
-
-// Set HTTP headers to be used in this script
-const headers = {
- Authorization: `Bearer ${SERVICE_TOKEN}`,
- "Content-Type": "application/json",
-};
-
-async function main() {
- // Create a new project in your Prisma Console workspace
- const projectName = `demo-project-${Date.now()}`;
- const region = "us-east-1";
- const createProjectRes = await axios.post(
- `${API_URL}/projects`,
- { name: projectName, region },
- { headers },
- );
- const project = createProjectRes.data;
- console.log("Created project: \n", project);
-
- // Log the database details
- const apiKeys = project.databases[0].apiKeys || [];
- for (const key of apiKeys) {
- console.log(`\nDatabase details`);
- console.log(`- ID: ${key.id}`);
- console.log(`- Created at: ${key.createdAt}`);
- console.log(`- API key: ${key.apiKey}`);
- console.log(`- Prisma Postgres connection string: ${key.connectionString}`);
-
- if (key.ppgDirectConnection) {
- console.log(`- Direct TCP connection: ${key.ppgDirectConnection.host}`);
- console.log(` - Host: ${key.ppgDirectConnection.host}`);
- console.log(` - Username: ${key.ppgDirectConnection.user}`);
- console.log(` - Password: ${key.ppgDirectConnection.pass}`);
- }
- }
-}
-
-main().catch((e) => {
- console.error(e.response?.data || e);
- process.exit(1);
-});
-```
-
-You can run your script with the following command:
-
-```npm
-npx tsx index.ts
-```
-
-```text no-copy
-Created project:
- {
- createdAt: '2025-07-09T11:52:15.341Z',
- id: 'cmcvwftgs00v5zq0vh3kp7pms',
- name: 'demo-project-1752061932800',
- databases: [
- {
- createdAt: '2025-07-09T11:52:15.341Z',
- id: 'cmcvwftgs00v1zq0v0qrtrg8t',
- name: 'demo-project-1752061932800',
- connectionString: 'prisma+postgres://accelerate.prisma-data.net/?api_key=',
- region: 'us-east-1',
- status: 'ready',
- apiKeys: [Array],
- isDefault: true
- }
- ]
-}
-
-Database details
-- ID: cmcvwftgs00v2zq0vj3v0104j
-- Created at: 2025-07-09T11:52:15.341Z
-- API key: ey...
-- Prisma Postgres connection string: prisma+postgres://accelerate.prisma-data.net/?api_key=ey...
-- Direct TCP connection: db.prisma.io:5432
- - Host: db.prisma.io:5432
- - Username:
- - Password:
-```
-
-Your output of the command should look similar to the output above.
-
-## Conclusion
-
-You have now set up a TypeScript project that interacts with the Prisma Management API, creates a new project and database, and prints out all connection strings. You can extend this script to manage more resources or automate other tasks using the Management API.
diff --git a/apps/docs/content/docs.v6/guides/management-api.mdx b/apps/docs/content/docs.v6/guides/management-api.mdx
deleted file mode 100644
index e8779abd8d..0000000000
--- a/apps/docs/content/docs.v6/guides/management-api.mdx
+++ /dev/null
@@ -1,164 +0,0 @@
----
-title: Management API
-description: Learn how to use the Prisma Postgres Management API to provision and claim databases
-image: /img/guides/prisma-management-api-cover.png
-url: /v6/guides/management-api
-metaTitle: Partner Database Provisioning & User Claim Flow
-metaDescription: Learn how to use the Prisma Postgres Management API to provision and claim databases
----
-
-## Introduction
-
-This guide walks you through how to use the Prisma Postgres Management API, to power experiences like the [`npx create-db`](https://create-db.prisma.io/) command.
-
-You'll learn how to provision a Prisma Postgres database on your workspace as a partner, and how to transfer it to another user's workspace so they can "claim" the database. We'll cover how the process is secured using OAuth2, and by the end, you'll understand the full flow and how to integrate it into your own product experience.
-
-This guide references the actual implementation in the `npx create-db` CLI and Cloudflare Workers as real world examples. The repo for the `npx create-db` is [here](https://github.com/prisma/create-db), which can be used as a reference for how to use the Management API in your own projects.
-
-:::note[How does this fit into your app?]
-The two Cloudflare Workers in this guide are just reference examples. You would typically build this logic into your own backend or serverless functions.
-
-Similarly, the `npx create-db` CLI is a simple demo. In your product, you can trigger the same API calls from your own UI or onboarding flows to create a seamless experience for your users.
-:::
-
-## Core concepts
-
-Before diving into implementation, let's clarify the main concepts involved in the Management API integration:
-
-- **Management API**: A set of endpoints that allow you to programmatically provision and manage Prisma Postgres databases.
-- **Projects vs Databases**: A project is a container that can hold multiple databases. You can use this to organize databases you create e.g. by user. Projects can then be transferred to users, including all databases they contain.
-- **Authentication**: All API requests require authentication. As a partner, you authenticate provisioning calls with a service token for your workspace, and use OAuth 2 to obtain an access token for the user during the claim flow.
-- **Tokens**: There are two main types of tokens:
- - **Service token**: Issued to your partner integration, scoped to provision and manage databases on your own workspace.
- - **OAuth 2 access token**: Obtained via OAuth 2 when a user authenticates with your app; it is scoped to the user's workspace and used to transfer project/database ownership to that workspace.
-
-## How to become a partner
-
-To use the Prisma Postgres Management API, you first need to set up as a partner:
-
-1. **Request access to the Management API**: Contact the Prisma team from the [Prisma Partners page](https://www.prisma.io/partners) to request access to the Management API. You will be guided through the onboarding process.
-2. **Obtain OAuth credentials**: You can obtain your OAuth credentials in the [Prisma Console](https://console.prisma.io). See the [next section](#get-oauth-credentials) for details.
-
-For a complete list of available endpoints and details on request/response formats, see the [Prisma Management API documentation](/v6/postgres/introduction/management-api).
-
-## Get OAuth credentials
-
-To obtain a client ID and client secret, you need go through this flow:
-
-1. Open the [Prisma Console](https://console.prisma.io).
-1. Click the 🧩 **Integrations** tab in the sidenav.
-1. In the **Published Applications** section, click **New Application** button to start the flow for creating a new OAuth app.
-1. Enter a **Name**, **Description** and **Callback URL** for your OAuth app.
-1. Click **Continue**.
-
-On the next screen, you can access and save the client ID and client secret for your OAuth app.
-
-## Provisioning a database as a Partner
-
-To provision a new Prisma Postgres database for your users as a partner, follow these steps:
-
-1. **Gather required information**: Prepare the necessary details for provisioning, such as region, database name, and any other options your application requires. This information may come from user input or be determined by your application logic.
-2. **Authenticate your integration**: Use your service token to authenticate API requests from your backend. This token authenticates your app as an approved partner.
-3. **Send a database provisioning request**: Make a `POST` request to the Management API endpoint to create a new project with a default database. For example:
- ```ts
- const prismaResponse = await fetch("https://api.prisma.io/v1/projects", {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer `,
- },
- body: JSON.stringify({ region, name }),
- });
- ```
-4. **Handle the response**: If successful, the API will return the new project's details, including database connection strings and a `project_id`. Store these securely and display them to your user as needed.
-5. **(Optional) Store project metadata**: You may want to associate the `project_id` with your user in your own database for future reference.
-
-## Database claim flow
-
-Once a database is provisioned, you may want to transfer ownership to your user at a later point so they can manage it in their own Prisma workspace and go beyond the free database usage limits. This is done via the claim flow, which consists of three main steps:
-
-### Overview: How the claim flow works
-
-When a user wants to claim a database, your app will:
-
-1. Trigger the OAuth2 flow, redirecting the user to Prisma Auth. This is necessary, so your app will have the permissions to transfer the database into the user's workspace.
-2. The user authenticates and selects a workspace.
-3. Your backend receives an authorization code, exchanges it for a user access token, and calls the Management API transfer endpoint with both your integration token and the user's token.
-
-This ensures the transfer is secure and only the intended user can claim the database.
-
-### 1. Triggering the claim flow
-
-When your user wants to take ownership of a database you provisioned for them, they need to transfer it to their own Prisma Postgres workspace. This gives them full control over it.
-
-To initiate this process, provide a button or link in your app (e.g., "Claim Database" or "Transfer to My Workspace"). When clicked, your backend should:
-
-- Generate a secure `state` value to track the session and prevent CSRF attacks.
-- Construct an OAuth2 authorization URL with your client ID, redirect URI, and required scopes.
-- Redirect the user to this URL to begin the authentication flow.
-
-Example:
-
-```ts
-const authParams = new URLSearchParams({
- client_id: YOUR_CLIENT_ID,
- redirect_uri: "https://your-app.com/auth/callback", // Your callback endpoint
- response_type: "code",
- scope: "workspace:admin", // The scope of the OAuth2 authorization
- state: generateState(), // Securely track the session
-});
-const authUrl = `https://auth.prisma.io/authorize?${authParams.toString()}`;
-// Redirect the user to authUrl
-```
-
-### 2. Authenticating the user
-
-The user will be prompted to log in (if not already authenticated) and select the workspace where they want to claim the database. After successful authentication and workspace selection, Prisma Auth will redirect back to your callback endpoint with a `code` and `state` (and, in some cases, a `project_id`).
-
-### 3. Finishing the claim flow
-
-Your backend should now:
-
-1. **Exchange the authorization code for a user access token**:
-
-```ts
-const tokenResponse = await fetch("https://auth.prisma.io/token", {
- method: "POST",
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
- body: new URLSearchParams({
- grant_type: "authorization_code",
- code: code, // The code received from the callback
- redirect_uri: "https://your-app.com/auth/callback", // Must match the redirect_uri used in step 1
- client_id: YOUR_CLIENT_ID,
- client_secret: YOUR_CLIENT_SECRET,
- }).toString(),
-});
-const tokenData = await tokenResponse.json();
-```
-
-2. **Call the Management API transfer endpoint** to move the project to the selected workspace. You will need the `project_id` and the user's access token:
-
-```ts
-const transferResponse = await fetch(`https://api.prisma.io/v1/projects/${project_id}/transfer`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${PRISMA_SERVICE_TOKEN}`,
- },
- body: JSON.stringify({ recipientAccessToken: tokenData.access_token }),
-});
-```
-
-If the transfer is successful, the database is now owned by the user's workspace.
-
-## Conclusion
-
-By following this guide, you have learned how to:
-
-- Set up as a Prisma Postgres Partner and obtain the necessary credentials
-- Provision a new database for your users using the Management API
-- Implement a secure claim flow that allows users to claim ownership of a database in their own workspace using OAuth2
-
-This flow enables you to integrate Prisma Postgres provisioning and transfer seamlessly into your own product, providing a smooth onboarding experience for your users.
-
-For further details, see the [create-db](https://github.com/prisma/create-db) repo for a reference implementation, or consult the [Prisma Management API documentation](/v6/postgres/introduction/management-api).
diff --git a/apps/docs/content/docs.v6/guides/meta.json b/apps/docs/content/docs.v6/guides/meta.json
deleted file mode 100644
index 35084fa64a..0000000000
--- a/apps/docs/content/docs.v6/guides/meta.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "title": "Guides",
- "root": true,
- "pages": [
- "index",
- "---Frameworks---",
- "nextjs",
- "astro",
- "nuxt",
- "sveltekit",
- "solid-start",
- "react-router-7",
- "tanstack-start",
- "nestjs",
- "hono",
- "elysia",
- "bun",
- "---Deployment---",
- "cloudflare-workers",
- "cloudflare-d1",
- "docker",
- "turborepo",
- "use-prisma-in-pnpm-workspaces",
- "---Authentication---",
- "authjs-nextjs",
- "betterauth-nextjs",
- "betterauth-astro",
- "clerk-nextjs",
- "clerk-astro",
- "---Integrations---",
- "ai-sdk-nextjs",
- "embed-studio-nextjs",
- "github-actions",
- "vercel-app-deployment",
- "deno-integration",
- "data-dog",
- "permit-io-access-control",
- "shopify",
- "neon-accelerate",
- "supabase-accelerate",
- "---Database & Schema---",
- "multiple-databases",
- "data-migration",
- "implementing-schema-changes",
- "---Migrations---",
- "migrate-from-drizzle",
- "migrate-from-typeorm",
- "migrate-from-sequelize",
- "migrate-from-mongoose",
- "---Other---",
- "management-api-basic",
- "management-api",
- "making-guides"
- ]
-}
diff --git a/apps/docs/content/docs.v6/guides/migrate-from-drizzle.mdx b/apps/docs/content/docs.v6/guides/migrate-from-drizzle.mdx
deleted file mode 100644
index b6a6fd36c5..0000000000
--- a/apps/docs/content/docs.v6/guides/migrate-from-drizzle.mdx
+++ /dev/null
@@ -1,551 +0,0 @@
----
-title: Drizzle
-description: Learn how to migrate from Drizzle to Prisma ORM
-image: /img/guides/migrate-from-drizzle-cover.png
-url: /v6/guides/migrate-from-drizzle
-metaTitle: How to migrate from Drizzle to Prisma ORM
-metaDescription: Learn how to migrate from Drizzle to Prisma ORM
----
-
-## Introduction
-
-This guide shows you how to migrate your application from Drizzle to Prisma ORM. We'll use a sample project based off of the [Drizzle Next.js example](https://orm.drizzle.team/docs/tutorials/drizzle-nextjs-neon) to demonstrate the migration steps. You can find the example used for this guide on [GitHub](https://github.com/prisma/migrate-from-drizzle-to-prisma).
-
-You can learn how Prisma ORM compares to Drizzle on the [Prisma ORM vs Drizzle](/v6/orm/more/comparisons/prisma-and-drizzle) page.
-
-## Prerequisites
-
-Before starting this guide, make sure you have:
-
-- A Drizzle project you want to migrate
-- Node.js installed (version 16 or higher)
-- PostgreSQL or another supported database
-- Basic familiarity with Drizzle and Next.js
-
-:::note
-
-this migration guide uses Neon PostgreSQL as the example database, but it equally applies to any other relational database that are [supported by Prisma ORM](/v6/orm/reference/supported-databases).
-
-:::
-
-You can learn how Prisma ORM compares to Drizzle on the [Prisma ORM vs Drizzle](/v6/orm/more/comparisons/prisma-and-drizzle) page.
-
-## Overview of the migration process
-
-Note that the steps for migrating from Drizzle to Prisma ORM are always the same, no matter what kind of application or API layer you're building:
-
-1. Install the Prisma CLI
-1. Introspect your database
-1. Create a baseline migration
-1. Install Prisma Client
-1. Gradually replace your Drizzle queries with Prisma Client
-
-These steps apply, no matter if you're building a REST API (e.g. with Express, koa or NestJS), a GraphQL API (e.g. with Apollo Server, TypeGraphQL or Nexus) or any other kind of application that uses Drizzle for database access.
-
-Prisma ORM lends itself really well for **incremental adoption**. This means, you don't have to migrate your entire project from Drizzle to Prisma ORM at once, but rather you can _step-by-step_ move your database queries from Drizzle to Prisma ORM.
-
-## Step 1. Install the Prisma CLI
-
-The first step to adopt Prisma ORM is to [install the Prisma CLI](/v6/orm/tools/prisma-cli#installation) in your project:
-
-```npm
-npm install prisma @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-## Step 2. Introspect your database
-
-### 2.1. Set up Prisma ORM
-
-Before you can introspect your database, you need to set up your [Prisma schema](/v6/orm/prisma-schema/overview) and connect Prisma to your database. Run the following command in the root of your project to create a basic Prisma schema file:
-
-```npm
-npx prisma init --output ../generated/prisma
-```
-
-This command created a new directory called `prisma` with the following files for you:
-
-- `schema.prisma`: Your Prisma schema that specifies your database connection and models
-- `.env`: A [`dotenv`](https://github.com/motdotla/dotenv) to configure your database connection URL as an environment variable
-
-:::note
-
-You may already have a `.env` file. If so, the `prisma init` command will append lines to it rather than creating a new file.
-
-:::
-
-The Prisma schema currently looks as follows:
-
-```prisma title="prisma/schema.prisma" showLineNumbers
-// This is your Prisma schema file,
-// learn more about it in the docs: https://pris.ly/d/prisma-schema
-
-datasource db {
- provider = "postgresql"
-}
-
-generator client {
- provider = "prisma-client"
- output = "./generated/prisma"
-}
-```
-
-:::tip
-
-If you're using VS Code, be sure to install the [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) for syntax highlighting, formatting, auto-completion and a lot more cool features.
-
-:::
-
-### 2.2. Connect your database
-
-If you're not using PostgreSQL, you need to adjust the `provider` field on the `datasource` block to the database you currently use:
-
-```prisma title="schema.prisma" showLineNumbers tab="PostgreSQL"
-datasource db {
- provider = "postgresql"
-}
-```
-
-```prisma title="schema.prisma" showLineNumbers tab="MySQL"
-datasource db {
- provider = "mysql"
-}
-```
-
-```prisma title="schema.prisma" showLineNumbers tab="Microsoft SQL Server"
-datasource db {
- provider = "sqlserver"
-}
-```
-
-```prisma title="schema.prisma" showLineNumbers tab="SQLite"
-datasource db {
- provider = "sqlite"
-}
-```
-
-Once that's done, you can configure your [database connection URL](/v6/orm/reference/connection-urls) in the `.env` file. Drizzle and Prisma ORM use the same format for connection URLs, so your existing connection URL should work fine.
-
-### 2.3. Configure Prisma
-
-Create a `prisma.config.ts` file in the root of your project with the following content:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-You'll need to install the `dotenv` package to load environment variables. If you haven't already, install it using your package manager:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-### 2.4. Introspect your database using Prisma ORM
-
-With your connection URL in place, you can [introspect](/v6/orm/prisma-schema/introspection) your database to generate your Prisma models:
-
-```npm
-npx prisma db pull
-```
-
-If you're using the [sample project](https://github.com/prisma/migrate-from-drizzle-to-prisma) the following model would be created:
-
-```prisma title="prisma/schema.prisma" showLineNumbers
-model todo {
- id Int @id
- text String
- done Boolean @default(false)
-}
-```
-
-The generated Prisma model represents a database table. Prisma models are the foundation for your programmatic Prisma Client API which allows you to send queries to your database.
-
-### 2.5. Create a baseline migration
-
-To continue using Prisma Migrate to evolve your database schema, you will need to [baseline your database](/v6/orm/prisma-migrate/getting-started).
-
-First, create a `migrations` directory and add a directory inside with your preferred name for the migration. In this example, we will use `0_init` as the migration name:
-
-```bash
-mkdir -p prisma/migrations/0_init
-```
-
-Next, generate the migration file with `prisma migrate diff`. Use the following arguments:
-
-- `--from-empty`: assumes the data model you're migrating from is empty
-- `--to-schema`: the current database state using the URL in the `datasource` block
-- `--script`: output a SQL script
-
-```npm
-npx prisma migrate diff --from-empty --to-schema prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
-```
-
-Review the generated migration to ensure everything is correct.
-
-Next, mark the migration as applied using `prisma migrate resolve` with the `--applied` argument.
-
-```npm
-npx prisma migrate resolve --applied 0_init
-```
-
-The command will mark `0_init` as applied by adding it to the `_prisma_migrations` table.
-
-You now have a baseline for your current database schema. To make further changes to your database schema, you can update your Prisma schema and use `prisma migrate dev` to apply the changes to your database.
-
-### 2.6. Adjust the Prisma schema (optional)
-
-Models that are generated via introspection currently _exactly_ map to your database tables. In this section, you'll learn how you can adjust the naming of the Prisma models to adhere to [Prisma ORM's naming conventions](/v6/orm/reference/prisma-schema-reference#naming-conventions).
-
-All of these adjustment are entirely optional and you are free to skip to the next step already if you don't want to adjust anything for now. You can go back and make the adjustments at any later point.
-
-As opposed to the current camelCase notation of Drizzle models, Prisma ORM's naming conventions are:
-
-- PascalCase for model names
-- camelCase for field names
-
-You can adjust the naming by _mapping_ the Prisma model and field names to the existing table and column names in the underlying database using `@@map` and `@map`.
-
-Here's an example on how you could modify the model above:
-
-```prisma title="prisma/schema.prisma" showLineNumbers
-model Todo {
- id Int @id
- text String
- done Boolean @default(false)
-
- @@map("todo")
-}
-```
-
-## Step 3. Generate Prisma Client
-
-Now that you have installed Prisma Client in Step 1, you need to run `generate` in order to have your schema reflected in TypeScript types and autocomplete.
-
-```npm
-npx prisma generate
-```
-
-## Step 4. Replace your Drizzle queries with Prisma Client
-
-In this section, we'll show a few sample queries that are being migrated from Drizzle to Prisma Client based on the example routes from the sample REST API project. For a comprehensive overview of how the Prisma Client API differs from Drizzle, check out the [comparison page](/v6/orm/more/comparisons/prisma-and-drizzle#).
-
-First, to set up the `PrismaClient` instance that you'll use to send database queries from the various route handlers. Create a new file named `prisma.ts` in the `db` directory:
-
-```bash copy
-touch db/prisma.ts
-```
-
-Now, instantiate `PrismaClient` and export it from the file so you can use it in your route handlers later:
-
-```ts copy title="db/prisma.ts" showLineNumbers
-import { PrismaClient } from "../generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-import "dotenv/config";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL,
-});
-
-export const prisma = new PrismaClient({
- adapter,
-});
-```
-
-### 4.1. Replacing `getData` queries
-
-The fullstack Next.js app has several `actions` including `getData`.
-
-The `getData` action is currently implemented as follows:
-
-```ts title="actions/todoActions.ts" showLineNumbers
-import db from "@/db/drizzle";
-import { todo } from "@/db/schema";
-
-export const getData = async () => {
- const data = await db.select().from(todo);
- return data;
-};
-```
-
-Here is the same action implemented using Prisma Client:
-
-```ts title="src/controllers/FeedAction.ts" showLineNumbers
-import { prisma } from "@/db/prisma";
-
-export const getData = async () => {
- const data = await prisma.todo.findMany();
- return data;
-};
-```
-
-### 4.2. Replacing queries in `POST` requests
-
-The [sample project](https://github.com/prisma/migrate-from-drizzle-to-prisma) has four actions that are utilized during `POST` requests:
-
-- `addTodo`: Creates a new `Todo` record
-- `deleteTodo`: Deletes an existing `Todo` record
-- `toggleTodo`: Toggles the boolean `done` field on an existing `Todo` record
-- `editTodo`: Edits the `text` field on an existing `Todo` record
-
-#### `addTodo`
-
-The `addTodo` action is currently implemented as follows:
-
-```ts title="actions/todoActions.ts" showLineNumbers
-import { revalidatePath } from "next/cache";
-
-import db from "@/db/drizzle";
-import { todo } from "@/db/schema";
-
-export const addTodo = async (id: number, text: string) => {
- await db.insert(todo).values({
- id: id,
- text: text,
- });
- revalidatePath("/");
-};
-```
-
-Here is the same action implemented using Prisma Client:
-
-```ts title="actions/todoActions.ts" showLineNumbers
-import { revalidatePath } from "next/cache";
-
-import { prisma } from "@/db/prisma";
-
-export const addTodo = async (id: number, text: string) => {
- await prisma.todo.create({
- data: { id, text },
- });
- revalidatePath("/");
-};
-```
-
-#### `deleteTodo`
-
-The `deleteTodo` action is currently implemented as follows:
-
-```ts title="actions/todoActions.ts" showLineNumbers
-import { eq } from "drizzle-orm";
-import { revalidatePath } from "next/cache";
-
-import db from "@/db/drizzle";
-import { todo } from "@/db/schema";
-
-export const deleteTodo = async (id: number) => {
- await db.delete(todo).where(eq(todo.id, id));
- revalidatePath("/");
-};
-```
-
-Here is the same action implemented using Prisma Client:
-
-```ts title="actions/todoActions.ts" showLineNumbers
-import { revalidatePath } from "next/cache";
-
-import { prisma } from "@/db/prisma";
-
-export const deleteTodo = async (id: number) => {
- await prisma.todo.delete({ where: { id } });
- revalidatePath("/");
-};
-```
-
-#### `toggleTodo`
-
-The `ToggleTodo` action is currently implemented as follows:
-
-```ts title="actions/todoActions.ts" showLineNumbers
-import { eq, not } from "drizzle-orm";
-import { revalidatePath } from "next/cache";
-
-import db from "@/db/drizzle";
-import { todo } from "@/db/schema";
-
-export const toggleTodo = async (id: number) => {
- await db
- .update(todo)
- .set({
- done: not(todo.done),
- })
- .where(eq(todo.id, id));
- revalidatePath("/");
-};
-```
-
-Here is the same action implemented using Prisma Client:
-
-```ts title="actions/todoActions.ts" showLineNumbers
-import { revalidatePath } from "next/cache";
-
-import { prisma } from "@/db/prisma";
-
-export const toggleTodo = async (id: number) => {
- const todo = await prisma.todo.findUnique({ where: { id } });
- if (todo) {
- await prisma.todo.update({
- where: { id: todo.id },
- data: { done: !todo.done },
- });
- revalidatePath("/");
- }
-};
-```
-
-Note that Prisma ORM does not have the ability to edit a boolean field "in place", so the record must be fetched before hand.
-
-#### `editTodo`
-
-The `editTodo` action is currently implemented as follows:
-
-```ts title="actions/todoActions.ts" showLineNumbers
-import { eq } from "drizzle-orm";
-import { revalidatePath } from "next/cache";
-
-import db from "@/db/drizzle";
-import { todo } from "@/db/schema";
-
-export const editTodo = async (id: number, text: string) => {
- await db
- .update(todo)
- .set({
- text: text,
- })
- .where(eq(todo.id, id));
-
- revalidatePath("/");
-};
-```
-
-Here is the same action implemented using Prisma Client:
-
-```ts title="actions/todoActions.ts" showLineNumbers
-import { revalidatePath } from "next/cache";
-
-import { prisma } from "@/db/prisma";
-
-export const editTodo = async (id: number, text: string) => {
- await prisma.todo.update({
- where: { id },
- data: { text },
- });
- revalidatePath("/");
-};
-```
-
-## More
-
-### Implicit many-to-many relations
-
-Unlike Drizzle, Prisma ORM allows you to [model many-to-many relations _implicitly_](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations). That is, a many-to-many relation where you do not have to manage the [relation table](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#relation-tables) (also sometimes called JOIN table) _explicitly_ in your schema. Here is an example comparing Drizzle with Prisma ORM:
-
-```ts title="schema.ts"
-import { boolean, integer, pgTable, serial, text } from "drizzle-orm/pg-core";
-
-export const posts = pgTable("post", {
- id: serial("serial").primaryKey(),
- title: text("title").notNull(),
- content: text("content"),
- published: boolean("published").default(false).notNull(),
-});
-
-export const categories = pgTable("category", {
- id: serial("serial").primaryKey(),
- name: text("name").notNull(),
-});
-
-export const postsToCategories = pgTable("posts_to_categories", {
- postId: integer("post_id")
- .notNull()
- .references(() => users.id),
- categoryId: integer("category_id")
- .notNull()
- .references(() => chatGroups.id),
-});
-```
-
-This schema is equivalent to the following Prisma schema:
-
-```prisma title="schema.prisma"
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean @default(false)
- postsToCategories PostToCategories[]
-
- @@map("post")
-}
-
-model Category {
- id Int @id @default(autoincrement())
- name String
- postsToCategories PostToCategories[]
-
- @@map("category")
-}
-
-model PostToCategories {
- postId Int
- categoryId Int
- category Category @relation(fields: [categoryId], references: [id])
- post Post @relation(fields: [postId], references: [id])
-
- @@id([postId, categoryId])
- @@index([postId])
- @@index([categoryId])
- @@map("posts_to_categories")
-}
-```
-
-In this Prisma schema, the many-to-many relation is modeled _explicitly_ via the relation table `PostToCategories`.
-
-By instead adhering to the conventions for Prisma ORM relation tables, the relation could look as follows:
-
-```prisma title="schema.prisma" showLineNumbers
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean @default(false)
- categories Category[]
-}
-
-model Category {
- id Int @id @default(autoincrement())
- name String
- posts Post[]
-}
-```
-
-This would also result in a more ergonomic and less verbose Prisma Client API to modify the records in this relation, because you have a direct path from `Post` to `Category` (and the other way around) instead of needing to traverse the `PostToCategories` model first.
-
-:::warning
-
-If your database provider requires tables to have primary keys then you have to use explicit syntax, and manually create the join model with a primary key. This is because relation tables (JOIN tables) created by Prisma ORM (expressed via `@relation`) for many-to-many relations using implicit syntax do not have primary keys.
-
-:::
diff --git a/apps/docs/content/docs.v6/guides/migrate-from-mongoose.mdx b/apps/docs/content/docs.v6/guides/migrate-from-mongoose.mdx
deleted file mode 100644
index 9ab4a15041..0000000000
--- a/apps/docs/content/docs.v6/guides/migrate-from-mongoose.mdx
+++ /dev/null
@@ -1,396 +0,0 @@
----
-title: Mongoose
-description: Learn how to migrate from Mongoose to Prisma ORM
-image: /img/guides/migrate-from-mongoose-cover.png
-url: /v6/guides/migrate-from-mongoose
-metaTitle: How to migrate from Mongoose to Prisma ORM
-metaDescription: Learn how to migrate from Mongoose to Prisma ORM
----
-
-## Introduction
-
-This guide shows you how to migrate your application from Mongoose to Prisma ORM. We'll use a [sample project](https://github.com/prisma/migrate-from-mongoose-to-prisma) to demonstrate the migration steps.
-
-:::warning[MongoDB support for Prisma ORM v7]
-
-**MongoDB support for Prisma ORM v7 is coming in the near future.** In the meantime, please use **Prisma ORM v6.19** (the latest v6 release) when working with MongoDB.
-
-This guide uses Prisma ORM v6.19 to ensure full compatibility with MongoDB.
-
-:::
-
-You can learn how Prisma ORM compares to Mongoose on the [Prisma ORM vs Mongoose](/v6/orm/more/comparisons/prisma-and-mongoose) page.
-
-:::warning
-
-This guide currently assumes you are using **Prisma ORM v6**. Support for Prisma ORM v7 with MongoDB is in progress.
-
-:::
-
-## Prerequisites
-
-Before starting this guide, make sure you have:
-
-- A Mongoose project you want to migrate
-- Node.js installed [with the supported version](/v6/orm/more/upgrades/to-v7#minimum-supported-nodejs--typescript-versions)
-- MongoDB database (4.2+ with replica set deployment recommended)
-- Basic familiarity with Mongoose and Express.js
-
-## 1. Prepare for migration
-
-### 1.1. Understand the migration process
-
-The steps for migrating from Mongoose to Prisma ORM are always the same, no matter what kind of application or API layer you're building:
-
-1. Install the Prisma CLI
-2. Introspect your database
-3. Install and generate Prisma Client
-4. Gradually replace your Mongoose queries with Prisma Client
-
-These steps apply whether you're building a REST API (e.g., with Express, Koa, or NestJS), a GraphQL API (e.g., with Apollo Server, TypeGraphQL, or Nexus), or any other kind of application that uses Mongoose for database access.
-
-### 1.2. Install Prisma dependencies
-
-First, install the required Prisma packages:
-
-```npm
-npm install prisma@6.19 @types/node --save-dev
-```
-
-```npm
-npm install @prisma/client@6.19 dotenv
-```
-
-:::info[Why Prisma v6.19?]
-
-This is the latest stable version of Prisma ORM v6 that fully supports MongoDB. MongoDB support for Prisma ORM v7 is coming soon.
-
-You can also install `prisma@6` and `@prisma/client@6` to automatically get the latest v6 release.
-
-:::
-
-### 1.3. Set up Prisma configuration
-
-Create a new Prisma schema file:
-
-```npm
-npx prisma init --datasource-provider mongodb --output ../generated/prisma
-```
-
-This command creates:
-
-- A new directory called `prisma` that contains a `schema.prisma` file; your Prisma schema specifies your database connection and models
-- `.env`: A [`dotenv`](https://github.com/motdotla/dotenv) file at the root of your project (if it doesn't already exist), used to configure your database connection URL as an environment variable
-- `prisma.config.ts`: Configuration file for Prisma
-
-The Prisma schema uses the ESM-first `prisma-client` generator:
-
-```prisma title="prisma/schema.prisma" showLineNumbers
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "mongodb"
- url = env("DATABASE_URL")
-}
-```
-
-
-
-:::tip
-
-For an optimal development experience when working with Prisma ORM, refer to [editor setup](/v6/orm/more/dev-environment/editor-setup) to learn about syntax highlighting, formatting, auto-completion, and many more cool features.
-
-:::
-
-Update the `DATABASE_URL` in the `.env` file with your MongoDB connection string:
-
-```text
-DATABASE_URL="mongodb+srv://username:password@cluster.mongodb.net/mydb"
-```
-
-:::tip
-
-Replace `username`, `password`, `cluster`, and `mydb` with your actual MongoDB credentials and database name. You can get your connection string from [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) or your MongoDB deployment.
-
-:::
-
-### 1.4. Configure Prisma
-
-The generated `prisma.config.ts` file should look like this:
-
-```typescript title="prisma.config.ts"
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- engine: "classic",
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Add `dotenv` to load environment variables from your `.env` file:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- engine: "classic",
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-## 2. Migrate the database schema
-
-### 2.1. Introspect your database
-
-:::warning
-
-MongoDB is a _schemaless_ database. To incrementally adopt Prisma ORM in your project, ensure your database is populated with sample data. Prisma ORM introspects a MongoDB schema by sampling data stored and inferring the schema from the data in the database.
-
-:::
-
-Run Prisma's introspection to create the Prisma schema from your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This will create a `schema.prisma` file with your database schema.
-
-```prisma title="prisma/schema.prisma" showLineNumbers
-type UsersProfile {
- bio String
-}
-
-model categories {
- id String @id @default(auto()) @map("_id") @db.ObjectId
- v Int @map("__v")
- name String
-}
-
-model posts {
- id String @id @default(auto()) @map("_id") @db.ObjectId
- v Int @map("__v")
- author String @db.ObjectId
- categories String[] @db.ObjectId
- content String
- published Boolean
- title String
-}
-
-model users {
- id String @id @default(auto()) @map("_id") @db.ObjectId
- v Int @map("__v")
- email String @unique(map: "email_1")
- name String
- profile UsersProfile?
-}
-```
-
-### 2.2. Update relations
-
-MongoDB doesn't support relations between different collections. However, you can create references between documents using the [`ObjectId`](/v6/orm/overview/databases/mongodb#using-objectid) field type or from one document to many using an array of `ObjectIds` in the collection. The reference will store id(s) of the related document(s). You can use the `populate()` method that Mongoose provides to populate the reference with the data of the related document.
-
-Update the 1-n relationship between `posts` \<-> `users` as follows:
-
-- Rename the existing `author` reference in the `posts` model to `authorId` and add the `@map("author")` attribute
-- Add the `author` relation field in the `posts` model and it's `@relation` attribute specifying the `fields` and `references`
-- Add the `posts` relation in the `users` model
-
-Your schema should now look like this:
-
-```prisma title="schema.prisma"
-type UsersProfile {
- bio String
-}
-
-model categories {
- id String @id @default(auto()) @map("_id") @db.ObjectId
- v Int @map("__v")
- name String
-}
-
-model posts {
- id String @id @default(auto()) @map("_id") @db.ObjectId
- title String
- content String
- published Boolean
- v Int @map("__v")
- author String @db.ObjectId // [!code --]
- author users @relation(fields: [authorId], references: [id]) // [!code ++]
- authorId String @map("author") @db.ObjectId // [!code ++]
-
- categories String[] @db.ObjectId
-}
-
-model users {
- id String @id @default(auto()) @map("_id") @db.ObjectId
- v Int @map("__v")
- email String @unique(map: "email_1")
- name String
- profile UsersProfile?
- posts posts[] // [!code ++]
-}
-```
-
-Then, update the m-n between `posts` \<-\> `categories` references as follows:
-
-- Rename the `categories` field to `categoryIds` and map it using `@map("categories")` in the `posts` model
-- Add a new `categories` relation field in the `posts` model
-- Add the `postIds` scalar list field in the `categories` model
-- Add the `posts` relation in the `categories` model
-- Add a [relation scalar](/v6/orm/prisma-schema/data-model/relations#annotated-relation-fields) on both models
-- Add the `@relation` attribute specifying the `fields` and `references` arguments on both sides
-
-Your schema should now look like this:
-
-```prisma title="schema.prisma"
-type UsersProfile {
- bio String
-}
-
-model categories {
- id String @id @default(auto()) @map("_id") @db.ObjectId
- v Int @map("__v")
- name String
- posts posts[] @relation(fields: [postIds], references: [id]) // [!code ++]
- postIds String[] @db.ObjectId // [!code ++]
-}
-
-model posts {
- id String @id @default(auto()) @map("_id") @db.ObjectId
- title String
- content String
- published Boolean
- v Int @map("__v")
-
- author users @relation(fields: [authorId], references: [id])
- authorId String @map("author") @db.ObjectId
-
- categories String[] @db.ObjectId // [!code --]
- categories categories[] @relation(fields: [categoryIds], references: [id]) // [!code ++]
- categoryIds String[] @map("categories") @db.ObjectId // [!code ++]
-}
-
-model users {
- id String @id @default(auto()) @map("_id") @db.ObjectId
- v Int @map("__v")
- email String @unique(map: "email_1")
- name String
- profile UsersProfile?
- posts posts[]
-}
-```
-
-## 3. Update your application code
-
-### 3.1. Generate Prisma Client
-
-Generate Prisma Client based on your schema:
-
-```npm
-npx prisma generate
-```
-
-This creates a type-safe Prisma Client in the `generated/prisma` directory.
-
-### 3.2. Replace Mongoose queries
-
-Start replacing your Mongoose queries with Prisma Client. Here's an example of how to convert some common queries:
-
-```typescript tab="Mongoose"
-// Find one
-const user = await User.findById(id);
-
-// Create
-const user = await User.create({
- email: "alice@prisma.io",
- name: "Alice",
-});
-
-// Update
-await User.findByIdAndUpdate(id, {
- name: "New name",
-});
-
-// Delete
-await User.findByIdAndDelete(id);
-```
-
-```typescript tab="Prisma Client"
-// Find one
-const user = await prisma.user.findUnique({
- where: { id },
-});
-
-// Create
-const user = await prisma.user.create({
- data: {
- email: "alice@prisma.io",
- name: "Alice",
- },
-});
-
-// Update
-await prisma.user.update({
- where: { id },
- data: { name: "New name" },
-});
-
-// Delete
-await prisma.user.delete({
- where: { id },
-});
-```
-
-### 3.3. Update your controllers
-
-Update your Express controllers to use Prisma Client. For example, here's how to update a user controller:
-
-```typescript
-import { prisma } from "../client";
-
-export class UserController {
- async create(req: Request, res: Response) {
- const { email, name } = req.body;
-
- const result = await prisma.user.create({
- data: {
- email,
- name,
- },
- });
-
- return res.json(result);
- }
-}
-```
-
-## Next steps
-
-Now that you've migrated to Prisma ORM, you can:
-
-- Add more complex queries using Prisma's powerful query API
-- Set up Prisma Studio for database management
-- Implement database monitoring
-- Add automated tests using Prisma's testing utilities
-
-For more information:
-
-- [Prisma ORM documentation](/v6/orm)
-- [Prisma Client API reference](/v6/orm/prisma-client/setup-and-configuration/introduction)
diff --git a/apps/docs/content/docs.v6/guides/migrate-from-sequelize.mdx b/apps/docs/content/docs.v6/guides/migrate-from-sequelize.mdx
deleted file mode 100644
index ce9b1dc2d9..0000000000
--- a/apps/docs/content/docs.v6/guides/migrate-from-sequelize.mdx
+++ /dev/null
@@ -1,256 +0,0 @@
----
-title: Sequelize
-description: Learn how to migrate from Sequelize to Prisma ORM
-image: /img/guides/migrate-from-sequelize-cover.png
-url: /v6/guides/migrate-from-sequelize
-metaTitle: How to migrate from Sequelize to Prisma ORM
-metaDescription: Learn how to migrate from Sequelize to Prisma ORM
----
-
-## Introduction
-
-This guide shows you how to migrate your application from Sequelize to Prisma ORM. We'll use an extended version of the [Sequelize Express example](https://github.com/sequelize/express-example) as a [sample project](https://github.com/prisma/migrate-from-sequelize-to-prisma) to demonstrate the migration steps.
-
-This migration guide uses PostgreSQL as the example database, but it equally applies to any other relational database that's [supported by Prisma ORM](/v6/orm/reference/supported-databases). You can learn how Prisma ORM compares to Sequelize on the [Prisma ORM vs Sequelize](/v6/orm/more/comparisons/prisma-and-sequelize) page.
-
-## Prerequisites
-
-Before starting this guide, make sure you have:
-
-- A Sequelize project you want to migrate
-- Node.js installed (version 20 or higher)
-- PostgreSQL or another supported database
-- Basic familiarity with Sequelize and Express.js
-
-## 1. Prepare for migration
-
-### 1.1. Understand the migration process
-
-The steps for migrating from Sequelize to Prisma ORM are always the same, no matter what kind of application or API layer you're building:
-
-1. Install the Prisma CLI
-2. Introspect your database
-3. Create a baseline migration
-4. Install Prisma Client
-5. Gradually replace your Sequelize queries with Prisma Client
-
-These steps apply whether you're building a REST API (e.g., with Express, Koa, or NestJS), a GraphQL API (e.g., with Apollo Server, TypeGraphQL, or Nexus), or any other kind of application that uses Sequelize for database access.
-
-### 1.2. Set up Prisma configuration
-
-Create a new Prisma schema file:
-
-```npm
-npx prisma init --output ../generated/prisma
-```
-
-This command created a new directory called `prisma` with the following files for you:
-
-- `schema.prisma`: Your Prisma schema that specifies your database connection and models
-- `.env`: A [`dotenv`](https://github.com/motdotla/dotenv) to configure your database connection URL as an environment variable
-
-The Prisma schema currently looks as follows:
-
-```prisma title="prisma/schema.prisma" showLineNumbers
-// This is your Prisma schema file,
-// learn more about it in the docs: https://pris.ly/d/prisma-schema
-
-datasource db {
- provider = "postgresql"
-}
-
-generator client {
- provider = "prisma-client"
- output = "./generated/prisma"
-}
-```
-
-:::tip
-
-If you're using VS Code, be sure to install the [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) for syntax highlighting, formatting, auto-completion and a lot more cool features.
-
-:::
-
-Update the `DATABASE_URL` in the `.env` file with your database connection string:
-
-```text
-DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE"
-```
-
-### 1.3. Configure Prisma
-
-Create a `prisma.config.ts` file in the root of your project with the following content:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-You'll need to install the `dotenv` package to load environment variables. If you haven't already, install it using your package manager:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-## 2. Migrate the database schema
-
-### 2.1. Introspect your database
-
-Run Prisma's introspection to create the Prisma schema from your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This will create a `schema.prisma` file with your database schema.
-
-### 2.2. Create a baseline migration
-
-To continue using Prisma Migrate to evolve your database schema, you will need to [baseline your database](/v6/orm/prisma-migrate/getting-started).
-
-First, create a `migrations` directory and add a directory inside with your preferred name for the migration. In this example, we will use `0_init` as the migration name:
-
-```bash
-mkdir -p prisma/migrations/0_init
-```
-
-Next, generate the migration file with `prisma migrate diff`. Use the following arguments:
-
-- `--from-empty`: assumes the data model you're migrating from is empty
-- `--to-schema`: the current database state using the URL in the `datasource` block
-- `--script`: output a SQL script
-
-```npm
-npx prisma migrate diff --from-empty --to-schema prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
-```
-
-```npm
-npx prisma migrate resolve --applied 0_init
-```
-
-The command will mark `0_init` as applied by adding it to the `_prisma_migrations` table.
-
-You now have a baseline for your current database schema. To make further changes to your database schema, you can update your Prisma schema and use `prisma migrate dev` to apply the changes to your database.
-
-## 3. Update your application code
-
-### 3.1. Install Prisma Client
-
-As a next step, you can install Prisma Client in your project so that you can start replacing the database queries in your project that are currently made with Sequelize:
-
-```npm
-npm install @prisma/client
-```
-
-After installing Prisma Client, you can generate the Prisma Client code:
-
-```npm
-npx prisma generate
-```
-
-### 3.2. Replace Sequelize queries
-
-In this section, we'll show a few sample queries that are being migrated from Sequelize to Prisma Client based on the example routes from the sample REST API project. For a comprehensive overview of how the Prisma Client API differs from Sequelize, check out the [API comparison](/v6/orm/more/comparisons/prisma-and-sequelize#api-comparison) page.
-
-```typescript tab="Sequelize"
-// Find one
-const user = await User.findOne({
- where: { id: 1 },
-});
-
-// Create
-const user = await User.create({
- email: "alice@prisma.io",
- name: "Alice",
-});
-
-// Update
-await User.update(
- { name: "New name" },
- {
- where: { id: 1 },
- },
-);
-
-// Delete
-await User.destroy({
- where: { id: 1 },
-});
-```
-
-```typescript tab="Prisma Client"
-// Find one
-const user = await prisma.user.findUnique({
- where: { id: 1 },
-});
-
-// Create
-const user = await prisma.user.create({
- data: {
- email: "alice@prisma.io",
- name: "Alice",
- },
-});
-
-// Update
-await prisma.user.update({
- where: { id: 1 },
- data: { name: "New name" },
-});
-
-// Delete
-await prisma.user.delete({
- where: { id: 1 },
-});
-```
-
-### 3.3. Update your controllers
-
-Update your Express controllers to use Prisma Client. For example, here's how to update a user controller:
-
-```typescript
-import { prisma } from "../client";
-
-export class UserController {
- async create(req: Request, res: Response) {
- const { email, name } = req.body;
-
- const result = await prisma.user.create({
- data: {
- email,
- name,
- },
- });
-
- return res.json(result);
- }
-}
-```
-
-## Next steps
-
-Now that you've migrated to Prisma ORM, you can:
-
-- Add more complex queries using Prisma's powerful query API
-- Set up Prisma Studio for database management
-- Implement database monitoring
-- Add automated tests using Prisma's testing utilities
-
-For more information:
-
-- [Prisma ORM documentation](/v6/orm)
-- [Prisma Client API reference](/v6/orm/prisma-client/setup-and-configuration/introduction)
diff --git a/apps/docs/content/docs.v6/guides/migrate-from-typeorm.mdx b/apps/docs/content/docs.v6/guides/migrate-from-typeorm.mdx
deleted file mode 100644
index 4683fca648..0000000000
--- a/apps/docs/content/docs.v6/guides/migrate-from-typeorm.mdx
+++ /dev/null
@@ -1,228 +0,0 @@
----
-title: TypeORM
-description: Learn how to migrate from TypeORM to Prisma ORM
-image: /img/guides/migrate-from-typeorm-cover.png
-url: /v6/guides/migrate-from-typeorm
-metaTitle: How to migrate from TypeORM to Prisma ORM
-metaDescription: Learn how to migrate from TypeORM to Prisma ORM
----
-
-## Introduction
-
-This guide shows you how to migrate your application from TypeORM to Prisma ORM. We'll use an extended version of the [TypeORM Express example](https://github.com/typeorm/typescript-express-example/) as a [sample project](https://github.com/prisma/migrate-from-typeorm-to-prisma) to demonstrate the migration steps.
-
-This migration guide uses PostgreSQL as the example database, but it equally applies to any other relational database that's [supported by Prisma ORM](/v6/orm/reference/supported-databases). You can learn how Prisma ORM compares to TypeORM on the [Prisma ORM vs TypeORM](/v6/orm/more/comparisons/prisma-and-typeorm) page.
-
-## Prerequisites
-
-Before starting this guide, make sure you have:
-
-- A TypeORM project you want to migrate
-- Node.js installed (version 16 or higher)
-- PostgreSQL or another supported database
-- Basic familiarity with TypeORM and Express.js
-
-## 2. Prepare for migration
-
-### 2.1. Understand the migration process
-
-The steps for migrating from TypeORM to Prisma ORM are always the same, no matter what kind of application or API layer you're building:
-
-1. Install the Prisma CLI
-2. Introspect your database
-3. Create a baseline migration
-4. Install Prisma Client
-5. Gradually replace your TypeORM queries with Prisma Client
-
-These steps apply whether you're building a REST API (e.g., with Express, Koa, or NestJS), a GraphQL API (e.g., with Apollo Server, TypeGraphQL, or Nexus), or any other kind of application that uses TypeORM for database access.
-
-### 2.2. Set up Prisma configuration
-
-Create a new Prisma schema file:
-
-```npm
-npx prisma init --output ../generated/prisma
-```
-
-Update the `DATABASE_URL` in the `.env` file with your database connection string:
-
-```text
-DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE"
-```
-
-### 2.3. Configure Prisma
-
-Create a `prisma.config.ts` file in the root of your project with the following content:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-You'll need to install the `dotenv` package to load environment variables. If you haven't already, install it using your package manager:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-## 3. Migrate the database schema
-
-### 3.1. Introspect your database
-
-Run Prisma's introspection to create the Prisma schema from your existing database:
-
-```npm
-npx prisma db pull
-```
-
-This will create a `schema.prisma` file with your database schema.
-
-### 3.2. Create a baseline migration
-
-Create and apply a baseline migration to mark the current state of your database:
-
-```npm
-npx prisma migrate diff --from-empty --to-schema prisma/schema.prisma --script > baseline.sql
-```
-
-```npm
-npx prisma migrate resolve --applied "baseline"
-```
-
-## 4. Update your application code
-
-### 4.1. Install Prisma Client
-
-Install the Prisma Client package:
-
-```npm
-npm install @prisma/client
-```
-
-Generate Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-### 4.2. Replace TypeORM queries
-
-Start replacing your TypeORM queries with Prisma Client. Here's an example of how to convert some common queries:
-
-```typescript tab="TypeORM"
-// Find one
-const user = await userRepository.findOne({
- where: { id: 1 },
-});
-
-// Create
-const user = await userRepository.save({
- email: "alice@prisma.io",
- name: "Alice",
-});
-
-// Update
-await userRepository.update(1, {
- name: "New name",
-});
-
-// Delete
-await userRepository.delete(1);
-```
-
-```typescript tab="Prisma Client"
-// Find one
-const user = await prisma.user.findUnique({
- where: { id: 1 },
-});
-
-// Create
-const user = await prisma.user.create({
- data: {
- email: "alice@prisma.io",
- name: "Alice",
- },
-});
-
-// Update
-await prisma.user.update({
- where: { id: 1 },
- data: { name: "New name" },
-});
-
-// Delete
-await prisma.user.delete({
- where: { id: 1 },
-});
-```
-
-### 4.3. Update your controllers
-
-Update your Express controllers to use Prisma Client. For example, here's how to update the `CreateUserAction`:
-
-```typescript
-import { prisma } from "../client";
-
-export class CreateUserAction {
- async run(req: Request, res: Response) {
- const { email, name } = req.body;
-
- const result = await prisma.user.create({
- data: {
- email,
- name,
- },
- });
-
- return res.json(result);
- }
-}
-```
-
-## 5. Test and deploy
-
-### 5.1. Test your changes
-
-Test all migrated endpoints to ensure they work as expected:
-
-```npm
-npm test
-```
-
-### 5.2. Deploy your changes
-
-1. Deploy your schema changes:
-
-```npm
-npx prisma migrate deploy
-```
-
-2. Deploy your application code with the updated dependencies.
-
-## Next steps
-
-Now that you've migrated to Prisma ORM, you can:
-
-- Add more complex queries using Prisma's powerful query API
-- Set up Prisma Studio for database management
-- Implement database monitoring
-- Add automated tests using Prisma's testing utilities
-
-For more information:
-
-- [Prisma ORM documentation](/v6/orm)
-- [Prisma Client API reference](/v6/orm/prisma-client/setup-and-configuration/introduction)
diff --git a/apps/docs/content/docs.v6/guides/multiple-databases.mdx b/apps/docs/content/docs.v6/guides/multiple-databases.mdx
deleted file mode 100644
index b2b5c31757..0000000000
--- a/apps/docs/content/docs.v6/guides/multiple-databases.mdx
+++ /dev/null
@@ -1,463 +0,0 @@
----
-title: Multiple databases
-description: 'Learn how to use multiple Prisma Clients in a single app to connect to multiple databases, handle migrations, and deploy your application to Vercel.'
-image: /img/guides/multiple-databases.png
-url: /v6/guides/multiple-databases
-metaTitle: How to use Prisma ORM with multiple databases in a single app
-metaDescription: 'Learn how to use multiple Prisma Clients in a single app to connect to multiple databases, handle migrations, and deploy your application to Vercel.'
----
-
-## Introduction
-
-This guide shows you how to use multiple databases using Prisma ORM in a single [Next.js app](https://nextjs.org/). You will learn how to connect to two different Prisma Postgres databases, manage migrations, and deploy your application to Vercel. This approach is useful for multi-tenant applications or when you need to separate concerns when managing connections to multiple databases.
-
-## Prerequisites
-
-Before you begin, make sure that you have the following:
-
-- Node.js 20+ installed.
-- A [Prisma Data Platform account](https://pris.ly/pdp?utm_campaign=multi-client&utm_source=docs).
-- A Vercel account (if you plan to deploy your application).
-
-## 1. Set up a Next.js project
-
-Create a new Next.js app using `create-next-app` from your desired directory:
-
-```npm
-npx create-next-app@latest my-multi-client-app
-```
-
-You will be prompted to answer a few questions about your project. Select all of the defaults.
-
-:::info
-
-For completeness, those are:
-
-- TypeScript
-- ESLint
-- Tailwind CSS
-- No `src` directory
-- App Router
-- Turbopack
-- Default custom import alias: `@/*`
-
-:::
-
-Then, navigate to the project directory:
-
-```bash
-cd my-multi-client-app
-```
-
-## 2. Set up your databases and Prisma Clients
-
-In this section, you will create two separate Prisma Postgres instances—one for user data and one for post data. You will also configure the Prisma schema and environment variables for each.
-
-First, install Prisma and the required dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-You have installed the required dependencies for the project.
-
-### 2.1. Create a Prisma Postgres instance to contain user data
-
-Initialize Prisma with a [Prisma Postgres](/v6/postgres) instance by running:
-
-```npm
-npx prisma@latest init --db
-```
-
-:::info
-
-If you are not using a Prisma Postgres database, do not use the `--db` flag. Instead, create two PostgreSQL database instances and add their connection URLs to the `.env` file as `PPG_USER_DATABASE_URL` and `PPG_POST_DATABASE_URL`.
-
-:::
-
-Follow the prompts to name your project and choose a database region.
-
-The `prisma@latest init --db` command:
-
-- Connects your CLI to your [Prisma Data Platform](https://console.prisma.io) account. If you are not logged in or do not have an account, your browser will open to guide you through creating a new account or signing into your existing one.
-- Creates a `prisma` directory containing a `schema.prisma` file for your database models.
-- Creates a `.env` file with your `DATABASE_URL` (e.g., `DATABASE_URL="postgresql://user:password@host:5432/database?sslmode=require"`).
-
-Rename the `prisma` folder to `prisma-user-database`:
-
-```bash
-mv prisma prisma-user-database
-```
-
-Edit your `.env` file to rename `DATABASE_URL` to `PPG_USER_DATABASE_URL`:
-
-```bash title=".env"
-DATABASE_URL="postgresql://user:password@host:5432/database?sslmode=require" # [!code --]
-PPG_USER_DATABASE_URL="postgresql://user:password@host:5432/database?sslmode=require" # [!code ++]
-```
-
-Open `prisma-user-database/schema.prisma` file and update it to define a `User` model. Also, set the environment variable and specify a [custom `output` directory](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path) for the generated Prisma Client:
-
-```prisma title="prisma-user-database/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../prisma-user-database/user-database-client-types" // [!code ++]
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
-} // [!code ++]
-```
-
-Create a `prisma.config.ts` file for the user database:
-
-```typescript title="prisma-user-database/prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config"; // [!code ++]
-
-export default defineConfig({
- // [!code ++]
- schema: "prisma-user-database/schema.prisma", // [!code ++]
- migrations: {
- // [!code ++]
- path: "prisma-user-database/migrations", // [!code ++]
- }, // [!code ++]
- datasource: {
- // [!code ++]
- url: env("PPG_USER_DATABASE_URL"), // [!code ++]
- }, // [!code ++]
-}); // [!code ++]
-```
-
-:::note
-
-You'll need to install the `dotenv` package if you haven't already:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-Your user database schema is now ready.
-
-### 2.2. Create a Prisma Postgres instance for post data
-
-Repeat the initialization for the post database:
-
-```npm
-npx prisma init --db
-```
-
-After following the prompts, rename the new `prisma` folder to `prisma-post-database`:
-
-```bash
-mv prisma prisma-post-database
-```
-
-Rename the `DATABASE_URL` variable in `.env` to `PPG_POST_DATABASE_URL`:
-
-```bash title=".env"
-DATABASE_URL="postgresql://user:password@host:5432/database?sslmode=require" # [!code --]
-PPG_POST_DATABASE_URL="postgresql://user:password@host:5432/database?sslmode=require" # [!code ++]
-```
-
-Edit the `prisma-post-database/schema.prisma` file to define a `Post` model. Also, update the datasource URL and set a [custom `output` directory](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path):
-
-```prisma title="prisma-post-database/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../prisma-post-database/post-database-client-types" // [!code ++]
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
-} // [!code ++]
-```
-
-Create a `prisma.config.ts` file for the post database:
-
-```typescript title="prisma-post-database/prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config"; // [!code ++]
-
-export default defineConfig({
- // [!code ++]
- schema: "prisma-post-database/schema.prisma", // [!code ++]
- migrations: {
- // [!code ++]
- path: "prisma-post-database/migrations", // [!code ++]
- }, // [!code ++]
- datasource: {
- // [!code ++]
- url: env("PPG_POST_DATABASE_URL"), // [!code ++]
- }, // [!code ++]
-}); // [!code ++]
-```
-
-Your post database schema is now set.
-
-### 2.3. Add helper scripts and migrate the schemas
-
-To simplify your workflow, add helper scripts to your `package.json` file that run Prisma commands for both databases:
-
-```json title="package.json"
-"script":{
- "dev": "next dev --turbopack",
- "build": "next build",
- "start": "next start",
- "lint": "next lint",
- "postinstall": "npx prisma generate --schema ./prisma-user-database/schema.prisma && npx prisma generate --schema ./prisma-post-database/schema.prisma", // [!code ++]
- "generate": "npx prisma generate --schema ./prisma-user-database/schema.prisma && npx prisma generate --schema ./prisma-post-database/schema.prisma", // [!code ++]
- "migrate": "npx prisma migrate dev --schema ./prisma-user-database/schema.prisma && npx prisma migrate dev --schema ./prisma-post-database/schema.prisma", // [!code ++]
- "deploy": "npx prisma migrate deploy --schema ./prisma-user-database/schema.prisma && npx prisma migrate deploy --schema ./prisma-post-database/schema.prisma", // [!code ++]
- "studio": "npx prisma studio --schema ./prisma-user-database/schema.prisma --port 5555 & npx prisma studio --schema ./prisma-post-database/schema.prisma --port 5556" // [!code ++]
-}
-```
-
-Here is an explanation of the custom scripts:
-
-- `postinstall`: Runs immediately after installing dependencies to generate Prisma Clients for both the user and post databases using their respective schema files.
-- `generate`: Manually triggers the generation of Prisma Clients for both schemas, ensuring your client code reflects the latest models.
-- `migrate`: Applies pending migrations in development mode for both databases using [Prisma Migrate](/v6/orm/prisma-migrate/getting-started), updating their schemas based on changes in your Prisma files.
-- `deploy`: Executes migrations in a production environment, synchronizing your live databases with your Prisma schemas.
-- `studio`: Opens Prisma Studio for both databases simultaneously on different ports (`5555` for the user database and `5556` for the post database) for visual data management.
-
-Run the migrations:
-
-```npm
-npm run migrate
-```
-
-When prompted, name the migration for each database accordingly.
-
-## 3. Prepare the application to use multiple Prisma Clients
-
-Next, create a `lib` folder to store helper files for instantiating and exporting your Prisma Clients:
-
-```bash
-mkdir -p lib && touch lib/user-prisma-client.ts lib/post-prisma-client.ts
-```
-
-### 3.1. Instantiate and export the Prisma Client for the user database
-
-In `lib/user-prisma-client.ts`, add the following code:
-
-```ts title="lib/user-prisma-client.ts"
-import { PrismaClient } from "../prisma-user-database/user-database-client-types/client"; // [!code ++]
-import { PrismaPg } from "@prisma/adapter-pg"; // [!code ++]
-
-const adapter = new PrismaPg({
- // [!code ++]
- connectionString: process.env.PPG_USER_DATABASE_URL, // [!code ++]
-}); // [!code ++]
-
-const getPrisma = () =>
- // [!code ++]
- new PrismaClient({
- // [!code ++]
- adapter, // [!code ++]
- }); // [!code ++]
-
-const globalForUserDBPrismaClient = global as unknown as {
- // [!code ++]
- userDBPrismaClient: ReturnType; // [!code ++]
-}; // [!code ++]
-
-export const userDBPrismaClient = globalForUserDBPrismaClient.userDBPrismaClient || getPrisma(); // [!code ++]
-
-if (process.env.NODE_ENV !== "production")
- // [!code ++]
- globalForUserDBPrismaClient.userDBPrismaClient = userDBPrismaClient; // [!code ++]
-```
-
-### 3.2. Instantiate and export the Prisma Client for the post database
-
-In `lib/post-prisma-client.ts`, add this code:
-
-```ts title="lib/post-prisma-client.ts"
-import { PrismaClient } from "../prisma-post-database/post-database-client-types/client"; // [!code ++]
-import { PrismaPg } from "@prisma/adapter-pg"; // [!code ++]
-
-const adapter = new PrismaPg({
- // [!code ++]
- connectionString: process.env.PPG_POST_DATABASE_URL, // [!code ++]
-}); // [!code ++]
-
-const getPrisma = () =>
- // [!code ++]
- new PrismaClient({
- // [!code ++]
- adapter, // [!code ++]
- }); // [!code ++]
-
-const globalForPostDBPrismaClient = global as unknown as {
- // [!code ++]
- postDBPrismaClient: ReturnType; // [!code ++]
-}; // [!code ++]
-
-export const postDBPrismaClient = globalForPostDBPrismaClient.postDBPrismaClient || getPrisma(); // [!code ++]
-
-if (process.env.NODE_ENV !== "production")
- // [!code ++]
- globalForPostDBPrismaClient.postDBPrismaClient = postDBPrismaClient; // [!code ++]
-```
-
-## 4. Integrate multiple Prisma Clients in your Next.js app
-
-Modify your application code to fetch data from both databases. Update the `app/page.tsx` file as follows:
-
-```ts title="app/page.tsx"
-import { postDBPrismaClient } from "@/lib/post-prisma-client"; // [!code ++]
-import { userDBPrismaClient } from "@/lib/user-prisma-client"; // [!code ++]
-
-export default async function Home() { // [!code ++]
- const user = await userDBPrismaClient.user.findFirst(); // [!code ++]
- const post = await postDBPrismaClient.post.findFirst(); // [!code ++]
-
- return ( // [!code ++]
- // [!code ++]
-
// [!code ++]
- // [!code ++]
-
Multi-DB Showcase
// [!code ++]
-
// [!code ++]
- Data fetched from two distinct databases. // [!code ++]
-
// [!code ++]
- // [!code ++]
-
- // [!code ++]
-
// [!code ++]
- User Data // [!code ++]
-
// [!code ++]
-
// [!code ++]
- {user ? JSON.stringify(user, null, 2) : "No user data available."} // [!code ++]
-
// [!code ++]
- // [!code ++]
-
- // [!code ++]
-
// [!code ++]
- Post Data // [!code ++]
-
// [!code ++]
-
// [!code ++]
- {post ? JSON.stringify(post, null, 2) : "No post data available."} // [!code ++]
-
// [!code ++]
- // [!code ++]
-
// [!code ++]
- // [!code ++]
- ); // [!code ++]
-} // [!code ++]
-```
-
-### 4.1. Populate your databases with data
-
-In a separate terminal window, open two instances of [Prisma Studio](/v6/orm/tools/prisma-studio) to add data to your databases by running the script:
-
-```npm
-npm run studio
-```
-
-This will open up two browser windows, one in `http://localhost:5555` and one in `http://localhost:5556`. Navigate to those windows and add sample data to both databases.
-
-### 4.2. Run the development server
-
-Before starting the development server, note that if you are using Next.js `v15.2.0`, do not use Turbopack as there is a known [issue](https://github.com/vercel/next.js/issues/76497). Remove Turbopack from your dev script by updating your `package.json`:
-
-```json title="package.json"
-"script":{
- "dev": "next dev --turbopack", // [!code --]
- "dev": "next dev", // [!code ++]
- "build": "next build",
- "start": "next start",
- "lint": "next lint",
- "postinstall": "npx prisma generate --schema ./prisma-user-database/schema.prisma && npx prisma generate --schema ./prisma-post-database/schema.prisma",
- "generate": "npx prisma generate --schema ./prisma-user-database/schema.prisma && npx prisma generate --schema ./prisma-post-database/schema.prisma",
- "migrate": "npx prisma migrate dev --schema ./prisma-user-database/schema.prisma && npx prisma migrate dev --schema ./prisma-post-database/schema.prisma",
- "deploy": "npx prisma migrate deploy --schema ./prisma-user-database/schema.prisma && npx prisma migrate deploy --schema ./prisma-post-database/schema.prisma",
- "studio": "npx prisma studio --schema ./prisma-user-database/schema.prisma --port 5555 & npx prisma studio --schema ./prisma-post-database/schema.prisma --port 5556"
-}
-```
-
-In a separate terminal window, start the development server by running:
-
-```npm
-npm run dev
-```
-
-Navigate to `http://localhost:3000` to see your Next.js app display data from both databases:
-
-
-
-Congratulations, you have a Next.js app running with two Prisma Client instances querying different databases.
-
-## 5. Deploy your Next.js app using multiple databases to Vercel
-
-Deploy your app by following these steps:
-
-1. Ensure your project is version-controlled and pushed to a GitHub repository. If you do not have a repository yet, [create one on GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository). Once the repository is ready, run the following commands:
- ```bash
- git add .
- git commit -m "Initial commit with Prisma Postgres integration"
- git branch -M main
- git remote add origin https://github.com//.git
- git push -u origin main
- ```
- :::note
- Replace `` and `` with your GitHub username and the name of your repository.
- :::
-2. Log in to [Vercel](https://vercel.com/) and navigate to your [Dashboard](https://vercel.com/docs/deployments).
-3. Create a new project. Follow Vercel's [Import an existing project](https://vercel.com/docs/getting-started-with-vercel/import) guide, but stop at [step 3](https://vercel.com/docs/getting-started-with-vercel/import#optionally-configure-any-settings) where you will configure environment variables _before_ clicking **Deploy**.
-4. Configure the `DATABASE_URL` environment variable:
- 1. Expand the **Environment variables** section.
- 1. Add the `PPG_USER_DATABASE_URL` environment variable:
- - **Key**: `PPG_USER_DATABASE_URL`
- - **Value**: Paste your user database connection URL, e.g. by copying it from the `.env` file in your project.
- 1. Add the `PPG_POST_DATABASE_URL` environment variable:
- - **Key**: `PPG_POST_DATABASE_URL`
- - **Value**: Paste your post database connection URL, e.g. by copying it from the `.env` file in your project.
- :::warning
- Do not deploy without setting the environment variables. Your deployment will fail if the application cannot connect to the databases.
- :::
-5. Click the **Deploy** button. Vercel will build your project and deploy it to a live URL.
-
-Open the live URL provided by Vercel and verify that your application is working.
-
-Congratulations! You have deployed an application that uses multiple Prisma Clients to query two different databases, and it is now live and fully operational on Vercel.
-
-## Next steps
-
-In this guide, you learned how to use multiple databases using Prisma ORM in a single Next.js app by:
-
-- Setting up separate Prisma schemas for user and post databases.
-- Configuring custom output directories and environment variables.
-- Creating helper scripts to generate and migrate each schema.
-- Instantiating and integrating multiple Prisma Clients into your application.
-- Deploying your multi-database application to Vercel.
-
-This approach allows you to maintain a clear separation of data models and simplifies multi-tenant or multi-database scenarios.
-
-For further improvements in managing your project, consider using a monorepo setup. Check out our related guides:
-
-- [How to use Prisma ORM in a pnpm workspaces monorepo](/v6/guides/use-prisma-in-pnpm-workspaces)
-- [How to use Prisma ORM with Turborepo](/v6/guides/turborepo)
diff --git a/apps/docs/content/docs.v6/guides/neon-accelerate.mdx b/apps/docs/content/docs.v6/guides/neon-accelerate.mdx
deleted file mode 100644
index a21c32fd35..0000000000
--- a/apps/docs/content/docs.v6/guides/neon-accelerate.mdx
+++ /dev/null
@@ -1,179 +0,0 @@
----
-title: Neon with Accelerate
-description: Learn how to set up PostgreSQL on Neon with Prisma Accelerate's Connection Pool
-image: /img/guides/neon-connection-pooling.png
-url: /v6/guides/neon-accelerate
-metaTitle: Set up PostgreSQL on Neon with Prisma Accelerate's Connection Pool
-metaDescription: Learn how to set up PostgreSQL on Neon with Prisma Accelerate's Connection Pool
----
-
-## Introduction
-
-This guides teaches you how to add connection pooling to a PostgreSQL database hosted on [Neon](https://neon.tech/) using [Prisma Accelerate](/v6/accelerate).
-
-Prisma Accelerate is a robust and mature connection pooler enabling your database to function properly during traffic spikes and high load scenarios. Check out this [video](https://www.youtube.com/watch?v=cnL75if6Aq0) demonstrating how it performs in a load test or [learn why connection pooling is important](https://www.prisma.io/blog/saving-black-friday-with-connection-pooling).
-
-## Prerequisites
-
-To successfully complete this guide, you need **a connection string for a PostgreSQL instance hosted on Neon**. It typically looks similar to this:
-
-```bash no-copy
-postgresql://neondb_owner:[YOUR-PASSWORD]@ep-lingering-hat-a2e7tkt3.eu-central-1.aws.neon.tech/neondb?sslmode=require
-```
-
-If you already have a project using Prisma ORM, you can skip the first two steps and jump ahead to [Step 3. Install the Accelerate extension](#3-install-the-accelerate-extension).
-
-## 1. Set up Prisma ORM
-
-Start by installing the Prisma CLI in your project:
-
-```npm
-npm install prisma --save-dev
-```
-
-Then, run the following command to initialize a new project:
-
-```npm
-npx prisma init
-```
-
-This will create a new `prisma` directory with a `schema.prisma` file and add a `.env` file with the `DATABASE_URL` environment variable.
-
-Update the file and set the `DATABASE_URL` to your Neon connection string:
-
-```bash title=".env"
-DATABASE_URL="postgresql://neondb_owner:[YOUR-PASSWORD]@ep-lingering-hat-a2e7tkt3.eu-central-1.aws.neon.tech/neondb?sslmode=require"
-```
-
-Create a `prisma.config.ts` file to configure Prisma:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-You'll need to install the `dotenv` package to load environment variables:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-## 2. Introspect your database
-
-Next, run the following command to introspect your database and create your data model:
-
-```npm
-npx prisma db pull
-```
-
-This command reads your database schema and creates new models in your `schema.prisma` file that match the tables in your database.
-
-:::note
-
-If you want to use Prisma Migrate in the future, you also need to [baseline your database](/v6/orm/prisma-migrate/workflows/baselining).
-
-:::
-
-## 3. Install the Accelerate extension
-
-Install the Prisma Client extension for Accelerate:
-
-```npm
-npm install @prisma/extension-accelerate
-```
-
-This is needed to access Prisma Accelerate's connection pool.
-
-## 4. Set up Accelerate in the Prisma Console
-
-To set up Accelerate in the Prisma Console, follow these steps:
-
-1. Log into the [Prisma Console](https://console.prisma.io).
-1. Select **New project**
-1. Choose a **Name** for your project
-1. In the **Choose your starting product** section, find the **Accelerate** card and click **Get started**
-1. In the field for your **Database connection string**, paste your Neon connection string
-1. Select the **Region** that's closest to your database
-1. Click **Create project**
-1. On the next screen, click **Enable Accelerate**
-
-Once you went through these steps, you'll be redirected to another page where you need to the click the **Generate API key** button.
-
-You'll then be shown a new connection URL which enables you to connect to Prisma Accelerate's connection pool. This needs to be set as the new `DATABASE_URL` in your `.env` file:
-
-```bash title=".env"
-DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=ey..."
-```
-
-:::note
-
-If you want to use Prisma Migrate with Prisma Accelerate, you need to provide a direct database URL in your `prisma.config.ts` file. The Accelerate URL (starting with `prisma://`) is used for queries via PrismaClient, while the direct database URL is used for migrations.
-
-Update your `prisma.config.ts`:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DIRECT_URL"), // Direct database URL for migrations
- },
-});
-```
-
-And add the `DIRECT_URL` to your `.env` file:
-
-```bash title=".env"
-DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=ey..."
-DIRECT_URL="postgresql://neondb_owner:[YOUR-PASSWORD]@ep-lingering-hat-a2e7tkt3.eu-central-1.aws.neon.tech/neondb?sslmode=require"
-```
-
-:::
-
-## 5. Generate Prisma Client
-
-With your Prisma schema in place, you can go ahead and generate Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-:::info
-
-In Prisma 7, the `--no-engine` flag is no longer required when using Prisma Accelerate. Previously, you would run `prisma generate --no-engine`, but now the standard `prisma generate` command works for all use cases.
-
-:::
-
-## 6. Send queries through the connection pool
-
-In your application code, you now need to apply the Accelerate extension to your Prisma Client instance:
-
-```ts
-import { PrismaClient } from "./generated/prisma/client";
-import { withAccelerate } from "@prisma/extension-accelerate";
-
-const prisma = new PrismaClient({
- accelerateUrl: process.env.DATABASE_URL,
-}).$extends(withAccelerate());
-```
-
-At this point, you can now start sending queries which will be routed through the connection pool to your database.
diff --git a/apps/docs/content/docs.v6/guides/nestjs.mdx b/apps/docs/content/docs.v6/guides/nestjs.mdx
deleted file mode 100644
index f9fe20dc50..0000000000
--- a/apps/docs/content/docs.v6/guides/nestjs.mdx
+++ /dev/null
@@ -1,515 +0,0 @@
----
-title: NestJS
-description: Learn how to use Prisma ORM in a NestJS app
-image: /img/guides/prisma-nestjs-cover.png
-url: /v6/guides/nestjs
-metaTitle: How to use Prisma ORM and Prisma Postgres with NestJS
-metaDescription: Learn how to use Prisma ORM in a NestJS app
----
-
-## Introduction
-
-This guide shows you how to use Prisma ORM with [NestJS](https://nestjs.com/), a progressive Node.js framework for building efficient and scalable server-side applications. You'll build a REST API with NestJS that uses Prisma ORM to store and retrieve data from a database.
-
-[Prisma ORM](https://www.prisma.io) is an open-source ORM for Node.js and TypeScript. It is used as an **alternative** to writing plain SQL, or using another database access tool such as SQL query builders (like [knex.js](https://knexjs.org/)) or ORMs (like [TypeORM](https://typeorm.io/) and [Sequelize](https://sequelize.org/)). Prisma currently supports PostgreSQL, MySQL, SQL Server, SQLite, MongoDB and CockroachDB.
-
-While Prisma can be used with plain JavaScript, it embraces TypeScript and provides a level of type-safety that goes beyond the guarantees other ORMs in the TypeScript ecosystem offer.
-
-You can find a ready-to-run example [here](https://github.com/prisma/prisma-examples/tree/latest/orm/nest)
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-
-## 1. Create your NestJS project
-
-Install the NestJS CLI and create a new project:
-
-```npm
-npm install -g @nestjs/cli
-```
-
-```bash
-nest new nestjs-prisma
-```
-
-When prompted, select **npm** as your package manager. Navigate to the project directory:
-
-```bash
-cd nestjs-prisma
-```
-
-You can run `npm start` to start your application at `http://localhost:3000/`. Over the course of this guide, you'll add routes to store and retrieve data about _users_ and _posts_.
-
-In `package.json`, add the `type` field set to `"module"`:
-
-```json title="package.json"
-{
- "type": "module" // [!code ++]
-}
-```
-
-## 2. Set up Prisma
-
-### 2.1. Install Prisma and dependencies
-
-Install the necessary Prisma packages and database drivers:
-
-```npm
-npm install prisma --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg
-```
-
-:::info
-
-If you are using a different database provider (PostgreSQL, MySQL, SQL Server), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-### 2.2. Initialize Prisma
-
-Initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../src/generated/prisma
-```
-
-This creates a new `prisma` directory with the following contents:
-
-- `schema.prisma`: Specifies your database connection and contains the database schema
-- `prisma.config.ts`: A configuration file for your projects
-- `.env`: A [dotenv](https://github.com/motdotla/dotenv) file, typically used to store your database credentials in a group of environment variables
-
-### 2.3. Set the generator output path
-
-Specify your output `path` for the generated Prisma client by either passing `--output ../src/generated/prisma` during `prisma init` or directly in your Prisma schema:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-```
-
-### 2.4. Configure your database connection
-
-Your database connection is configured in the `datasource` block in your `schema.prisma` file. By default it's set to `postgresql` which is what you need for this guide.
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-```
-
-Now, open up `.env` and you should see a `DATABASE_URL` already specified:
-
-```bash title=".env"
-DATABASE_URL=""
-```
-
-:::note
-
-Make sure you have a [ConfigModule](https://docs.nestjs.com/techniques/configuration) configured, otherwise the `DATABASE_URL` variable will not be picked up from `.env`.
-
-:::
-
-### 2.5. Define your data model
-
-Add the following two models to your `schema.prisma` file:
-
-```prisma title="prisma/schema.prisma"
-model User {
- id Int @id @default(autoincrement())
- email String @unique
- name String?
- posts Post[]
-}
-
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean? @default(false)
- author User? @relation(fields: [authorId], references: [id])
- authorId Int?
-}
-```
-
-### 2.6. Create and run your migration
-
-With your Prisma models in place, you can generate your SQL migration files and run them against the database. Run the following commands in your terminal:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-This `prisma migrate dev` command generates SQL files and directly runs them against the database. In this case, the following migration files was created in the existing `prisma` directory:
-
-```bash
-$ tree prisma
-prisma
-├── migrations
-│ └── 20201207100915_init
-│ └── migration.sql
-└── schema.prisma
-```
-
-### 2.7. Generate Prisma Client
-
-Once installed, you can run the generate command to generate the types and Client needed for your project. If any changes are made to your schema, you will need to rerun the `generate` command to keep those types in sync.
-
-```npm
-npx prisma generate
-```
-
-## 3. Create a Prisma service
-
-You're now able to send database queries with Prisma Client. When setting up your NestJS application, you'll want to abstract away the Prisma Client API for database queries within a service. To get started, you can create a new `PrismaService` that takes care of instantiating `PrismaClient` and connecting to your database.
-
-Inside the `src` directory, create a new file called `prisma.service.ts` and add the following code to it:
-
-```typescript title="src/prisma.service.ts"
-import { Injectable } from "@nestjs/common";
-import { PrismaClient } from "./generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-@Injectable()
-export class PrismaService extends PrismaClient {
- constructor() {
- const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL as string,
- });
- super({ adapter });
- }
-}
-```
-
-## 4. Create User and Post services
-
-Next, you can write services that you can use to make database calls for the `User` and `Post` models from your Prisma schema.
-
-### 4.1. Create the User service
-
-Still inside the `src` directory, create a new file called `user.service.ts` and add the following code to it:
-
-```typescript title="src/user.service.ts"
-import { Injectable } from "@nestjs/common";
-import { PrismaService } from "./prisma.service.js";
-import { User, Prisma } from "./generated/prisma/client.js";
-
-@Injectable()
-export class UserService {
- constructor(private prisma: PrismaService) {}
-
- async user(userWhereUniqueInput: Prisma.UserWhereUniqueInput): Promise {
- return this.prisma.user.findUnique({
- where: userWhereUniqueInput,
- });
- }
-
- async users(params: {
- skip?: number;
- take?: number;
- cursor?: Prisma.UserWhereUniqueInput;
- where?: Prisma.UserWhereInput;
- orderBy?: Prisma.UserOrderByWithRelationInput;
- }): Promise {
- const { skip, take, cursor, where, orderBy } = params;
- return this.prisma.user.findMany({
- skip,
- take,
- cursor,
- where,
- orderBy,
- });
- }
-
- async createUser(data: Prisma.UserCreateInput): Promise {
- return this.prisma.user.create({
- data,
- });
- }
-
- async updateUser(params: {
- where: Prisma.UserWhereUniqueInput;
- data: Prisma.UserUpdateInput;
- }): Promise {
- const { where, data } = params;
- return this.prisma.user.update({
- data,
- where,
- });
- }
-
- async deleteUser(where: Prisma.UserWhereUniqueInput): Promise {
- return this.prisma.user.delete({
- where,
- });
- }
-}
-```
-
-Notice how you're using Prisma Client's generated types to ensure that the methods that are exposed by your service are properly typed. You therefore save the boilerplate of typing your models and creating additional interface or DTO files.
-
-### 4.2. Create the Post service
-
-Now do the same for the `Post` model.
-
-Still inside the `src` directory, create a new file called `post.service.ts` and add the following code to it:
-
-```typescript title="src/post.service.ts"
-import { Injectable } from "@nestjs/common";
-import { PrismaService } from "./prisma.service.js";
-import { Post, Prisma } from "./generated/prisma/client.js";
-
-@Injectable()
-export class PostService {
- constructor(private prisma: PrismaService) {}
-
- async post(postWhereUniqueInput: Prisma.PostWhereUniqueInput): Promise {
- return this.prisma.post.findUnique({
- where: postWhereUniqueInput,
- });
- }
-
- async posts(params: {
- skip?: number;
- take?: number;
- cursor?: Prisma.PostWhereUniqueInput;
- where?: Prisma.PostWhereInput;
- orderBy?: Prisma.PostOrderByWithRelationInput;
- }): Promise {
- const { skip, take, cursor, where, orderBy } = params;
- return this.prisma.post.findMany({
- skip,
- take,
- cursor,
- where,
- orderBy,
- });
- }
-
- async createPost(data: Prisma.PostCreateInput): Promise {
- return this.prisma.post.create({
- data,
- });
- }
-
- async updatePost(params: {
- where: Prisma.PostWhereUniqueInput;
- data: Prisma.PostUpdateInput;
- }): Promise {
- const { data, where } = params;
- return this.prisma.post.update({
- data,
- where,
- });
- }
-
- async deletePost(where: Prisma.PostWhereUniqueInput): Promise {
- return this.prisma.post.delete({
- where,
- });
- }
-}
-```
-
-Your `UserService` and `PostService` currently wrap the CRUD queries that are available in Prisma Client. In a real world application, the service would also be the place to add business logic to your application. For example, you could have a method called `updatePassword` inside the `UserService` that would be responsible for updating the password of a user.
-
-## 5. Implement REST API routes
-
-### 5.1. Create the controller
-
-Finally, you'll use the services you created in the previous sections to implement the different routes of your app. For the purpose of this guide, you'll put all your routes into the already existing `AppController` class.
-
-Replace the contents of the `app.controller.ts` file with the following code:
-
-```typescript title="src/app.controller.ts"
-import { Controller, Get, Param, Post, Body, Put, Delete } from "@nestjs/common";
-import { UserService } from "./user.service.js";
-import { PostService } from "./post.service.js";
-import { User as UserModel } from "./generated/prisma/client.js";
-import { Post as PostModel } from "./generated/prisma/client.js";
-
-@Controller()
-export class AppController {
- constructor(
- private readonly UserService: UserService,
- private readonly postService: PostService,
- ) {}
-
- @Get("post/:id")
- async getPostById(@Param("id") id: string): Promise {
- return this.postService.post({ id: Number(id) });
- }
-
- @Get("feed")
- async getPublishedPosts(): Promise {
- return this.postService.posts({
- where: { published: true },
- });
- }
-
- @Get("filtered-posts/:searchString")
- async getFilteredPosts(@Param("searchString") searchString: string): Promise {
- return this.postService.posts({
- where: {
- OR: [
- {
- title: { contains: searchString },
- },
- {
- content: { contains: searchString },
- },
- ],
- },
- });
- }
-
- @Post("post")
- async createDraft(
- @Body() postData: { title: string; content?: string; authorEmail: string },
- ): Promise {
- const { title, content, authorEmail } = postData;
- return this.postService.createPost({
- title,
- content,
- author: {
- connect: { email: authorEmail },
- },
- });
- }
-
- @Post("user")
- async signupUser(@Body() userData: { name?: string; email: string }): Promise {
- return this.UserService.createUser(userData);
- }
-
- @Put("publish/:id")
- async publishPost(@Param("id") id: string): Promise {
- return this.postService.updatePost({
- where: { id: Number(id) },
- data: { published: true },
- });
- }
-
- @Delete("post/:id")
- async deletePost(@Param("id") id: string): Promise {
- return this.postService.deletePost({ id: Number(id) });
- }
-}
-```
-
-This controller implements the following routes:
-
-#### `GET`
-
-- `/post/:id`: Fetch a single post by its `id`
-- `/feed`: Fetch all _published_ posts
-- `/filtered-posts/:searchString`: Filter posts by `title` or `content`
-
-#### `POST`
-
-- `/post`: Create a new post
- - Body:
- - `title: String` (required): The title of the post
- - `content: String` (optional): The content of the post
- - `authorEmail: String` (required): The email of the user that creates the post
-- `/user`: Create a new user
- - Body:
- - `email: String` (required): The email address of the user
- - `name: String` (optional): The name of the user
-
-#### `PUT`
-
-- `/publish/:id`: Publish a post by its `id`
-
-#### `DELETE`
-
-- `/post/:id`: Delete a post by its `id`
-
-### 5.2. Register services in the app module
-
-Remember to register the new services in the app module.
-
-Update `src/app.module.ts` to register all services:
-
-```typescript title="src/app.module.ts"
-import { Module } from "@nestjs/common";
-import { AppController } from "./app.controller";
-import { ConfigModule } from "@nestjs/config";
-import { AppService } from "./app.service.js";
-import { PrismaService } from "./prisma.service.js"; // [!code ++]
-import { UserService } from "./user.service.js"; // [!code ++]
-import { PostService } from "./post.service.js"; // [!code ++]
-
-@Module({
- imports: [ConfigModule.forRoot()],
- controllers: [AppController],
- providers: [AppService, PrismaService, UserService, PostService], // [!code ++]
-})
-export class AppModule {}
-```
-
-## 6. Test your API
-
-Start your application:
-
-```npm
-npm start
-```
-
-Test your endpoints with curl, [Postman](https://www.postman.com/), or [HTTPie](https://httpie.io/).
-
-**Create a user:**
-
-```bash
-curl -X POST http://localhost:3000/user \
- -H "Content-Type: application/json" \
- -d '{"name": "Alice", "email": "alice@prisma.io"}'
-```
-
-**Create a post:**
-
-```bash
-curl -X POST http://localhost:3000/post \
- -H "Content-Type: application/json" \
- -d '{"title": "Hello World", "authorEmail": "alice@prisma.io"}'
-```
-
-**Get published posts:**
-
-```bash
-curl http://localhost:3000/feed
-```
-
-**Publish a post:**
-
-```bash
-curl -X PUT http://localhost:3000/publish/1
-```
-
-**Search posts:**
-
-```bash
-curl http://localhost:3000/filtered-posts/hello
-```
-
-## Summary
-
-In this guide, you learned how to use Prisma ORM with NestJS to implement a REST API. The controller that implements the routes of the API is calling a `PrismaService` which in turn uses Prisma Client to send queries to a database to fulfill the data needs of incoming requests.
-
-If you want to learn more about using NestJS with Prisma, be sure to check out the following resources:
-
-- [NestJS & Prisma](https://www.prisma.io/nestjs)
-- [Ready-to-run example projects for REST & GraphQL](https://github.com/prisma/prisma-examples/)
-- [Production-ready starter kit](https://github.com/notiz-dev/nestjs-prisma-starter#instructions)
-- [Video: Accessing Databases using NestJS with Prisma (5min)](https://www.youtube.com/watch?v=UlVJ340UEuk&ab_channel=Prisma) by [Marc Stammerjohann](https://github.com/marcjulian)
diff --git a/apps/docs/content/docs.v6/guides/nextjs.mdx b/apps/docs/content/docs.v6/guides/nextjs.mdx
deleted file mode 100644
index a3d4953c5b..0000000000
--- a/apps/docs/content/docs.v6/guides/nextjs.mdx
+++ /dev/null
@@ -1,703 +0,0 @@
----
-title: Next.js
-description: Learn how to use Prisma ORM in a Next.js app and deploy it to Vercel
-image: /img/guides/prisma-nextjs-cover.png
-url: /v6/guides/nextjs
-metaTitle: How to use Prisma ORM and Prisma Postgres with Next.js and Vercel
-metaDescription: Learn how to use Prisma ORM in a Next.js app and deploy it to Vercel
----
-
-## Introduction
-
-
-Questions answered in this page
-
-- How to set up Prisma with Next.js?
-- How to deploy Next.js with Prisma to Vercel?
-- How to handle migrations in production?
-
-
-
-This guide shows you how to use Prisma with Next.js, a fullstack React framework. You'll learn how to create a [Prisma Postgres](/v6/postgres) instance, set up Prisma ORM with Next.js, handle migrations, and deploy your application to Vercel.
-
-You can find a [deployment-ready example on GitHub](https://github.com/prisma/prisma-examples/blob/latest/orm/nextjs).
-
-## Prerequisites
-
-- [Node.js](https://nodejs.org) v20.19+, v22.12+, or v24.0+
-- A Vercel account (if you want to deploy your application)
-
-## 1. Set up your project
-
-From the directory where you want to create your project, run `create-next-app` to create a new Next.js app that you will be using for this guide.
-
-```npm
-npx create-next-app@latest nextjs-prisma
-```
-
-You will be prompted to answer a few questions about your project. Select all of the defaults.
-
-:::info
-
-For reference, those are:
-
-- TypeScript
-- ESLint
-- Tailwind CSS
-- No `src` directory
-- App Router
-- Turbopack
-- No customized import alias
-
-:::
-
-Then, navigate to the project directory:
-
-```bash
-cd nextjs-prisma
-```
-
-## 2. Install and Configure Prisma
-
-### 2.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../app/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My \***\*\_\_\*\*** Project"
-:::
-
-This will create:
-
-- A `prisma` directory with a `schema.prisma` file.
-- A `prisma.config.ts` file for configuring Prisma.
-- A Prisma Postgres database.
-- A `.env` file containing the `DATABASE_URL` at the project root.
-
-The `app/generated/prisma` output directory for the generated Prisma Client will be created when you run `prisma generate` or `prisma migrate dev` in a later step.
-
-### 2.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, add the following models:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-```
-
-This creates two models: `User` and `Post`, with a one-to-many relationship between them.
-
-### 2.3 Add `dotenv` to `prisma.config.ts`
-
-To get access to the variables in the `.env` file, they can either be loaded by your runtime, or by using `dotenv`.
-Include an import for `dotenv` at the top of the `prisma.config.ts`
-
-```typescript title="prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.4. Run migrations and generate Prisma Client
-
-Now, run the following command to create the database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-Then generate Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-### 2.5. Seed the database
-
-Add some seed data to populate the database with sample users and posts.
-
-Create a new file called `seed.ts` in the `prisma/` directory:
-
-```typescript title="prisma/seed.ts"
-import { PrismaClient, Prisma } from "../app/generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-import "dotenv/config";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-const userData: Prisma.UserCreateInput[] = [
- {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: [
- {
- title: "Join the Prisma Discord",
- content: "https://pris.ly/discord",
- published: true,
- },
- {
- title: "Prisma on YouTube",
- content: "https://pris.ly/youtube",
- },
- ],
- },
- },
- {
- name: "Bob",
- email: "bob@prisma.io",
- posts: {
- create: [
- {
- title: "Follow Prisma on Twitter",
- content: "https://www.twitter.com/prisma",
- published: true,
- },
- ],
- },
- },
-];
-
-export async function main() {
- for (const u of userData) {
- await prisma.user.create({ data: u });
- }
-}
-
-main();
-```
-
-Now, tell Prisma how to run this script by updating your `prisma.config.ts`:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: `tsx prisma/seed.ts`, // [!code ++]
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Finally, run `prisma db seed` to seed your database with the initial data we defined in the `seed.ts` file.
-
-Run the seed script:
-
-```npm
-npx prisma db seed
-```
-
-And open Prisma Studio to inspect your data:
-
-```npm
-npx prisma studio
-```
-
-### 2.6 Set up Prisma Client
-
-Now that you have a database with some initial data, you can set up Prisma Client and connect it to your database.
-
-At the root of your project, create a new `lib` directory and add a `prisma.ts` file to it.
-
-```bash
-mkdir -p lib && touch lib/prisma.ts
-```
-
-Now, add the following code to your `lib/prisma.ts` file:
-
-```typescript title="lib/prisma.ts" showLineNumbers
-import { PrismaClient } from "../app/generated/prisma/client"; // [!code ++]
-import { PrismaPg } from "@prisma/adapter-pg"; // [!code ++]
-
-const globalForPrisma = global as unknown as {
- // [!code ++]
- prisma: PrismaClient; // [!code ++]
-}; // [!code ++]
-
-const adapter = new PrismaPg({
- // [!code ++]
- connectionString: process.env.DATABASE_URL, // [!code ++]
-}); // [!code ++]
-
-const prisma = // [!code ++]
- globalForPrisma.prisma || // [!code ++]
- new PrismaClient({
- // [!code ++]
- adapter, // [!code ++]
- }); // [!code ++]
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma; // [!code ++]
-
-export default prisma; // [!code ++]
-```
-
-This file creates a Prisma Client and attaches it to the global object so that only one instance of the client is created in your application. This helps resolve issues with hot reloading that can occur when using Prisma ORM with Next.js in development mode.
-
-You'll use this client in the next section to run your first queries.
-
-## 3. Query your database with Prisma ORM
-
-Now that you have an initialized Prisma Client, a connection to your database, and some initial data, you can start querying your data with Prisma ORM.
-
-In this example, you'll make the "home" page of your application display all of your users.
-
-Open the `app/page.tsx` file and replace the existing code with the following:
-
-```tsx title="app/page.tsx"
-export default async function Home() {
- return (
-
-
- Superblog
-
-
-
Alice
-
Bob
-
-
- );
-}
-```
-
-This gives you a basic page with a title and a list of users. However, that list is static with hardcoded values. Let's update the page to fetch the users from your database and make it dynamic.
-
-```tsx title="app/page.tsx"
-import prisma from "@/lib/prisma";
-
-export default async function Home() {
- const users = await prisma.user.findMany();
- return (
-
-
- Superblog
-
-
- {users.map((user) => (
-
- {user.name}
-
- ))}
-
-
- );
-}
-```
-
-You are now importing your client, querying the `User` model for all users, and then displaying them in a list.
-
-Now your home page is dynamic and will display the users from your database.
-
-### 3.1 Update your data (optional)
-
-If you want to see what happens when data is updated, you could:
-
-- update your `User` table via a SQL browser of your choice
-- change your `seed.ts` file to add more users
-- change the call to `prisma.user.findMany` to re-order the users, filter the users, or similar.
-
-Just reload the page and you'll see the changes.
-
-## 4. Add a new Posts list page
-
-You have your home page working, but you should add a new page that displays all of your posts.
-
-First create a new `posts` directory in the `app` directory and create a new `page.tsx` file inside of it.
-
-```bash
-mkdir -p app/posts && touch app/posts/page.tsx
-```
-
-Second, add the following code to the `app/posts/page.tsx` file:
-
-```tsx title="app/posts/page.tsx"
-import prisma from "@/lib/prisma";
-
-export default async function Posts() {
- return (
-
-
Posts
-
-
My first post
-
-
- );
-}
-```
-
-Now `localhost:3000/posts` will load, but the content is hardcoded again. Let's update it to be dynamic, similarly to the home page:
-
-```tsx title="app/posts/page.tsx"
-import prisma from "@/lib/prisma";
-
-export default async function Posts() {
- const posts = await prisma.post.findMany({
- include: {
- author: true,
- },
- });
-
- return (
-
-
Posts
-
- {posts.map((post) => (
-
- {post.title}
- by {post.author.name}
-
- ))}
-
-
- );
-}
-```
-
-This works similarly to the home page, but instead of displaying users, it displays posts. You can also see that you've used `include` in your Prisma Client query to fetch the author of each post so you can display the author's name.
-
-This "list view" is one of the most common patterns in web applications. You're going to add two more pages to your application which you'll also commonly need: a "detail view" and a "create view".
-
-## 5. Add a new Posts detail page
-
-To complement the Posts list page, you'll add a Posts detail page.
-
-In the `posts` directory, create a new `[id]` directory and a new `page.tsx` file inside of that.
-
-```bash
-mkdir -p "app/posts/[id]" && touch "app/posts/[id]/page.tsx"
-```
-
-This page will display a single post's title, content, and author. Just like your other pages, add the following code to the `app/posts/new/page.tsx` file:
-
-```tsx title="app/posts/[id]/page.tsx"
-import prisma from "@/lib/prisma";
-
-export default async function Post({ params }: { params: Promise<{ id: string }> }) {
- return (
-
-
-
My first post
-
by Anonymous
-
No content available.
-
-
- );
-}
-```
-
-As before, this page is static with hardcoded content. Let's update it to be dynamic based on the `params` passed to the page:
-
-```tsx title="app/posts/[id]/page.tsx"
-import prisma from "@/lib/prisma";
-import { notFound } from "next/navigation";
-
-export default async function Post({ params }: { params: Promise<{ id: string }> }) {
- const { id } = await params;
- const post = await prisma.post.findUnique({
- where: { id: parseInt(id) },
- include: {
- author: true,
- },
- });
-
- if (!post) {
- notFound();
- }
-
- return (
-
-
-
{post.title}
-
by {post.author.name}
-
{post.content || "No content available."}
-
-
- );
-}
-```
-
-There's a lot of changes here, so let's break it down:
-
-- You're using Prisma Client to fetch the post by its `id`, which you get from the `params` object.
-- In case the post doesn't exist (maybe it was deleted or maybe you typed a wrong ID), you call `notFound()` to display a 404 page.
-- You then display the post's title, content, and author. If the post doesn't have content, you display a placeholder message.
-
-It's not the prettiest page, but it's a good start. Try it out by navigating to `localhost:3000/posts/1` and `localhost:3000/posts/2`. You can also test the 404 page by navigating to `localhost:3000/posts/999`.
-
-## 6. Add a new Posts create page
-
-To round out your application, you'll add a "create" page for posts. This will let you write your own posts and save them to the database.
-
-As with the other pages, you'll start with a static page and then update it to be dynamic.
-
-```bash
-mkdir -p app/posts/new && touch app/posts/new/page.tsx
-```
-
-Now, add the following code to the `app/posts/new/page.tsx` file:
-
-```tsx title="app/posts/new/page.tsx"
-import Form from "next/form";
-
-export default function NewPost() {
- async function createPost(formData: FormData) {
- "use server";
-
- const title = formData.get("title") as string;
- const content = formData.get("content") as string;
- }
-
- return (
-
-
Create New Post
-
-
- );
-}
-```
-
-This form looks good, but it doesn't do anything yet. Let's update the `createPost` function to save the post to the database:
-
-```tsx title="app/posts/new/page.tsx"
-import Form from "next/form";
-import prisma from "@/lib/prisma";
-import { revalidatePath } from "next/cache";
-import { redirect } from "next/navigation";
-
-export default function NewPost() {
- async function createPost(formData: FormData) {
- "use server";
-
- const title = formData.get("title") as string;
- const content = formData.get("content") as string;
-
- await prisma.post.create({
- data: {
- title,
- content,
- authorId: 1,
- },
- });
-
- revalidatePath("/posts");
- redirect("/posts");
- }
-
- return (
-
-
Create New Post
-
-
- );
-}
-```
-
-This page now has a functional form! When you submit the form, it will create a new post in the database and redirect you to the posts list page.
-
-You also added a `revalidatePath` call to revalidate the posts list page so that it will be updated with the new post. That way everyone can read the new post immediately.
-
-Try it out by navigating to `localhost:3000/posts/new` and submitting the form.
-
-## 7. Deploy your application to Vercel (Optional)
-
-The quickest way to deploy your application to Vercel is to use the [Vercel CLI](https://vercel.com/docs/cli).
-
-First, install the Vercel CLI:
-
-```npm
-npm install -g vercel
-```
-
-Then, run `vercel login` to log in to your Vercel account.
-
-```bash
-vercel login
-```
-
-Before you deploy, you also need to tell Vercel to make sure that the Prisma Client is generated. You can do this by adding a `postinstall` script to your `package.json` file.
-
-```json title="package.json"
-{
- "name": "nextjs-prisma",
- "version": "0.1.0",
- "private": true,
- "scripts": {
- "dev": "next dev --turbopack",
- "build": "next build",
- "postinstall": "prisma generate",
- "start": "next start",
- "lint": "next lint"
- },
- "prisma": {
- "seed": "tsx prisma/seed.ts"
- },
- "dependencies": {
- "@prisma/adapter-pg": "^6.2.1",
- "@prisma/client": "^6.2.1",
- "next": "15.1.4",
- "pg": "^8.13.1",
- "react": "^19.0.0",
- "react-dom": "^19.0.0"
- },
- "devDependencies": {
- "@eslint/eslintrc": "^3",
- "@types/node": "^20",
- "@types/react": "^19",
- "@types/react-dom": "^19",
- "eslint": "^9",
- "eslint-config-next": "15.1.4",
- "postcss": "^8",
- "prisma": "^6.2.1",
- "tailwindcss": "^3.4.1",
- "tsx": "^4.19.2",
- "typescript": "^5"
- }
-}
-```
-
-After this change, you can deploy your application to Vercel by running `vercel`.
-
-```bash
-vercel
-```
-
-After the deployment is complete, you can visit your application at the URL that Vercel provides. Congratulations, you've just deployed a Next.js application with Prisma ORM!
-
-## 8. Next steps
-
-Now that you have a working Next.js application with Prisma ORM, here are some ways you can expand and improve your application:
-
-- Add authentication to protect your routes
-- Add the ability to edit and delete posts
-- Add comments to posts
-- Use [Prisma Studio](/v6/orm/tools/prisma-studio) for visual database management
-
-For more information:
-
-- [Prisma ORM documentation](/v6/orm)
-- [Prisma Client API reference](/v6/orm/prisma-client/setup-and-configuration/introduction)
-- [Next.js documentation](https://nextjs.org/docs)
diff --git a/apps/docs/content/docs.v6/guides/nuxt.mdx b/apps/docs/content/docs.v6/guides/nuxt.mdx
deleted file mode 100644
index 18534b92a7..0000000000
--- a/apps/docs/content/docs.v6/guides/nuxt.mdx
+++ /dev/null
@@ -1,281 +0,0 @@
----
-title: Nuxt
-description: A step-by-step guide to setting up and using Prisma ORM and Prisma Postgres in a Nuxt app.
-image: /img/guides/prisma-postgres-and-prisma-nuxt-guide.png
-url: /v6/guides/nuxt
-metaTitle: Build a Nuxt app with Prisma ORM and Prisma Postgres
-metaDescription: A step-by-step guide to setting up and using Prisma ORM and Prisma Postgres in a Nuxt app.
----
-
-This guide shows you how to set up Prisma ORM in a Nuxt application with [Prisma Postgres](https://prisma.io/postgres).
-
-## Prerequisites
-
-- Node.js 18+
-- A [Prisma Postgres](https://console.prisma.io/) database (or any PostgreSQL database)
-
-## 1. Create a Nuxt project
-
-Create a new Nuxt project and install dependencies:
-
-```npm
-npx nuxi@latest init hello-prisma
-cd hello-prisma
-npm install @prisma/client @prisma/adapter-pg pg
-npm install -D prisma @types/pg dotenv tsx
-```
-
-## 2. Initialize Prisma
-
-Initialize Prisma in your project:
-
-```npm
-npx prisma init
-```
-
-Update your `prisma/schema.prisma`:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "./generated"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User {
- id Int @id @default(autoincrement())
- email String @unique
- name String?
- posts Post[]
-}
-
-model Post {
- id Int @id @default(autoincrement())
- title String
- content String?
- published Boolean @default(false)
- author User? @relation(fields: [authorId], references: [id])
- authorId Int?
-}
-```
-
-Create a `prisma.config.ts` file in the root of your project:
-
-```ts title="prisma.config.ts"
-import { defineConfig, env } from "prisma/config";
-import "dotenv/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: "tsx ./prisma/seed.ts",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Update your `.env` file with your database connection string:
-
-```bash title=".env"
-DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
-```
-
-Run the migration to create your database tables:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-## 3. Set up Prisma Client
-
-Create `server/utils/db.ts`. Nuxt auto-imports exports from `server/utils`, making `prisma` available in all API routes:
-
-```ts title="server/utils/db.ts"
-import { PrismaPg } from "@prisma/adapter-pg";
-import { PrismaClient } from "../../prisma/generated/client";
-
-const prismaClientSingleton = () => {
- const pool = new PrismaPg({ connectionString: process.env.DATABASE_URL! });
- return new PrismaClient({ adapter: pool });
-};
-
-type PrismaClientSingleton = ReturnType;
-
-const globalForPrisma = globalThis as unknown as {
- prisma: PrismaClientSingleton | undefined;
-};
-
-export const prisma = globalForPrisma.prisma ?? prismaClientSingleton();
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
-```
-
-## 4. Create API routes
-
-Create an API route to fetch users. The `prisma` instance is auto-imported:
-
-```ts title="server/api/users.get.ts"
-export default defineEventHandler(async () => {
- const users = await prisma.user.findMany({
- include: { posts: true },
- });
- return users;
-});
-```
-
-Create an API route to create a user:
-
-```ts title="server/api/users.post.ts"
-export default defineEventHandler(async (event) => {
- const body = await readBody<{ name: string; email: string }>(event);
-
- const user = await prisma.user.create({
- data: {
- name: body.name,
- email: body.email,
- },
- });
-
- return user;
-});
-```
-
-## 5. Create a page
-
-Update `app.vue` to display users:
-
-```html title="app.vue"
-
-
-
Users
-
-
{{ user.name }} ({{ user.email }})
-
-
No users yet.
-
-
-
-
-```
-
-## 6. Run the app
-
-Start the development server:
-
-```npm
-npm run dev
-```
-
-Open `http://localhost:3000` to see your app.
-
-## 7. Seed your database (optional)
-
-Create a seed file to populate your database with sample data:
-
-```ts title="prisma/seed.ts"
-import "dotenv/config";
-import { PrismaClient } from "./generated/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL! });
-const prisma = new PrismaClient({ adapter });
-
-async function main() {
- const alice = await prisma.user.create({
- data: {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: { title: "Hello World", published: true },
- },
- },
- });
- console.log(`Created user: ${alice.name}`);
-}
-
-main()
- .then(() => prisma.$disconnect())
- .catch(async (e) => {
- console.error(e);
- await prisma.$disconnect();
- process.exit(1);
- });
-```
-
-Run the seed:
-
-```npm
-npx prisma db seed
-```
-
-## 8. Deploy to Vercel
-
-You can deploy your Nuxt application to Vercel using one of two methods:
-
-### Option A: Deploy using Vercel CLI
-
-1. Install the Vercel CLI (if not already installed):
-
- ```npm
- npm install -g vercel
- ```
-
-2. Deploy your project:
-
- ```npm
- npx vercel
- ```
-
-3. Set the `DATABASE_URL` environment variable:
- - Go to your [Vercel Dashboard](https://vercel.com/dashboard)
- - Select your project
- - Navigate to **Settings** → **Environment Variables**
- - Add `DATABASE_URL` with your database connection string
-
-4. Redeploy your application to apply the environment variable:
- ```npm
- npx vercel --prod
- ```
-
-### Option B: Deploy using Git integration
-
-1. Push your code to a Git repository (GitHub, GitLab, or Bitbucket).
-
-2. Add `prisma generate` to your `postinstall` script in `package.json` to ensure Prisma Client is generated during deployment:
-
- ```json title="package.json"
- {
- "scripts": {
- "postinstall": "prisma generate",
- "build": "nuxt build",
- "dev": "nuxt dev"
- }
- }
- ```
-
-3. Import your project in Vercel:
- - Go to [Vercel Dashboard](https://vercel.com/dashboard)
- - Click **Add New** → **Project**
- - Import your Git repository
- - Vercel will automatically detect it as a Nuxt project
-
-4. Configure environment variables:
- - Before deploying, go to **Environment Variables**
- - Add `DATABASE_URL` with your database connection string
- - Click **Deploy**
-
-Vercel will automatically build and deploy your Nuxt application. The deployment process is the same as any other Node.js application, and Prisma Client will be generated during the build process thanks to the `postinstall` script.
-
-## Next steps
-
-- Explore the [full Nuxt + Prisma example](https://github.com/prisma/prisma-examples/tree/latest/orm/nuxt) for a complete blog application
-- Learn about [Prisma Client API](/v6/orm/prisma-client/setup-and-configuration/introduction)
-- Set up [Prisma Postgres](/v6/postgres) for a managed database
diff --git a/apps/docs/content/docs.v6/guides/permit-io-access-control.mdx b/apps/docs/content/docs.v6/guides/permit-io-access-control.mdx
deleted file mode 100644
index 28776b6817..0000000000
--- a/apps/docs/content/docs.v6/guides/permit-io-access-control.mdx
+++ /dev/null
@@ -1,705 +0,0 @@
----
-title: Permit.io
-description: Learn how to implement access control with Prisma ORM with Permit.io
-image: /img/guides/access-control-with-permitio.png
-url: /v6/guides/permit-io-access-control
-metaTitle: How to use Prisma ORM and Prisma Postgres with CPermit.io
-metaDescription: Learn how to implement access control with Prisma ORM with Permit.io
----
-
-## Introduction
-
-[Permit.io](https://www.permit.io/) is an authorization-as-a-service platform that lets you implement fine-grained access control
-rules based on real-world relationships.
-
-This guide explains how to connect Permit.io to a new Express + Prisma app, define a
-[Relationship-Based Access Control (ReBAC)](https://www.permit.io/blog/what-is-rebac) policy,
-and automatically filter Prisma queries so users only see the data they're allowed to access.
-
-You'll build a small project-task API to demonstrate access inheritance in action - no manual `WHERE` clauses required.
-
-You can find a complete example of this guide [here](https://www.permit.io/blog/prisma-orm-data-filtering-with-rebac).
-
-## Prerequisites
-
-- [Node.js v20+](https://nodejs.org/)
-- [PostgreSQL](https://www.postgresql.org/) (local or hosted)
-- [Prisma CLI](/v6/orm/tools/prisma-cli) (`npx prisma`)
-- [TypeScript](https://www.typescriptlang.org/)
-- [Permit CLI](https://github.com/permitio/permit-cli) (`npm install -g @permitio/cli`)
-
-## 1. Set up your project
-
-First of all, you'll create a new Express + Prisma project from scratch using TypeScript.
-You'll also install the tools needed to support ReBAC filtering with Permit.io.
-
-### 1.1 Create the project folder
-
-```npm
-mkdir prisma-rebac-filtering
-cd prisma-rebac-filtering
-npm init -y
-```
-
-### 1.2 Install the required dependencies
-
-Install application and development dependencies:
-
-```npm
-npm install express cors dotenv @prisma/client @prisma/adapter-pg pg
-```
-
-```npm
-npm install -D prisma typescript tsx @types/pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Then, initialize your Prisma setup:
-
-```npm
-npx prisma init
-```
-
-This creates:
-
-- A `prisma/` directory with a default `schema.prisma` file
-- A `prisma.config.ts` file for configuring Prisma
-- A `.env` file at the root.
-
-### 1.3 Set up your TypeScript config
-
-Create a `tsconfig.json` file:
-
-```json
-{
- "compilerOptions": {
- "target": "ES2020",
- "module": "CommonJS",
- "moduleResolution": "node",
- "esModuleInterop": true,
- "forceConsistentCasingInFileNames": true,
- "strict": true,
- "skipLibCheck": true,
- "outDir": "dist"
- },
- "include": ["src", "scripts"]
-}
-```
-
-### 1.4 Create your folder structure
-
-Set up your project folders:
-
-```bash
-mkdir -p src/controllers src/middleware src/config scripts
-```
-
-You're now ready to define your Prisma data model.
-
-## 2. The authorization model
-
-Before we continue with the setup, it's important to define how access control will work in your application.
-
-This guide uses **Relationship-Based Access Control (ReBAC)** to automatically restrict database queries based on a user's relationship to the data.
-
-Let's see what this looks like:
-
-
-
-### Scenario overview
-
-You're building a **project management API** that supports team-level access controls. Each project belongs to a team (like Marketing or Engineering), and users should only be able to access the projects—and their associated tasks—that they're assigned to.
-
-This is a perfect use case for ReBAC, because:
-
-- Access depends on relationships between users and data (e.g., team membership)
-- You want task access to inherit from project access
-- You want to avoid manually checking permissions in every controller
-
-### Resources
-
-These are the main data entities you'll protect:
-
-- `Project`: Represents a team-specific workspace that may contain business-critical data (timelines, budgets, client deliverables).
-- `Task`: Represents an item of work that belongs to a project
-
-### Relationships
-
-- Projects contain tasks (`Project → Task`)
-- Users are members of projects (`User → Project`)
-
-### Instance-level roles
-
-Instance-level roles describe what users can do with specific resources:
-
-| Role | Description |
-| ---------------- | ------------------------------------- |
-| `project#Member` | User can access a specific project |
-| `task#Member` | User can access tasks in that project |
-
-### Role derivation
-
-ReBAC lets you **automatically derive roles** based on relationships. In this case:
-
-- If a user is a `project#Member`, they automatically become a `task#Member` for all tasks within that project.
-- New tasks inherit project access—no need to update permissions manually.
-
-### Access policies
-
-Once relationships and roles are defined, access policies determine what users can do:
-
-| Role | Action | Resource |
-| ---------------- | ------ | -------- |
-| `project#Member` | `read` | Project |
-| `task#Member` | `read` | Task |
-
-This model ensures that:
-
-- Users can only access the projects and tasks they're assigned to
-- No cross-team visibility
-- Access automatically stays in sync with the business structure
-
-
-
-## 3. Define your data model
-
-To support permission-aware data filtering, you need to structure your database so that relationships are clearly defined. In this case, every `Task` belongs to a `Project`, and users gain access to tasks by being members of the parent project.
-
-### 3.1 Update your Prisma schema
-
-Open `prisma/schema.prisma` and replace the contents with the following:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model Project {
- id String @id @default(uuid())
- name String
- tasks Task[] // One-to-many relationship for permission inheritance
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-}
-
-model Task {
- id String @id @default(uuid())
- name String
- description String?
- projectId String
- project Project @relation(fields: [projectId], references: [id])
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-}
-```
-
-### 3.2 Add `dotenv` to `prisma.config.ts`
-
-To get access to the variables in the `.env` file, they can either be loaded by your runtime, or by using `dotenv`.
-Include an import for `dotenv` at the top of the `prisma.config.ts`
-
-```ts
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 3.3 Run your first migration
-
-To create the database schema:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-```npm
-npx prisma generate
-```
-
-This will:
-
-- Apply your schema to the connected PostgreSQL database
-- Generate your Prisma Client
-- Create tables for `Project` and `Task` with a one-to-many relationship
-
-### 3.3 Confirm the structure
-
-You can open Prisma Studio to inspect your database:
-
-```npm
-npx prisma studio
-```
-
-This structure allows the `@permitio/permit-prisma` extension to filter records by user relationships at query time. Next, you'll seed test data to simulate distinct team ownership over projects and tasks.
-
-## 4. Seed test data with project boundaries
-
-To test your data filtering logic, you'll create two projects, each with its own set of tasks. This separation simulates team ownership and will allow you to validate that users only see the data of their assigned project.
-
-### 4.1 Create the seed script
-
-Create a new file at `scripts/seed.ts` and add the following:
-
-```ts
-import { PrismaClient } from "../src/generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-async function main() {
- console.log("🌱 Seeding test data...");
-
- // Clear existing records
- await prisma.task.deleteMany();
- await prisma.project.deleteMany();
-
- // Create Project Alpha for the Marketing team
- const projectAlpha = await prisma.project.create({
- data: {
- id: "project_alpha",
- name: "Marketing Campaign Q2",
- },
- });
-
- // Create Project Beta for the Engineering team
- const projectBeta = await prisma.project.create({
- data: {
- id: "project_beta",
- name: "API Development Sprint",
- },
- });
-
- // Add tasks to Project Alpha
- await prisma.task.createMany({
- data: [
- {
- id: "task-alpha-1",
- name: "Strategy Planning",
- description: "Define campaign goals and KPIs",
- projectId: projectAlpha.id,
- },
- {
- id: "task-alpha-2",
- name: "Budget Review",
- description: "Review marketing budget with finance",
- projectId: projectAlpha.id,
- },
- ],
- });
-
- // Add tasks to Project Beta
- await prisma.task.createMany({
- data: [
- {
- id: "task-beta-1",
- name: "Implement Auth API",
- description: "Create endpoints for user login/signup",
- projectId: projectBeta.id,
- },
- {
- id: "task-beta-2",
- name: "Schema Migration",
- description: "Update tables for new user roles",
- projectId: projectBeta.id,
- },
- ],
- });
-
- console.log("✅ Seeded 2 projects and 4 tasks with distinct ownership");
-}
-
-main()
- .catch((e) => {
- console.error("❌ Error seeding data:", e);
- process.exit(1);
- })
- .finally(async () => {
- await prisma.$disconnect();
- });
-```
-
-### 4.2 Run the seed script
-
-```npm
-npx tsx scripts/seed.ts
-```
-
-If successful, you'll see:
-
-✅ Seeded 2 projects and 4 tasks with distinct ownership
-
-At this point, if you run a query like `prisma.task.findMany()`, it will return all tasks. In the next steps, you'll connect Permit.io to filter these results automatically based on the user's access rights.
-
-## 5. Install and configure ReBAC filtering
-
-In this section, you'll install the `@permitio/permit-prisma` extension and configure it to automatically filter Prisma queries based on your access control policies.
-
-### 5.1 Install the Permit extension
-
-Install the `permit-prisma` package:
-
-```npm
-npm install @permitio/permit-prisma
-```
-
-### 5.2 Configure the Permit client
-
-Create a new file at `src/config/permit-config.ts`:
-
-```ts
-import dotenv from "dotenv";
-dotenv.config();
-
-export const clientExtensionConfig = {
- permitConfig: {
- token: process.env.PERMIT_API_KEY!, // Your Permit.io API key
- pdp: process.env.PERMIT_PDP_URL || "http://localhost:7766", // Local or cloud PDP
- debug: true,
- },
- enableAutomaticChecks: true,
- enableDataFiltering: true, // Enables automatic query filtering
- enableResourceSync: true, // (Optional) Keeps Permit in sync with resource changes
-};
-```
-
-:::tip[API Key]
-You can find your API key and PDP URL in your [Permit.io dashboard](https://app.permit.io/).
-:::
-
-### 5.3 What this configuration does
-
-When you later extend the Prisma Client with this config:
-
-- All Prisma queries will automatically check access rules
-- `findMany()` and similar methods will **only return data the user is allowed to access**
-- You no longer need to manually add `WHERE` clauses to enforce permissions
-
-You're now ready to define your ReBAC policy using the Permit CLI.
-
-## 6. Define your access control policy in Permit.io
-
-Next, you'll use the **Permit CLI** to apply a ready-made ReBAC template that matches your project-task structure.
-
-### 6.1 Install the Permit CLI
-
-```npm
-npm install -g @permitio/cli
-```
-
-### 6.2 Log in to your Permit account
-
-Use the CLI to authenticate:
-
-```bash
-permit login
-```
-
-This opens a browser window where you can log in to your Permit.io account and link your CLI session to an environment.
-
-### 6.3 Apply the ReBAC policy template
-
-Permit provides a prebuilt policy structure for hierarchical data filtering.
-
-Apply it using:
-
-```bash
-permit env template apply --template orm-data-filtering
-```
-
-This will create:
-
-- **Resources**: `project`, `task`
-- **Relationships**: `project` is the parent of `task`
-- **Roles**:
- - `project#Member`: User can access a specific project
- - `task#Member`: Derived from project membership
-- **Access policies**: Users with the appropriate roles can `read` each resource
-
-### 6.4 View the policy in the Permit UI
-
-Go to the [Permit.io dashboard](https://app.permit.io/) and navigate to your environment to explore:
-
-- Your resource graph
-- Role derivations
-- Relationship mappings
-- Policy rules for `read` access
-
-:::info
-These rules are used by the @permitio/permit-prisma extension to determine which records to return for each user—automatically.
-:::
-
-With your policy in place, you're now ready to wire up user context and filtering logic in your Express middleware.
-
-## 7. Add middleware to set user context
-
-To filter Prisma queries per user, you need to:
-
-1. Identify the current user (simulated via an email header)
-2. Attach the filtered Prisma Client instance to the request
-3. Set the user in the Permit context (`prisma.$permit.setUser()`)
-
-### 7.1 Create the middleware file
-
-Create a new file: `src/middleware/auth.middleware.ts`
-
-```ts
-import { Request, Response, NextFunction } from "express";
-import { PrismaClient } from "../generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-import createPermitClientExtension from "@permitio/permit-prisma";
-import { clientExtensionConfig } from "../config/permit-config";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-// Extend PrismaClient with Permit
-const prisma = new PrismaClient({
- adapter,
-}).$extends(createPermitClientExtension(clientExtensionConfig));
-
-// Extend Request type with Prisma and user context
-export interface AuthRequest extends Request {
- user?: { email: string };
- prisma?: typeof prisma;
-}
-
-export const authenticate = (req: AuthRequest, res: Response, next: NextFunction): void => {
- const userEmail = req.headers["x-user-email"] as string;
-
- if (!userEmail) {
- res.status(401).json({ error: "Missing user email" });
- return;
- }
-
- // Register the user in Permit context
- prisma.$permit.setUser(userEmail);
-
- // Add user + Prisma client to request
- req.user = { email: userEmail };
- req.prisma = prisma;
-
- next();
-};
-```
-
-:::warning[Going to prod.]
-In a production app, you'd replace the x-user-email header with proper authentication logic (e.g. JWT or session validation).
-:::
-
-### 7.2 What this middleware does
-
-- Reads the user's email from the request header
-- Sets the user identity in the Permit context (used for query filtering)
-- Adds the filtered Prisma client to the request object (`req.prisma`)
-- Makes the user and database client available to all downstream route handlers
-
-You're now ready to build your API endpoints without writing a single line of access control logic.
-
-## 8. Build your API endpoints
-
-You'll now create two endpoints:
-
-- `GET /api/projects`: returns all projects the user has access to
-- `GET /api/tasks`: returns all tasks the user has access to (inherited from project membership)
-
-Thanks to the Permit-Prisma integration, **you won't need to add any manual filtering logic**—it's handled automatically.
-
-### 8.1 Get user-visible projects
-
-Create a controller file: `src/controllers/project.controller.ts`
-
-```ts
-import { Response } from "express";
-import { AuthRequest } from "../middleware/auth.middleware";
-
-export const getProjects = async (req: AuthRequest, res: Response) => {
- try {
- const prisma = req.prisma!;
-
- const projects = await prisma.project.findMany(); // Auto-filtered
-
- res.json({
- user: req.user?.email,
- count: projects.length,
- projects,
- });
- } catch (error: any) {
- console.error("Error fetching projects:", error);
- res.status(500).json({ error: error.message });
- }
-};
-```
-
-> Even though this is a raw findMany() query, only authorized records will be returned for the current user.
-
-### 8.2 Get user-visible tasks
-
-Create another controller: `src/controllers/task.controller.ts`
-
-```ts
-import { Response } from "express";
-import { AuthRequest } from "../middleware/auth.middleware";
-
-export const getTasks = async (req: AuthRequest, res: Response) => {
- try {
- const prisma = req.prisma!;
- const projectId = req.query.projectId as string;
-
- const where = projectId ? { projectId } : undefined;
-
- const tasks = await prisma.task.findMany({ where }); // Still filtered
-
- res.json({
- user: req.user?.email,
- count: tasks.length,
- tasks,
- });
- } catch (error: any) {
- console.error("Error fetching tasks:", error);
- res.status(500).json({ error: error.message });
- }
-};
-```
-
-:::info[projectId]
-Even if you provide a projectId manually, the query results are still filtered by permissions.
-:::
-
-### 8.3 What this demonstrates
-
-- You can write **normal Prisma queries**
-- Users will only get records they're allowed to see
-- You don't need custom role-checking logic in every handler
-- Task access is **automatically derived** from project membership
-
-You're now ready to wire it all together and launch the app.
-
-### 9.1 Create your Express app
-
-Create `src/app.ts`:
-
-```ts
-import express from "express";
-import cors from "cors";
-import { authenticate } from "./middleware/auth.middleware";
-import { getProjects } from "./controllers/project.controller";
-import { getTasks } from "./controllers/task.controller";
-
-const app = express();
-const PORT = process.env.PORT || 3000;
-
-app.use(cors());
-app.use(express.json());
-
-// Auth middleware applies ReBAC filtering per request
-app.get("/api/projects", authenticate, getProjects);
-app.get("/api/tasks", authenticate, getTasks);
-
-app.listen(PORT, () => {
- console.log(`🚀 Server running at http://localhost:${PORT}`);
- console.log(`🔐 ReBAC filtering is now active`);
-});
-```
-
-### 9.2 Run the server
-
-Start the development server with:
-
-```npm
-npx tsx src/app.ts
-```
-
-If everything is set up correctly, the console will display:
-
-```
-🚀 Server running at http://localhost:3000
-🔐 ReBAC filtering is now active
-```
-
----
-
-### 9.3 Test your API
-
-You can simulate requests as different users by setting the `x-user-email` header. This mimics logged-in users with access to specific projects.
-
-### Example: John (Marketing team member)
-
-```bash
-curl -H "x-user-email: john@company.com" http://localhost:3000/api/projects
-```
-
-This should only return Project Alpha (and its tasks).
-
-### Example: Mary (Engineering team member)
-
-```bash
-curl -H "x-user-email: mary@company.com" http://localhost:3000/api/tasks
-```
-
-This should only return tasks from Project Beta.
-
-:::tip
-If you haven't yet assigned users to project memberships in the Permit.io UI, visit the Policy Editor and assign users to roles (project#Member).
-:::
-
-Once you've confirmed these results, your Prisma API is now enforcing secure, relationship-based access control, all **without adding manual filtering logic anywhere in your code.**
-
-You've now built a secure API that:
-
-- Filters query results based on user relationships
-- Uses ReBAC to avoid role explosion and brittle permission logic
-- Keeps Prisma queries clean, safe, and scalable
-
-## 10. Next steps
-
-Now that you've successfully implemented data filtering with Prisma and ReBAC, you can extend this foundation to support more complex authorization use cases and developer tooling.
-
-### Extend your model
-
-- Add a `User` model and create a many-to-many `Membership` relationship between users and projects.
-- Introduce instance-level roles like `Editor` or `Owner` with different permissions.
-- Support additional actions like `create`, `update`, and `delete`, using Permit.io's role policies.
-
-### Add authentication
-
-Integrate your API with an auth provider (e.g., [Clerk](/v6/guides/clerk-nextjs), Auth0) and replace the `x-user-email` header with a secure identity mechanism (like a JWT token).
-
-### Use Permit Elements
-
-Permit.io provides UI components for:
-
-- Managing user access visually
-- Reviewing access logs
-- Approving access requests (MCP)
-
-Explore [Permit Elements](https://docs.permit.io/embeddable-uis/overview/) to make access management easier for your end users or admins.
-
-### More resources
-
-- [Permit.io ReBAC Policy Setup Guide](https://docs.permit.io/overview/create-a-rebac-policy)
-- [Read the full guide: Data Filtering with Prisma and ReBAC](https://docs.permit.io/how-to/enforce-permissions/data-filtering)
-- [ReBAC vs RBAC - Learn when to use which](https://www.permit.io/blog/rbac-vs-rebac)
diff --git a/apps/docs/content/docs.v6/guides/react-router-7.mdx b/apps/docs/content/docs.v6/guides/react-router-7.mdx
deleted file mode 100644
index 9f87150a01..0000000000
--- a/apps/docs/content/docs.v6/guides/react-router-7.mdx
+++ /dev/null
@@ -1,713 +0,0 @@
----
-title: React Router 7
-description: Learn how to use Prisma ORM and Prisma Postgres in a React Router 7 app.
-image: /img/guides/prisma-react-router-7-cover.png
-url: /v6/guides/react-router-7
-metaTitle: How to use Prisma ORM and Prisma Postgres with React Router 7
-metaDescription: Learn how to use Prisma ORM and Prisma Postgres in a React Router 7 app.
----
-
-## Introduction
-
-This guide shows you how to use Prisma ORM with [React Router 7](https://reactrouter.com/), a multi-strategy router that can be as minimal as declarative routing or as full-featured as a fullstack framework.
-
-You'll learn how to set up Prisma ORM and Prisma Postgres with React Router 7 and handle migrations. You can find a [deployment-ready example on GitHub](https://github.com/prisma/prisma-examples/blob/latest/orm/react-router-7).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-
-## 1. Set up your project
-
-From the directory where you want to create your project, run `create-react-router` to create a new React Router app that you will be using for this guide.
-
-```npm
-npx create-react-router@latest react-router-7-prisma
-```
-
-You'll be prompted to select the following, select `Yes` for both:
-
-:::info
-
-- _Initialize a new git repository?_ `Yes`
-- _Install dependencies with npm?_ `Yes`
- :::
-
-Now, navigate to the project directory:
-
-```bash
-cd react-router-7-prisma
-```
-
-## 2. Install and Configure Prisma
-
-### 2.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../app/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My React Router 7 Project"
-:::
-
-This will create:
-
-- A `prisma` directory with a `schema.prisma` file.
-- A `prisma.config.ts` file for configuring Prisma
-- A Prisma Postgres database.
-- A `.env` file containing the `DATABASE_URL` at the project root.
-- An `output` directory for the generated Prisma Client as `app/generated/prisma`.
-
-### 2.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, add the following models and change the generator to use the `prisma-client` provider:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-```
-
-This creates two models: `User` and `Post`, with a one-to-many relationship between them.
-
-### 2.3 Add `dotenv` to `prisma.config.ts`
-
-To get access to the variables in the `.env` file, they can either be loaded by your runtime, or by using `dotenv`.
-Include an import for `dotenv` at the top of the `prisma.config.ts`
-
-```ts
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.4. Configure the Prisma Client generator
-
-Now, run the following command to create the database tables and generate the Prisma Client:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-```npm
-npx prisma generate
-```
-
-### 2.5. Seed the database
-
-Add some seed data to populate the database with sample users and posts.
-
-Create a new file called `seed.ts` in the `prisma/` directory:
-
-```typescript title="prisma/seed.ts"
-import { PrismaClient, Prisma } from "../app/generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-const userData: Prisma.UserCreateInput[] = [
- {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: [
- {
- title: "Join the Prisma Discord",
- content: "https://pris.ly/discord",
- published: true,
- },
- {
- title: "Prisma on YouTube",
- content: "https://pris.ly/youtube",
- },
- ],
- },
- },
- {
- name: "Bob",
- email: "bob@prisma.io",
- posts: {
- create: [
- {
- title: "Follow Prisma on Twitter",
- content: "https://www.twitter.com/prisma",
- published: true,
- },
- ],
- },
- },
-];
-
-export async function main() {
- for (const u of userData) {
- await prisma.user.create({ data: u });
- }
-}
-
-main();
-```
-
-Now, tell Prisma how to run this script by updating your `prisma.config.ts`:
-
-```ts title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: `tsx prisma/seed.ts`, // [!code ++]
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Run the seed script:
-
-```npm
-npx prisma db seed
-```
-
-And open Prisma Studio to inspect your data:
-
-```npm
-npx prisma studio
-```
-
-## 3. Integrate Prisma into React Router 7
-
-### 3.1. Create a Prisma Client
-
-Inside of your `app` directory, create a new `lib` directory and add a `prisma.ts` file to it. This file will be used to create and export your Prisma Client instance.
-
-Set up the Prisma client like this:
-
-```typescript title="app/lib/prisma.ts"
-import { PrismaClient } from "../generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const globalForPrisma = global as unknown as {
- prisma: PrismaClient;
-};
-
-const prisma =
- globalForPrisma.prisma ||
- new PrismaClient({
- adapter,
- });
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
-
-export default prisma;
-```
-
-:::warning
-We recommend using a connection pooler (like [Prisma Accelerate](https://www.prisma.io/accelerate)) to manage database connections efficiently.
-
-If you choose not to use one, **avoid** instantiating `PrismaClient` globally in long-lived environments. Instead, create and dispose of the client per request to prevent exhausting your database connections.
-:::
-
-You'll use this client in the next section to run your first queries.
-
-### 3.2. Query your database with Prisma
-
-Now that you have an initialized Prisma Client, a connection to your database, and some initial data, you can start querying your data with Prisma ORM.
-
-In this example, you'll be making the "home" page of your application display all of your users.
-
-Open the `app/routes/home.tsx` file and replace the existing code with the following:
-
-```tsx title="app/routes/home.tsx"
-import type { Route } from "./+types/home";
-
-export function meta({}: Route.MetaArgs) {
- return [
- { title: "New React Router App" },
- { name: "description", content: "Welcome to React Router!" },
- ];
-}
-
-export default function Home({ loaderData }: Route.ComponentProps) {
- return (
-
-
- Superblog
-
-
-
Alice
-
Bob
-
-
- );
-}
-```
-
-:::note
-
-If you see an error on the first line, `import type { Route } from "./+types/home";`, make sure you run `npm run dev` so React Router generates needed types.
-
-:::
-
-This gives you a basic page with a title and a list of users. However, the list of users is static. Update the page to fetch the users from your database and make it dynamic.
-
-```tsx title="app/routes/home.tsx"
-import type { Route } from "./+types/home";
-import prisma from "~/lib/prisma"; // [!code ++]
-
-export function meta({}: Route.MetaArgs) {
- return [
- { title: "New React Router App" },
- { name: "description", content: "Welcome to React Router!" },
- ];
-}
-
-export async function loader() {
- // [!code ++]
- const users = await prisma.user.findMany(); // [!code ++]
- return { users }; // [!code ++]
-} // [!code ++]
-
-export default function Home({ loaderData }: Route.ComponentProps) {
- const { users } = loaderData; // [!code ++]
- return (
-
- );
-}
-```
-
-You are now importing your client, using [a React Router loader](https://reactrouter.com/start/framework/data-loading#server-data-loading) to query the `User` model for all users, and then displaying them in a list.
-
-Now your home page is dynamic and will display the users from your database.
-
-### 3.4 Update your data (optional)
-
-If you want to see what happens when data is updated, you could:
-
-- update your `User` table via an SQL browser of your choice
-- change your `seed.ts` file to add more users
-- change the call to `prisma.user.findMany` to re-order the users, filter the users, or similar.
-
-Just reload the page and you'll see the changes.
-
-## 4. Add a new Posts list page
-
-You have your home page working, but you should add a new page that displays all of your posts.
-
-First, create a new `posts` directory under the `app/routes` directory and add a `home.tsx` file:
-
-```bash
-mkdir -p app/routes/posts && touch app/routes/posts/home.tsx
-```
-
-Second, add the following code to the `app/routes/posts/home.tsx` file:
-
-```tsx title="app/routes/posts/home.tsx"
-import type { Route } from "./+types/home";
-import prisma from "~/lib/prisma";
-
-export default function Home() {
- return (
-
-
Posts
-
-
My first post
-
-
- );
-}
-```
-
-Second, update the `app/routes.ts` file so when you visit the `/posts` route, the `posts/home.tsx` page is shown:
-
-```tsx title="app/routes.ts"
-// edit-start
-import { type RouteConfig, index, route } from "@react-router/dev/routes";
-// edit-end
-
-export default [
- index("routes/home.tsx"),
- route("posts", "routes/posts/home.tsx"), // [!code ++]
-] satisfies RouteConfig;
-```
-
-Now `localhost:5173/posts` will load, but the content is static. Update it to be dynamic, similarly to the home page:
-
-```tsx title="app/routes/posts/home.tsx"
-import type { Route } from "./+types/home";
-import prisma from "~/lib/prisma";
-
-export async function loader() {
- // [!code ++]
- const posts = await prisma.post.findMany({
- // [!code ++]
- include: {
- // [!code ++]
- author: true, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- return { posts }; // [!code ++]
-} // [!code ++]
-
-export default function Posts({ loaderData }: Route.ComponentProps) {
- const { posts } = loaderData; // [!code ++]
- return (
-
- );
-}
-```
-
-This works similarly to the home page, but instead of displaying users, it displays posts. You can also see that you've used `include` in your Prisma Client query to fetch the author of each post so you can display the author's name.
-
-This "list view" is one of the most common patterns in web applications. You're going to add two more pages to your application which you'll also commonly need: a "detail view" and a "create view".
-
-## 5. Add a new Posts detail page
-
-To complement the Posts list page, you'll add a Posts detail page.
-
-In the `routes/posts` directory, create a new `post.tsx` file.
-
-```bash
-touch app/routes/posts/post.tsx
-```
-
-This page will display a single post's title, content, and author. Just like your other pages, add the following code to the `app/routes/posts/post.tsx` file:
-
-```tsx title="app/routes/posts/post.tsx"
-import type { Route } from "./+types/post";
-import prisma from "~/lib/prisma";
-
-export default function Post({ loaderData }: Route.ComponentProps) {
- return (
-
-
-
My first post
-
by Anonymous
-
No content available.
-
-
- );
-}
-```
-
-And then add a new route for this page:
-
-```tsx title="app/routes.ts"
-export default [
- index("routes/home.tsx"),
- route("posts", "routes/posts/home.tsx"),
- route("posts/:postId", "routes/posts/post.tsx"), // [!code ++]
-] satisfies RouteConfig;
-```
-
-As before, this page is static. Update it to be dynamic based on the `params` passed to the page:
-
-```tsx title="app/routes/posts/post.tsx"
-import { data } from "react-router"; // [!code ++]
-import type { Route } from "./+types/post";
-import prisma from "~/lib/prisma";
-
-export async function loader({ params }: Route.LoaderArgs) {
- // [!code ++]
- const { postId } = params; // [!code ++]
- const post = await prisma.post.findUnique({
- // [!code ++]
- where: { id: parseInt(postId) }, // [!code ++]
- include: {
- // [!code ++]
- author: true, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
-
- if (!post) {
- // [!code ++]
- throw data("Post Not Found", { status: 404 }); // [!code ++]
- } // [!code ++]
- return { post }; // [!code ++]
-} // [!code ++]
-
-export default function Post({ loaderData }: Route.ComponentProps) {
- const { post } = loaderData; // [!code ++]
- return (
-
-
-
{post.title}
// [!code ++]
-
by {post.author.name}
// [!code ++]
-
{post.content || "No content available."}
//
- [!code ++]
-
-
- );
-}
-```
-
-There's a lot of changes here, so break it down:
-
-- You're using Prisma Client to fetch the post by its `id`, which you get from the `params` object.
-- In case the post doesn't exist (maybe it was deleted or maybe you typed a wrong ID), you throw an error to display a 404 page.
-- You then display the post's title, content, and author. If the post doesn't have content, you display a placeholder message.
-
-It's not the prettiest page, but it's a good start. Try it out by navigating to `localhost:5173/posts/1` and `localhost:5173/posts/2`. You can also test the 404 page by navigating to `localhost:5173/posts/999`.
-
-## 6. Add a new Posts create page
-
-To round out your application, you'll add a "create" page for posts. This will allow you to write your own posts and save them to the database.
-
-As with the other pages, you'll start with a static page and then update it to be dynamic.
-
-```bash
-touch app/routes/posts/new.tsx
-```
-
-Now, add the following code to the `app/routes/posts/new.tsx` file:
-
-```tsx title="app/routes/posts/new.tsx"
-import type { Route } from "./+types/new";
-import { Form } from "react-router";
-
-export async function action({ request }: Route.ActionArgs) {
- const formData = await request.formData();
- const title = formData.get("title") as string;
- const content = formData.get("content") as string;
-}
-
-export default function NewPost() {
- return (
-
-
Create New Post
-
-
- );
-}
-```
-
-You can't open the `posts/new` page in your app yet. To do that, you need to add it to `routes.tsx` again:
-
-```tsx title="app/routes.ts"
-export default [
- index("routes/home.tsx"),
- route("posts", "routes/posts/home.tsx"),
- route("posts/:postId", "routes/posts/post.tsx"),
- route("posts/new", "routes/posts/new.tsx"), // [!code ++]
-] satisfies RouteConfig;
-```
-
-Now you can view the form at the new URL. It looks good, but it doesn't do anything yet. Update the `action` to save the post to the database:
-
-```tsx title="app/routes/posts/new.tsx"
-import type { Route } from "./+types/new";
-import { Form, redirect } from "react-router"; // [!code ++]
-import prisma from "~/lib/prisma"; // [!code ++]
-
-export async function action({ request }: Route.ActionArgs) {
- const formData = await request.formData();
- const title = formData.get("title") as string;
- const content = formData.get("content") as string;
-
- try {
- // [!code ++]
- await prisma.post.create({
- // [!code ++]
- data: {
- // [!code ++]
- title, // [!code ++]
- content, // [!code ++]
- authorId: 1, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- } catch (error) {
- // [!code ++]
- console.error(error); // [!code ++]
- return Response.json({ error: "Failed to create post" }, { status: 500 }); // [!code ++]
- } // [!code ++]
-
- return redirect("/posts"); // [!code ++]
-}
-
-export default function NewPost() {
- return (
-
-
Create New Post
-
-
- );
-}
-```
-
-This page now has a functional form! When you submit the form, it will create a new post in the database and redirect you to the posts list page.
-
-Try it out by navigating to `localhost:5173/posts/new` and submitting the form.
-
-## 7. Next steps
-
-Now that you have a working React Router application with Prisma ORM, here are some ways you can expand and improve your application:
-
-- Add authentication to protect your routes
-- Add the ability to edit and delete posts
-- Add comments to posts
-- Use [Prisma Studio](/v6/orm/tools/prisma-studio) for visual database management
-
-For more information and updates:
-
-- [Prisma ORM documentation](/v6/orm)
-- [Prisma Client API reference](/v6/orm/prisma-client/setup-and-configuration/introduction)
-- [React Router documentation](https://reactrouter.com/home)
-- Join our [Discord community](https://pris.ly/discord)
-- Follow us on [Twitter](https://twitter.com/prisma) and [YouTube](https://youtube.com/prismadata)
diff --git a/apps/docs/content/docs.v6/guides/shopify.mdx b/apps/docs/content/docs.v6/guides/shopify.mdx
deleted file mode 100644
index 1cffaedf25..0000000000
--- a/apps/docs/content/docs.v6/guides/shopify.mdx
+++ /dev/null
@@ -1,765 +0,0 @@
----
-title: Shopify
-description: Learn how to use Prisma Postgres with Shopify
-image: /img/guides/prisma-shopify-cover.png
-url: /v6/guides/shopify
-metaTitle: How to use Prisma Postgres with Shopify
-metaDescription: Learn how to use Prisma Postgres with Shopify
----
-
-## Introduction
-
-[Shopify](https://www.shopify.com/) is a popular platform for building e-commerce stores. This guide will show you how to connect a Shopify app to a [Prisma Postgres](https://www.prisma.io/postgres) database in order to create internal notes for products.
-
-## Prerequisites
-
-- [Node.js](https://nodejs.org/en/download/)
-- [Shopify CLI](https://shopify.dev/docs/api/shopify-cli)
-- [Shopify Partner Account](https://www.shopify.com/partners) and a [development store](https://shopify.dev/docs/api/development-stores#create-a-development-store-to-test-your-app)
-
-## 1. Set up your project
-
-:::note
-If you do not have the Shopify CLI installed, you can install it with `npm install -g @shopify/cli`.
-:::
-
-To start, initialize a new Shopify app using the Shopify CLI:
-
-```bash
-shopify app init
-```
-
-During setup, you'll be prompted to customize your app. Don't worry—just follow these recommended options to get started quickly and ensure your app is set up for success:
-
-:::info
-
-- _Get started building your app:_ `Build a Remix app (recommended)`
-- _For your Remix template, which language do you want:_ `JavaScript`
-- _App Name:_ `prisma-store` _(name cannot contain `shopify`)_
-
-:::
-
-Navigate to the `prisma-store` directory:
-
-```bash
-cd prisma-store
-```
-
-## 2. Set up Prisma
-
-Prisma comes pre-installed in your project, but let's take a moment to update it to the latest version. This ensures you have access to the newest features, improvements, and the best possible experience as you build your app.
-
-You will be swapping to a Prisma Postgres database, so delete the `migrations` folder along with the `dev.sqlite` file, inside of the `prisma` directory.
-
-You need to update a few things in the `schema.prisma` file to get it working with Remix and Prisma Postgres.
-
-- Swap to the new `prisma-client` generator.
-- Update the provider to `postgresql`.
-- Update the url to the new database url.
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client-js" // [!code --]
- provider = "prisma-client" // [!code ++]
- output = "../app/generated/prisma" // [!code ++]
-}
-
-datasource db {
- provider = "sqlite" // [!code --]
- provider = "postgresql" // [!code ++]
- url = "file:../dev.db" // [!code --]
-}
-
-model Session {
- // ... existing model
-}
-```
-
-Create a `prisma.config.ts` file to configure Prisma:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config"; // [!code ++]
-
-export default defineConfig({
- // [!code ++]
- schema: "prisma/schema.prisma", // [!code ++]
- migrations: {
- // [!code ++]
- path: "prisma/migrations", // [!code ++]
- }, // [!code ++]
- datasource: {
- // [!code ++]
- url: env("DATABASE_URL"), // [!code ++]
- }, // [!code ++]
-}); // [!code ++]
-```
-
-:::note
-
-Since Shopify apps typically have dotenv pre-installed, you should already have access to it. If not, install it with:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-To enable your app to store notes for each product, let's add a new `ProductNote` model to your Prisma schema.
-
-This model will allow you to save and organize notes linked to individual products in your database through the `productGid` field.
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model Session {
- // ... existing model
-}
-
-model ProductNote { // [!code ++]
- id String @id @default(uuid()) // [!code ++]
- productGid String // [!code ++]
- body String? // [!code ++]
- createdAt DateTime @default(now()) // [!code ++]
- updatedAt DateTime @updatedAt // [!code ++]
-} // [!code ++]
-```
-
-Next, Prisma will need to be updated to the latest version. Run:
-
-```npm
-npm install prisma @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Prisma Postgres allows you to create a new database on the fly, you can create a new database at the same time you initialize your project by adding the `--db` flag:
-
-```npm
-npx prisma init --db
-```
-
-Once you've completed the prompts, it's time to access your new database:
-
-1. **Open the [Prisma Console](https://console.prisma.io):**
- - Log in and select your newly created database project.
-2. **Get your database connection string:**
- - Click the **Connect** button.
- - Copy the connection string that appears. It should look similar to this:
- ```text
- DATABASE_URL="postgresql://user:password@host:5432/database?sslmode=require"
- ```
-3. **Configure your environment:**
- - Create a new `.env` file in the root of your project.
- - Paste the `DATABASE_URL` you just copied into this file.
-4. **Apply your database schema:**
- - Run the following command to create your tables and get your database ready:
-
- ```npm
- npx prisma migrate dev --name init
- ```
-
- Then generate Prisma Client:
-
- ```npm
- npx prisma generate
- ```
-
-Now, before moving on, let's update your `db.server.ts` file to use the newly generated Prisma client with the driver adapter:
-
-```tsx title="app/db.server.ts"
-import { PrismaClient } from "@prisma/client"; // [!code --]
-import { PrismaClient } from "./generated/prisma/client.js"; // [!code ++]
-import { PrismaPg } from "@prisma/adapter-pg"; // [!code ++]
-
-const adapter = new PrismaPg({
- // [!code ++]
- connectionString: process.env.DATABASE_URL, // [!code ++]
-}); // [!code ++]
-
-if (process.env.NODE_ENV !== "production") {
- if (!global.prismaGlobal) {
- global.prismaGlobal = new PrismaClient();
- {
- /* [!code --] */
- }
- global.prismaGlobal = new PrismaClient({ adapter });
- {
- /* [!code ++] */
- }
- }
-}
-
-const prisma = global.prismaGlobal ?? new PrismaClient();
-{
- /* [!code --] */
-}
-const prisma = global.prismaGlobal ?? new PrismaClient({ adapter });
-{
- /* [!code ++] */
-}
-
-export default prisma;
-```
-
-:::warning
-It is recommended to add `app/generated/prisma` to your `.gitignore` file.
-:::
-
-## 3. Create your Remix model
-
-To keep your project organized, let's create a new `models/` folder. Inside this folder, add a file named `notes.server.js`. This will be the home for all your note-related logic and make your codebase easier to manage as your app grows.
-
-The `notes.server.js` file will contain two functions:
-
-- `getNotes` - This will get all the notes for a given product.
-- `createNote` - This will create a new note for a given product.
-
-Start by importing the Prisma client from `db.server.ts` and creating the `getNotes` function:
-
-```js title="models/notes.server.js"
-import prisma from "../db.server"; // [!code ++]
-
-export const getNotes = async (productGid) => {
- // [!code ++]
- const notes = await prisma.productNote.findMany({
- // [!code ++]
- where: { productGid: productGid.toString() }, // [!code ++]
- orderBy: { createdAt: "desc" }, // [!code ++]
- }); // [!code ++]
- return notes; // [!code ++]
-}; // [!code ++]
-```
-
-To enable users to add new notes to your database, let's create a function in `notes.server.js` that uses `prisma.productNote.create`:
-
-```js title="models/notes.server.js"
-import prisma from "../db.server";
-
-export const getNotes = async (productGid) => {
- const notes = await prisma.productNote.findMany({
- where: { productGid: productGid.toString() },
- orderBy: { createdAt: "desc" },
- });
- return notes;
-};
-
-export const createNote = async (note) => {
- // [!code ++]
- const newNote = await prisma.productNote.create({
- // [!code ++]
- data: {
- // [!code ++]
- body: note.body, // [!code ++]
- productGid: note.productGid, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
- return newNote; // [!code ++]
-}; // [!code ++]
-```
-
-## 4. Create your layout route
-
-Before those functions are able to be called, our route needs a layout to sit in. This layout route will feature a button for selecting a product, and will act as the parent for your `ProductNotes` route, keeping your app organized and user-friendly.
-
-### 4.1. Create the ProductNotesLayout component
-
-Start by creating the file `routes/app.product-notes.jsx` and adding the `ProductNotesLayout` component inside it:
-
-```jsx title="app/routes/app.product-notes.jsx"
-import { Page, Layout } from "@shopify/polaris"; // [!code ++]
-
-export default function ProductNotesLayout() {
- // [!code ++]
- return (
- // [!code ++]
-
- {" "}
- // [!code ++]
-
- {" "}
- // [!code ++]
- // [!code ++]
- {" "}
- // [!code ++]
- // [!code ++]
- ); // [!code ++]
-} // [!code ++]
-```
-
-Next, create the `selectProduct` function and a `Button` to let the user pick a product:
-
-```jsx title="app/routes/app.product-notes.jsx"
-import { useNavigate } from "@remix-run/react";
-import { Page, Layout } from "@shopify/polaris";
-{
- /* [!code --] */
-}
-import { Button, Page, Layout } from "@shopify/polaris";
-{
- /* [!code ++] */
-}
-
-export default function ProductNotesLayout() {
- const navigate = useNavigate();
- {
- /* [!code ++] */
- }
-
- async function selectProduct() {
- // [!code ++]
- const products = await window.shopify.resourcePicker({
- // [!code ++]
- type: "product", // [!code ++]
- action: "select", // [!code ++]
- }); // [!code ++]
- const selectedGid = products[0].id; // [!code ++]
- navigate(`/app/product-notes/${encodeURIComponent(selectedGid)}`); // [!code ++]
- } // [!code ++]
-
- return (
-
-
-
- {" "}
- // [!code ++]
-
-
-
- );
-}
-```
-
-Remix renders provides the ability to render a nested route. Add an `` to the `routes/app.product-notes.jsx` file where the `ProductNotes` route will be rendered:
-
-```jsx title="app/routes/app.product-notes.jsx"
-import { useNavigate } from "@remix-run/react";
-{
- /* [!code --] */
-}
-import { Outlet, useNavigate } from "@remix-run/react";
-{
- /* [!code ++] */
-}
-import { Page, Button, Layout } from "@shopify/polaris";
-
-export default function ProductNotesLayout() {
- const navigate = useNavigate();
-
- async function selectProduct() {
- const products = await window.shopify.resourcePicker({
- type: "product",
- action: "select",
- });
- const selectedGid = products[0].id;
- navigate(`/app/product-notes/${encodeURIComponent(selectedGid)}`);
- }
-
- return (
-
-
-
-
-
- {/* [!code ++] */}
-
-
- );
-}
-```
-
-### 4.2. Add the ProductNotesLayout to the sidebar
-
-If you run `npm run dev`, you won't be able to see the `Product Notes` route. To fix this, you need to add the `ProductNotesLayout` to the `app.jsx` file so it shows up in the sidebar:
-
-```jsx title="app/routes/app.jsx"
-import { Link, Outlet, useLoaderData, useRouteError } from "@remix-run/react";
-import { boundary } from "@shopify/shopify-app-remix/server";
-import { AppProvider } from "@shopify/shopify-app-remix/react";
-import { NavMenu } from "@shopify/app-bridge-react";
-import polarisStyles from "@shopify/polaris/build/esm/styles.css?url";
-import { authenticate } from "../shopify.server";
-
-export const links = () => [{ rel: "stylesheet", href: polarisStyles }];
-
-export const loader = async ({ request }) => {
- await authenticate.admin(request);
-
- return { apiKey: process.env.SHOPIFY_API_KEY || "" };
-};
-
-export default function App() {
- const { apiKey } = useLoaderData();
-
- return (
-
- [ Home ](/app) [Product Notes](/app/product-notes) {/* [!code ++] */}
-
-
- );
-}
-
-// Shopify needs Remix to catch some thrown responses, so that their headers are included in the response.
-export function ErrorBoundary() {
- return boundary.error(useRouteError());
-}
-
-export const headers = (headersArgs) => {
- return boundary.headers(headersArgs);
-};
-```
-
-## 5. Create your product notes route
-
-Currently, if you run `npm run dev` and navigate to the `Product Notes` route, you will see nothing once selecting a product.
-
-Follow these steps to create the product notes route:
-
-Create a new `routes/app/app.notes.$productGid.jsx` file which will take in the productGid as a parameter, and return the product notes associated with the product as well as a form to create a new note:
-
-```jsx title="app/routes/app/app.notes.$productGid.jsx"
-export default function ProductNotes() {
- // [!code ++]
- return <>>; // [!code ++]
-} // [!code ++]
-```
-
-### 5.1. Render the notes
-
-On load, the route will need to fetch the notes for the product and display them.
-
-Add a `loader` function to the route:
-
-```jsx title="app/routes/app/app.notes.$productGid.jsx"
-import { json } from "@remix-run/node"; // [!code ++]
-import { useLoaderData } from "@remix-run/react"; // [!code ++]
-import { getNotes } from "../models/note.server"; // [!code ++]
-
-export const loader = async ({ params }) => {
- // [!code ++]
- const { productGid } = params; // [!code ++]
- const notes = await getNotes(productGid); // [!code ++]
- return json({ notes, productGid }); // [!code ++]
-}; // [!code ++]
-
-export default function ProductNotes() {
- const { notes, productGid } = useLoaderData();
- {
- /* [!code ++] */
- }
-
- return <>>;
-}
-```
-
-Map out the notes in the `ProductNotes` component, using Polaris components:
-
-```jsx title="app/routes/app/app.notes.$productGid.jsx"
-import { json } from "@remix-run/node";
-import { useLoaderData } from "@remix-run/react";
-import { getNotes } from "../models/note.server";
-import { Card, Layout, Text, BlockStack } from "@shopify/polaris";
-{
- /* [!code ++] */
-}
-
-export const loader = async ({ params }) => {
- const { productGid } = params;
- const notes = await getNotes(productGid);
- return json({ notes, productGid });
-};
-
-export default function ProductNotes() {
- const { notes, productGid } = useLoaderData();
- return (
- <>
-
- {" "}
- // [!code ++]
-
- {" "}
- // [!code ++]
- {notes.length === 0 ? ( // [!code ++]
-
- {" "}
- // [!code ++] No notes yet. // [!code ++]
- // [!code ++]
- ) : (
- // [!code ++]
- notes.map(
- (
- note, // [!code ++]
- ) => (
-
- {" "}
- // [!code ++]
-
- {" "}
- // [!code ++]
- {note.body && ( // [!code ++]
-
- {" "}
- // [!code ++]
- {note.body} // [!code ++]
- // [!code ++]
- )}{" "}
- // [!code ++]
-
- {" "}
- // [!code ++] Added: {new Date(note.createdAt).toLocaleString()} // [!code ++]
- {" "}
- // [!code ++]
- {" "}
- // [!code ++]
- // [!code ++]
- ),
- ) // [!code ++]
- )}{" "}
- // [!code ++]
- {" "}
- // [!code ++]
- {" "}
- // [!code ++]
- >
- );
-}
-```
-
-You should be seeing "No notes yet.". If so, you're on the right track.
-
-### 5.2. Add the form
-
-A few things need to be added to the route in order to create a new note:
-
-- Add an `action` function to the route.
-- Display a `Toast` notification when a note is created.
-- Import the `createNote` function from `models/note.server.js`.
-- Import the `useActionData` and `useAppBridge`
-
-```jsx title="app/routes/app/app.notes.$productGid.jsx"
-import { json, redirect } from "@remix-run/node";
-import { useLoaderData } from "@remix-run/react";
-{
- /* [!code --] */
-}
-import { useLoaderData, useActionData } from "@remix-run/react";
-{
- /* [!code ++] */
-}
-import { getNotes } from "../models/note.server";
-{
- /* [!code --] */
-}
-import { getNotes, createNote } from "../models/note.server";
-{
- /* [!code ++] */
-}
-import { Card, Layout, Text, BlockStack } from "@shopify/polaris";
-import { useAppBridge } from "@shopify/app-bridge-react";
-{
- /* [!code ++] */
-}
-
-export const loader = async ({ params }) => {
- const { productGid } = params;
- const notes = await getNotes(productGid);
- return json({ notes, productGid });
-};
-
-export const action = async ({ request, params }) => {
- // [!code ++]
- const formData = await request.formData(); // [!code ++]
- const body = formData.get("body")?.toString() || null; // [!code ++]
- const { productGid } = params; // [!code ++]
-
- await createNote({ productGid, body }); // [!code ++]
- return redirect(`/app/product-notes/${encodeURIComponent(productGid)}`); // [!code ++]
-}; // [!code ++]
-
-export default function ProductNotes() {
- const { notes, productGid } = useLoaderData();
- const actionData = useActionData(); // [!code ++]
- const app = useAppBridge(); // [!code ++]
-
- useEffect(() => {
- // [!code ++]
- if (actionData?.ok) {
- // [!code ++]
- app.toast.show("Note saved", { duration: 3000 }); // [!code ++]
- setBody(""); // [!code ++]
- } // [!code ++]
- }, [actionData, app]); // [!code ++]
-
- return (
- <>
-
-
- {notes.length === 0 ? (
-
- No notes yet.
-
- ) : (
- notes.map((note) => (
-
-
- {note.body && (
-
- {note.body}
-
- )}
-
- Added: {new Date(note.createdAt).toLocaleString()}
-
-
-
- ))
- )}
-
-
- >
- );
-}
-```
-
-Now, you can build out the form that will call the `action` function:
-
-```jsx title="app/routes/app/app.notes.$productGid.jsx"
-import { json, redirect } from "@remix-run/node";
-import { useLoaderData, useActionData } from "@remix-run/react";
-import { getNotes, createNote } from "../models/note.server";
-import { Card, Layout, Text, BlockStack } from "@shopify/polaris"; {/* [!code --] */}
-import { {/* [!code ++] */}
- Card,
- Layout,
- Text,
- BlockStack,
- Form,
- FormLayout,
- TextField,
- Button,
-} from "@shopify/polaris";
-import { useAppBridge } from "@shopify/app-bridge-react";
-
-export const loader = async ({ params }) => {
- const { productGid } = params;
- const notes = await getNotes(productGid);
- return json({ notes, productGid });
-};
-
-export const action = async ({ request, params }) => {
- const formData = await request.formData();
- const body = formData.get("body")?.toString() || null;
- const { productGid } = params;
-
- await createNote({ productGid, body });
- return redirect(`/app/product-notes/${encodeURIComponent(productGid)}`);
-};
-
-export default function ProductNotes() {
- const { notes, productGid } = useLoaderData();
- const actionData = useActionData(); // [!code ++]
- const app = useAppBridge(); // [!code ++]
-
- useEffect(() => { // [!code ++]
- if (actionData?.ok) { // [!code ++]
- app.toast.show("Note saved", { duration: 3000 }); // [!code ++]
- setBody(""); // [!code ++]
- } // [!code ++]
- }, [actionData, app]); // [!code ++]
-
- return (
- <>
- // [!code ++]
- // [!code ++]
- // [!code ++]
- // [!code ++]
- // [!code ++]
-
-
- {notes.length === 0 ? (
-
- No notes yet.
-
- ) : (
- notes.map((note) => (
-
-
- {note.body && (
-
- {note.body}
-
- )}
-
- Added: {new Date(note.createdAt).toLocaleString()}
-
-
-
- ))
- )}
-
-
- >
- );
-}
-```
-
-You should now be able to add a note to a product and see it displayed.
-
-### 6. Test your route
-
-Run `npm run dev` and navigate to the `Product Notes` route.
-
-- Navigate to Product Notes on the sidebar
-- Select a product
-- Add a note
-- Verify that notes are displayed and saved correctly.
-
-## Next Steps
-
-Now that you have a working Shopify app connected to a Prisma Postgres database, you can:
-
-- Extend your Prisma schema with more models and relationships
-- Add create/update/delete routes and forms
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-
-### More Info
-
-- [Prisma Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [Shopify Dev Documentation](https://shopify.dev/docs)
diff --git a/apps/docs/content/docs.v6/guides/solid-start.mdx b/apps/docs/content/docs.v6/guides/solid-start.mdx
deleted file mode 100644
index 76a86935d5..0000000000
--- a/apps/docs/content/docs.v6/guides/solid-start.mdx
+++ /dev/null
@@ -1,443 +0,0 @@
----
-title: SolidStart
-description: Learn how to use Prisma ORM in a SolidStart app
-image: /img/guides/prisma-solid-start-cover.png
-url: /v6/guides/solid-start
-metaTitle: How to use Prisma ORM and Prisma Postgres with SolidStart
-metaDescription: Learn how to use Prisma ORM in a SolidStart app
----
-
-## Introduction
-
-Prisma ORM streamlines database access with type-safe queries and a smooth developer experience. SolidStart, a modern framework for building reactive web apps with SolidJS, pairs well with Prisma and Postgres to create a clean and scalable full-stack architecture.
-
-In this guide, you'll learn how to integrate Prisma ORM with a Prisma Postgres database in a SolidStart project from scratch. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/solid-start).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-
-## 1. Set up your project
-
-Begin by creating a new SolidStart app. In your terminal, run:
-
-```npm
-npm init solid@latest
-```
-
-Use the following options when prompted:
-
-:::info
-
-- _Project name:_ `my-solid-prisma-app`
-- _Is this a SolidStart project:_ `Yes`
-- _Template:_ `bare`
-- _Use TypeScript:_ `Yes`
-
-:::
-
-Next, navigate into your new project, install dependencies, and start the development server:
-
-```npm
-cd my-solid-prisma-app
-npm install
-npm run dev
-```
-
-Once the dev server is running, open `http://localhost:3000` in your browser. You should see the SolidStart welcome screen.
-
-Clean up the default UI by editing the `app.tsx` file and replacing its content with the following code:
-
-```typescript title="src/app.tsx"
-import "./app.css";
-
-export default function App() {
- return (
-
-
SolidStart + Prisma
-
- );
-}
-```
-
-## 2. Install and Configure Prisma
-
-### 2.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output ../src/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My SolidStart Project"
-:::
-
-This will create:
-
-- A `prisma` directory with a `schema.prisma` file.
-- A `prisma.config.ts` file for configuring Prisma
-- A Prisma Postgres database.
-- A `.env` file containing the `DATABASE_URL` at the project root.
-- An `output` directory for the generated Prisma Client as `src/generated/prisma`.
-
-### 2.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, add the following models and change the generator to use the `prisma-client` provider:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-```
-
-This creates two models: `User` and `Post`, with a one-to-many relationship between them.
-
-### 2.3 Add `dotenv` to `prisma.config.ts`
-
-To get access to the variables in the `.env` file, they can either be loaded by your runtime, or by using `dotenv`.
-Include an import for `dotenv` at the top of the `prisma.config.ts`
-
-```ts
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.4. Configure the Prisma Client generator
-
-Now, run the following command to create the database tables and generate the Prisma Client:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-```npm
-npx prisma generate
-```
-
-### 2.5. Seed the database
-
-Let's add some seed data to populate the database with sample users and posts.
-
-Create a new file called `seed.ts` in the `prisma/` directory:
-
-```typescript title="prisma/seed.ts"
-import { PrismaClient, Prisma } from "../src/generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-const userData: Prisma.UserCreateInput[] = [
- {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: [
- {
- title: "Join the Prisma Discord",
- content: "https://pris.ly/discord",
- published: true,
- },
- {
- title: "Prisma on YouTube",
- content: "https://pris.ly/youtube",
- },
- ],
- },
- },
- {
- name: "Bob",
- email: "bob@prisma.io",
- posts: {
- create: [
- {
- title: "Follow Prisma on Twitter",
- content: "https://www.twitter.com/prisma",
- published: true,
- },
- ],
- },
- },
-];
-
-export async function main() {
- for (const u of userData) {
- await prisma.user.create({ data: u });
- }
-}
-
-main();
-```
-
-Now, tell Prisma how to run this script by updating your `prisma.config.ts`:
-
-```ts title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: `tsx prisma/seed.ts`, // [!code ++]
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Run the seed script:
-
-```npm
-npx prisma db seed
-```
-
-And open Prisma Studio to inspect your data:
-
-```npm
-npx prisma studio
-```
-
-## 3. Integrate Prisma into SolidStart
-
-### 3.1. Create a Prisma Client
-
-At the root of your project, create a new `lib` folder and a `prisma.ts` file inside it:
-
-```bash
-mkdir -p lib && touch lib/prisma.ts
-```
-
-Add the following code to create a Prisma Client instance:
-
-```typescript title="lib/prisma.ts"
-import { PrismaClient } from "../src/generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-export default prisma;
-```
-
-:::warning
-We recommend using a connection pooler (like [Prisma Accelerate](https://www.prisma.io/accelerate)) to manage database connections efficiently.
-
-If you choose not to use one, **avoid** instantiating `PrismaClient` globally in long-lived environments. Instead, create and dispose of the client per request to prevent exhausting your database connections.
-:::
-
-### 3.2. Create an API Route
-
-Now, let's fetch data from the database using an API route.
-
-Create a new file at `src/routes/api/users.ts`:
-
-```typescript title="src/routes/api/users.ts"
-import prisma from "../../../lib/prisma";
-
-export async function GET() {
- const users = await prisma.user.findMany({
- include: {
- posts: true,
- },
- });
- return new Response(JSON.stringify(users), {
- headers: { "Content-Type": "application/json" },
- });
-}
-```
-
-### 3.3. Fetch Data in Your Component
-
-In your `app.tsx` file, use `createResource` to fetch data from your new API route:
-
-```typescript title="src/app.tsx"
-import "./app.css";
-import { createResource } from "solid-js"; // [!code ++]
-import { User, Post } from "./generated/prisma/client"; // [!code ++]
-
-type UserWithPosts = User & { // [!code ++]
- posts: Post[]; // [!code ++]
-}; // [!code ++]
-
-const fetchUsers = async () => { // [!code ++]
- const res = await fetch("http://localhost:3000/api/users"); // [!code ++]
- return res.json(); // [!code ++]
-}; // [!code ++]
-
-export default function App() {
- const [users, { mutate, refetch }] = createResource(fetchUsers); {/* [!code ++] */}
-
- return (
-
-
SolidStart + Prisma
-
- );
-}
-```
-
-:::info
-`createResource` is a SolidJS hook for managing async data. It tracks loading and error states automatically. [Learn more](https://docs.solidjs.com/reference/basic-reactivity/create-resource#createresource).
-:::
-
-### 3.4. Display the Data
-
-To show the users and their posts, use SolidJS's `` component:
-
-```typescript title="src/app.tsx"
-import "./app.css";
-import { createResource, For } from "solid-js"; // [!code highlight]
-import { User, Post } from "./generated/prisma/client";
-
-type UserWithPosts = User & {
- posts: Post[];
-};
-
-const fetchUsers = async () => {
- const res = await fetch("http://localhost:3000/api/users");
- return res.json();
-};
-
-export default function App() {
- const [users, { mutate, refetch }] =
- createResource(fetchUsers);
-
- return (
-
-
SolidJS + Prisma
- // [!code ++]
- {(user) => ( // [!code ++]
-
// [!code ++]
-
{user.name}
// [!code ++]
- {(post) =>
{post.title}
} // [!code ++]
-
// [!code ++]
- )} // [!code ++]
- // [!code ++]
-
- );
-}
-```
-
-:::info
-`` loops through an array reactively. Think of it like `.map()` in React. [Learn more](https://docs.solidjs.com/reference/components/for)
-:::
-
-### 3.5. Add Loading and Error States
-
-Use SolidJS's `` component to handle loading and error conditions:
-
-```typescript title="src/app.tsx"
-import "./app.css";
-import { createResource, For, Show } from "solid-js"; // [!code highlight]
-import { User, Post } from "./generated/prisma/client";
-
-type UserWithPosts = User & {
- posts: Post[];
-};
-
-const fetchUsers = async () => {
- const res = await fetch("http://localhost:3000/api/users");
- return res.json();
-};
-
-export default function App() {
- const [users, { mutate, refetch }] =
- createResource(fetchUsers);
-
- return (
-
-
- )}
-
- // [!code ++]
- // [!code ++]
-
- );
-}
-```
-
-:::info
-`` conditionally renders content. It's similar to an `if` statement. [Learn more](https://docs.solidjs.com/reference/components/show)
-:::
-
-You're done! You've just created a SolidStart app connected to a Prisma Postgres database.
-
-## Next Steps
-
-Now that you have a working SolidStart app connected to a Prisma Postgres database, you can:
-
-- Extend your Prisma schema with more models and relationships
-- Add create/update/delete routes and forms
-- Explore authentication, validation, and optimistic updates
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-
-## More Info
-
-- [Prisma ORM Docs](/v6/orm/overview/introduction/what-is-prisma)
-- [SolidStart Documentation](https://start.solidjs.com/)
diff --git a/apps/docs/content/docs.v6/guides/supabase-accelerate.mdx b/apps/docs/content/docs.v6/guides/supabase-accelerate.mdx
deleted file mode 100644
index 91ca0a1731..0000000000
--- a/apps/docs/content/docs.v6/guides/supabase-accelerate.mdx
+++ /dev/null
@@ -1,179 +0,0 @@
----
-title: Supabase with Accelerate
-description: Learn how to set up PostgreSQL on Supabase with Prisma Accelerate's Connection Pool
-image: /img/guides/supabase-connection-pooling.png
-url: /v6/guides/supabase-accelerate
-metaTitle: Set up PostgreSQL on Supabase with Prisma Accelerate's Connection Pool
-metaDescription: Learn how to set up PostgreSQL on Supabase with Prisma Accelerate's Connection Pool
----
-
-## Introduction
-
-This guides teaches you how to add connection pooling to a PostgreSQL database hosted on [Supabase](https://supabase.com/) using [Prisma Accelerate](/v6/accelerate).
-
-Prisma Accelerate is a robust and mature connection pooler enabling your database to function properly during traffic spikes and high load scenarios. Check out this [video](https://www.youtube.com/watch?v=cnL75if6Aq0) demonstrating how it performs in a load test or [learn why connection pooling is important](https://www.prisma.io/blog/saving-black-friday-with-connection-pooling).
-
-## Prerequisites
-
-To successfully complete this guide, you need **a connection string for a PostgreSQL instance hosted on Supabase**. It typically looks similar to this:
-
-```bash no-copy
-postgresql://postgres:[YOUR-PASSWORD]@db.nzpppscrldfwlzfalbrf.supabase.co:5432/postgres
-```
-
-If you already have a project using Prisma ORM, you can skip the first two steps and jump ahead to [Step 3. Install the Accelerate extension](#3-install-the-accelerate-extension).
-
-## 1. Set up Prisma ORM
-
-Start by installing the Prisma CLI in your project:
-
-```npm
-npm install prisma --save-dev
-```
-
-Then, run the following command to initialize a new project:
-
-```npm
-npx prisma init
-```
-
-This will create a new `prisma` directory with a `schema.prisma` file and add a `.env` file with the `DATABASE_URL` environment variable.
-
-Update the file and set the `DATABASE_URL` to your Supabase connection string:
-
-```bash title=".env"
-DATABASE_URL="postgresql://postgres:[YOUR-PASSWORD]@db.nzpppscrldfwlzfalbrf.supabase.co:5432/postgres"
-```
-
-Create a `prisma.config.ts` file to configure Prisma:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::note
-
-You'll need to install the `dotenv` package to load environment variables:
-
-```npm
-npm install dotenv
-```
-
-:::
-
-## 2. Introspect your database
-
-Next, run the following command to introspect your database and create your data model:
-
-```npm
-npx prisma db pull
-```
-
-This command reads your database schema and creates new models in your `schema.prisma` file that match the tables in your database.
-
-:::note
-
-If you want to use Prisma Migrate in the future, you also need to [baseline your database](/v6/orm/prisma-migrate/workflows/baselining).
-
-:::
-
-## 3. Install the Accelerate extension
-
-Install the Prisma Client extension for Accelerate:
-
-```npm
-npm install @prisma/extension-accelerate
-```
-
-This is needed to access Prisma Accelerate's connection pool.
-
-## 4. Set up Accelerate in the Prisma Console
-
-To set up Accelerate in the Prisma Console, follow these steps:
-
-1. Log into the [Prisma Console](https://console.prisma.io).
-1. Select **New project**
-1. Choose a **Name** for your project
-1. In the **Choose your starting product** section, find the **Accelerate** card and click **Get started**
-1. In the field for your **Database connection string**, paste your Supabase connection string
-1. Select the **Region** that's closest to your database
-1. Click **Create project**
-1. On the next screen, click **Enable Accelerate**
-
-Once you went through these steps, you'll be redirected to another page where you need to the click the **Generate API key** button.
-
-You'll then be shown a new connection URL which enables you to connect to Prisma Accelerate's connection pool. This needs to be set as the new `DATABASE_URL` in your `.env` file:
-
-```bash title=".env"
-DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=ey..."
-```
-
-:::note
-
-If you want to use Prisma Migrate with Prisma Accelerate, you need to provide a direct database URL in your `prisma.config.ts` file. The Accelerate URL (starting with `prisma://`) is used for queries via PrismaClient, while the direct database URL is used for migrations.
-
-Update your `prisma.config.ts`:
-
-```typescript title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DIRECT_URL"), // Direct database URL for migrations
- },
-});
-```
-
-And add the `DIRECT_URL` to your `.env` file:
-
-```bash title=".env"
-DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=ey..."
-DIRECT_URL="postgresql://postgres:[YOUR-PASSWORD]@db.nzpppscrldfwlzfalbrf.supabase.co:5432/postgres"
-```
-
-:::
-
-## 5. Generate Prisma Client
-
-With your Prisma schema in place, you can go ahead and generate Prisma Client:
-
-```npm
-npx prisma generate
-```
-
-:::info
-
-In Prisma 7, the `--no-engine` flag is no longer required when using Prisma Accelerate. Previously, you would run `prisma generate --no-engine`, but now the standard `prisma generate` command works for all use cases.
-
-:::
-
-## 6. Send queries through the connection pool
-
-In your application code, you now need to apply the Accelerate extension to your Prisma Client instance:
-
-```ts
-import { PrismaClient } from "./generated/prisma/client";
-import { withAccelerate } from "@prisma/extension-accelerate";
-
-const prisma = new PrismaClient({
- accelerateUrl: process.env.DATABASE_URL,
-}).$extends(withAccelerate());
-```
-
-At this point, you can now start sending queries which will be routed through the connection pool to your database.
diff --git a/apps/docs/content/docs.v6/guides/sveltekit.mdx b/apps/docs/content/docs.v6/guides/sveltekit.mdx
deleted file mode 100644
index 4688bc2c86..0000000000
--- a/apps/docs/content/docs.v6/guides/sveltekit.mdx
+++ /dev/null
@@ -1,383 +0,0 @@
----
-title: SvelteKit
-description: Learn how to use Prisma ORM in a SvelteKit app
-image: /img/guides/prisma-sveltekit-cover.png
-url: /v6/guides/sveltekit
-metaTitle: How to use Prisma ORM and Prisma Postgres with SvelteKit
-metaDescription: Learn how to use Prisma ORM in a SvelteKit app
----
-
-## Introduction
-
-Prisma ORM simplifies database access with type-safe queries, and when paired with [SvelteKit](https://svelte.dev/docs/kit), it creates a robust and scalable full-stack architecture.
-
-In this guide, you'll learn to integrate Prisma ORM with a Prisma Postgres database in a SvelteKit project from scratch. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/sveltekit).
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-- [Svelte VSCode extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) (Recommended by Svelte)
-
-## 1. Set up your project
-
-You'll be using [Svelte CLI](https://github.com/sveltejs/cli) instead of `npx create svelte@latest`. This CLI provides a more interactive setup and built-in support for popular tooling like ESLint and Prettier
-
-Create a new Svelte project:
-
-```npm
-npx sv create sveltekit-prisma
-```
-
-It will prompt you to customize your setup. Here are the options you'll choose:
-
-:::info
-
-- _Which template would you like?_ `SvelteKit minimal`
-- _Add type checking with TypeScript?_ `Yes, using TypeScript syntax`
-- _What would you like to add to your project?_
- - `prettier`
- - `eslint`
-- _Which package manager do you want to install dependencies with?_ `npm`
-
-:::
-
-Once the setup completes, navigate into your project and start the development server:
-
-```npm
-cd sveltekit-prisma
-npm run dev
-```
-
-That's it! Svelte makes it a very simple process to get up and running. At this point, your project is ready to integrate Prisma and connect to a Prisma Postgres database.
-
-## 2. Install and Configure Prisma
-
-### 2.1. Install dependencies
-
-To get started with Prisma, you'll need to install a few dependencies:
-
-```npm
-npm install prisma tsx @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Once installed, initialize Prisma in your project:
-
-```npm
-npx prisma init --db --output src/generated/prisma
-```
-
-:::info
-You'll need to answer a few questions while setting up your Prisma Postgres database. Select the region closest to your location and a memorable name for your database like "My SvelteKit Project"
-:::
-
-This will create:
-
-- A `prisma` directory with a `schema.prisma` file.
-- A `prisma.config.ts` file for configuring Prisma
-- A Prisma Postgres database.
-- A `.env` file containing the `DATABASE_URL` at the project root.
-- An `output` directory for the generated Prisma Client as `src/generated/prisma`.
-
-### 2.2. Define your Prisma Schema
-
-In the `prisma/schema.prisma` file, add the following models and change the generator to use the `prisma-client` provider:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
-
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-```
-
-This creates two models: `User` and `Post`, with a one-to-many relationship between them.
-
-### 2.3 Add `dotenv` to `prisma.config.ts`
-
-To get access to the variables in the `.env` file, they can either be loaded by your runtime, or by using `dotenv`.
-Include an import for `dotenv` at the top of the `prisma.config.ts`
-
-```ts
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-### 2.4. Configure the Prisma Client generator
-
-Now, run the following command to create the database tables and generate the Prisma Client:
-
-```npm
-npx prisma migrate dev --name init
-```
-
-```npm
-npx prisma generate
-```
-
-### 2.5. Seed the database
-
-Add some seed data to populate the database with sample users and posts.
-
-Create a new file called `seed.ts` in the `prisma/` directory:
-
-```typescript title="prisma/seed.ts"
-import { PrismaClient, Prisma } from "../src/generated/prisma/client.js";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-const userData: Prisma.UserCreateInput[] = [
- {
- name: "Alice",
- email: "alice@prisma.io",
- posts: {
- create: [
- {
- title: "Join the Prisma Discord",
- content: "https://pris.ly/discord",
- published: true,
- },
- {
- title: "Prisma on YouTube",
- content: "https://pris.ly/youtube",
- },
- ],
- },
- },
- {
- name: "Bob",
- email: "bob@prisma.io",
- posts: {
- create: [
- {
- title: "Follow Prisma on Twitter",
- content: "https://www.twitter.com/prisma",
- published: true,
- },
- ],
- },
- },
-];
-
-export async function main() {
- for (const u of userData) {
- await prisma.user.create({ data: u });
- }
-}
-
-main();
-```
-
-Now, tell Prisma how to run this script by updating your `prisma.config.ts`:
-
-```ts title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- seed: `tsx prisma/seed.ts`, // [!code ++]
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-Run the seed script:
-
-```npm
-npx prisma db seed
-```
-
-And open Prisma Studio to inspect your data:
-
-```npm
-npx prisma studio
-```
-
-## 3. Integrate Prisma into SvelteKit
-
-### 3.1. Create a Prisma Client
-
-Inside your `/src/lib` directory, rename `index.ts` to `prisma.ts`. This file will be used to create and export your Prisma Client instance.
-
-:::tip
-Files in `src/lib` can be accessed from anywhere using the `$lib` alias.
-:::
-
-The `DATABASE_URL` is stored in the `.env` file. To access it, you'll need to import it from the [`$env/static/private`](https://svelte.dev/docs/kit/$env-static-private) namespace.
-
-Set up the Prisma client like this:
-
-```tsx title="src/lib/prisma.ts"
-import { PrismaClient } from "../generated/prisma/client.js";
-import { DATABASE_URL } from "$env/static/private";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: DATABASE_URL,
-});
-
-const prisma = new PrismaClient({
- adapter,
-});
-
-export default prisma;
-```
-
-:::warning
-We recommend using a connection pooler (like [Prisma Accelerate](https://www.prisma.io/accelerate)) to manage database connections efficiently.
-
-If you choose not to use one, **avoid** instantiating `PrismaClient` globally in long-lived environments. Instead, create and dispose of the client per request to prevent exhausting your database connections.
-:::
-
-### 3.2. Create a server route
-
-To fetch data from the database on the server side, create a `+page.server.ts` file in your `routes` directory. This file should export a `load` function, which runs on the server before your page renders.
-
-Use the `findMany()` method within a basic `load` function to get a list of users.
-
-Update your `+page.server.ts` file like this:
-
-```typescript title="src/routes/+page.server.ts"
-import prisma from "$lib/prisma";
-
-export async function load() {
- const users = await prisma.user.findMany({});
- return {
- users,
- };
-}
-```
-
-At this point, you're only getting data directly on the `User` model — no relations like posts are included yet.
-
-To also fetch each user's posts, we can expand the query using the `include` option. This tells Prisma to join the related `Posts` table in the result.
-
-Update your `findMany()` call like this:
-
-```typescript title="src/routes/+page.server.ts"
-import prisma from "$lib/prisma";
-
-export async function load() {
- const users = await prisma.user.findMany({
- include: {
- // [!code ++]
- posts: true, // [!code ++]
- }, // [!code ++]
- });
-
- return {
- users,
- };
-}
-```
-
-Now, every user in the result will also include a `posts` array.
-
-### 3.3. Populate the page
-
-In `src/routes/+page.svelte`, strip the file down to the basics and add a `
-
-
SvelteKit + Prisma
-```
-
-We need to grab the data exported from `+page.server.ts`:
-
-```html title="src/routes/+page.svelte"
-
-
-
SvelteKit + Prisma
-```
-
-Now that we have the data, let's map through the users and their posts with Svelte's [`each`](https://svelte.dev/docs/svelte/each) block:
-
-```html title="src/routes/+page.svelte"
-
-
-
-
-{/each} {/each}
-
-```
-
-You're done! You've just created a SvelteKit app with Prisma ORM. Below are some next steps to explore, as well as some more resources to help you get started expanding your project.
-
-## Next Steps
-
-Now that you have a working SvelteKit app connected to a Prisma Postgres database, you can:
-
-- Extend your Prisma schema with more models and relationships
-- Add create/update/delete routes and forms
-- Explore authentication and validation
-- Enable query caching with [Prisma Postgres](/v6/postgres/database/caching) for better performance
-
-### More Info
-
-- [Prisma Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [SvelteKit Documentation](https://svelte.dev/docs/kit)
diff --git a/apps/docs/content/docs.v6/guides/tanstack-start.mdx b/apps/docs/content/docs.v6/guides/tanstack-start.mdx
deleted file mode 100644
index 525e33af76..0000000000
--- a/apps/docs/content/docs.v6/guides/tanstack-start.mdx
+++ /dev/null
@@ -1,268 +0,0 @@
----
-title: TanStack Start
-description: Learn how to use Prisma ORM in a TanStack Start app
-image: /img/guides/prisma-tanstack-start-cover.png
-url: /v6/guides/tanstack-start
-metaTitle: How to use Prisma ORM and Prisma Postgres with TanStack Start
-metaDescription: Learn how to use Prisma ORM in a TanStack Start app
----
-
-## Introduction
-
-Prisma ORM simplifies database interactions, and [TanStack Start](https://tanstack.com/start/latest/docs/framework/react/guide/server-functions) offers a robust framework for building modern React applications. Together with [Prisma Postgres](https://www.prisma.io/postgres), they provide a seamless full-stack development experience with type-safe queries and efficient data management.
-
-This guide will walk you through integrating Prisma ORM with a Prisma Postgres database in a TanStack Start project from scratch.
-
-## Prerequisites
-
-- [Node.js 20+](https://nodejs.org)
-
-## 1. Set up your project
-
-To begin, create a new TanStack Start project.
-
-```npm
-npm create @tanstack/start@latest
-```
-
-:::info
-
-- _What would you like to name your project?_ tanstack-start-prisma
-- _Would you like to use Tailwind CSS?_ No
-- _Select Toolchain_ None
-- _Select deployment adapter_ Nitro
-- _What add-ons would you like for your project?_ Prisma
-- _Would you like any examples?_ No
-- _Prisma: Database Provider_ Prisma PostgresSQL
- :::
-
-This will create a new folder called `tanstack-start-prisma` and create a new Prisma Postgres
-Database for you. The final database connection string will be printed out.
-
-```shell
-● Database Connection
-│
-│ Connection String:
-│
-│ postgresql://b4889.....
-│
-```
-
-Copy this connection string and set the `DATABASE_URL` variable in `.env.local`:
-
-```
-# Database URL for PostgreSQL
-DATABASE_URL="postgresql://b4889....."
-```
-
-## 2. Configure Prisma
-
-### 2.1. Define your Prisma Schema
-
-In `schema.prisma`, the model for our todos is defined below the generator and datasource blocks:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../app/generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model Todo {
- id Int @id @default(autoincrement())
- title String
- createdAt DateTime @default(now())
-}
-```
-
-This creates a `Todo` model that will be pushed to the database
-
-### 2.2. Configure the Prisma Client generator
-
-Now, run the following command to create the database tables:
-
-```npm
-npm run db:seed -- --name init
-```
-
-### 2.3. Seed the database
-
-Generate the Prisma Client needed for the project;
-
-```npm
-npm run db:generate
-```
-
-Then seed the project with the `seed.ts` file in the `prisma/` directory:
-
-```npm
-npm run db:seed
-```
-
-And open Prisma Studio to inspect your data:
-
-```npm
-npm run db:studio
-```
-
-## 3. Integrate Prisma into TanStack Start
-
-### 3.1 The Prisma Client
-
-Instead of creating a new Prisma Client instance in each file, TanStack Start has a `db.ts` that
-creates a single instance that can be shared globally
-
-```tsx title="src/db.ts"
-import { PrismaClient } from "./generated/prisma/client.js";
-
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL!,
-});
-
-declare global {
- var __prisma: PrismaClient | undefined;
-}
-
-export const prisma = globalThis.__prisma || new PrismaClient({ adapter });
-
-if (process.env.NODE_ENV !== "production") {
- globalThis.__prisma = prisma;
-}
-```
-
-### 3.2 Fetch data on load
-
-First, import the necessary modules. Then, create a server function using the [`createServerFn`](https://tanstack.com/start/latest/docs/framework/react/guide/server-functions) function. This function will fetch the data from the database using the `.findMany()` method
-
-```typescript title="src/routes/index.tsx"
-import { createFileRoute } from "@tanstack/react-router";
-import { createServerFn } from "@tanstack/react-start"; // [!code ++]
-import { prisma } from '../db'; // [!code ++]
-
-export const Route = createFileRoute("/")({
- component: Home,
-});
-
-const getTodos = createServerFn({ method: "GET" }).handler(async () => { // [!code ++]
- return prisma.todo.findMany(); // [!code ++]
-}); // [!code ++]
-
-function Home() {
- return (
-
-
- );
-}
-```
-
-TanStack Start allows functions to run on load with loader functions in the [`createFileRoute`](https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction) function. Fetch the users and their posts on load with this code:
-
-```typescript title="app/routes/index.tsx"
-import { createFileRoute } from '@tanstack/react-router';
-import { createServerFn } from '@tanstack/react-start';
-import { prisma } from '../db';
-
-export const Route = createFileRoute("/")({
- component: Home,
- loader: () => { // [!code ++]
- return getTodos(); // [!code ++]
- }, // [!code ++]
-});
-
-const getTodos = createServerFn({ method: "GET" }).handler(async () => {
- return prisma.todo.findMany();
-});
-
-function Home() {
- return (
-
-
Todos
-
- );
-}
-```
-
-Store the response from the loader in the main component using [`Route.useLoaderData()`](https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook):
-
-```typescript title="app/routes/index.tsx"
-import { createServerFn } from "@tanstack/react-start";
-import { createFileRoute } from "@tanstack/react-router";
-import { prisma } from '../db';
-
-export const Route = createFileRoute("/")({
- component: Home,
- loader: () => {
- return getTodos();
- },
-});
-
-const getTodos = createServerFn({ method: "GET" }).handler(async () => {
- return prisma.todo.findMany();
-});
-
-function Home() {
- const todos = Route.useLoaderData(); // [!code ++]
-
- return (
-
-
Todos
-
- );
-}
-```
-
-### 3.3 Display the todos
-
-Next, you'll update the home page to display the data retrieved from your database.
-
-Map over the `todos` and display them in a list:
-
-```typescript title="app/routes/index.tsx"
-import { createFileRoute } from '@tanstack/react-router';
-import { createServerFn } from '@tanstack/react-start';
-import { prisma } from '../db';
-
-export const Route = createFileRoute('/')({
- component: App,
- loader: () => getTodos(),
-});
-
-const getTodos = createServerFn({ method: 'GET' }).handler(async () => {
- return prisma.todo.findMany();
-});
-
-function App() {
- const todos = Route.useLoaderData();
-
- return (
-
-
- {todos.map(todo => (
-
{todo.title}
- ))}
-
-
- );
-}
-```
-
-This setup will display the todos on your page, fetched directly from your database.
-
-## Next steps
-
-You've successfully integrated Prisma ORM with TanStack Start, creating a seamless full-stack application. Here are a few suggestions for what you can do next:
-
-- Expand your Prisma models to handle more complex data relationships.
-- Implement additional CRUD operations to enhance your application's functionality.
-- Explore more features of Prisma and TanStack Start to deepen your understanding.
-- Check out [Prisma Postgres](https://www.prisma.io/postgres) to see how you can scale your application.
-
-## More info
-
-- [Prisma ORM Documentation](/v6/orm/overview/introduction/what-is-prisma)
-- [TanStack Start Documentation](https://tanstack.com/start/latest/docs/framework/react/overview)
diff --git a/apps/docs/content/docs.v6/guides/turborepo.mdx b/apps/docs/content/docs.v6/guides/turborepo.mdx
deleted file mode 100644
index 6842fb5251..0000000000
--- a/apps/docs/content/docs.v6/guides/turborepo.mdx
+++ /dev/null
@@ -1,535 +0,0 @@
----
-title: Turborepo
-description: 'Learn step-by-step how to integrate Prisma ORM with Turborepo to build modular, scalable monorepo architectures efficiently.'
-image: /img/guides/prisma-turborepo-setup.png
-url: /v6/guides/turborepo
-metaTitle: How to use Prisma ORM and Prisma Postgres with Turborepo
-metaDescription: 'Learn step-by-step how to integrate Prisma ORM with Turborepo to build modular, scalable monorepo architectures efficiently.'
----
-
-Prisma is a powerful ORM for managing databases, and [Turborepo](https://turbo.build/) simplifies monorepo workflows. By combining these tools, you can create a scalable, modular architecture for your projects.
-
-This guide will show you how to set up Prisma as a standalone package in a Turborepo monorepo, enabling efficient configuration, type sharing, and database management across multiple apps.
-
-#### What you'll learn:
-
-- How to set up Prisma in a Turborepo monorepo.
-- Steps to generate and reuse PrismaClient across packages.
-- Integrating the Prisma package into other applications in the monorepo.
-
-### Prerequisites
-
-- [Node.js 20+](https://nodejs.org/)
-
-## 1. Set up your project
-
-To set up a Turborepo monorepo named `turborepo-prisma`, run the following command:
-
-```npm
-npx create-turbo@latest turborepo-prisma
-```
-
-You'll be prompted to select your package manager, this guide will use `npm`:
-
-:::info
-
-- _Which package manager do you want to use?_ `npm`
-
-:::
-
-After the setup, choose a package manager for the project. Navigate to the project root directory and install Turborepo as a development dependency:
-
-```npm
-cd turborepo-prisma
-npm install turbo --save-dev
-```
-
-
-For more information about installing Turborepo, refer to the [official Turborepo guide](https://turbo.build/repo/docs/getting-started/installation).
-
-## 2. Add a new `database` package to the monorepo
-
-### 2.1 Create the package and install Prisma
-
-Create a `database` package within the `packages` directory. Then, create a `package.json` file for the package by running:
-
-```bash
-cd packages/
-mkdir database
-cd database
-touch package.json
-```
-
-Define the `package.json` file as follows:
-
-```json title="packages/database/package.json"
-{
- "name": "@repo/db",
- "version": "0.0.0"
-}
-```
-
-Next, install the required dependencies to use Prisma ORM. Use your preferred package manager:
-
-```npm tab="npm"
-npm install prisma @types/pg --save-dev
-```
-
-```npm
-npm install @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-```bash tab="yarn"
-yarn add prisma @types/pg --dev
-yarn add @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-```bash tab="pnpm"
-pnpm add prisma @types/pg --save-dev
-pnpm add @prisma/client @prisma/adapter-pg dotenv pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-### 2.2. Initialize Prisma and define models
-
-Inside the `database` directory, initialize prisma by running:
-
-```npm tab="npm"
-npx prisma init --db --output ../generated/prisma
-```
-
-```bash tab="yarn"
-yarn prisma init --db --output ../generated/prisma
-```
-
-```bash tab="pnpm"
-pnpm prisma init --db --output ../generated/prisma
-```
-
-This will create several files inside `packages/database`:
-
-- A `prisma` directory with a `schema.prisma` file.
-- A `prisma.config.ts` file for configuring Prisma
-- A Prisma Postgres database.
-- A `.env` file containing the `DATABASE_URL` at the project root.
-- An `output` directory for the generated Prisma Client as `generated/prisma`.
-
-In the `packages/database/prisma/schema.prisma` file, add the following models:
-
-```prisma title="packages/database/prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/prisma"
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
- posts Post[] // [!code ++]
-} // [!code ++]
- // [!code ++]
-model Post { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- title String // [!code ++]
- content String? // [!code ++]
- published Boolean @default(false) // [!code ++]
- authorId Int // [!code ++]
- author User @relation(fields: [authorId], references: [id]) // [!code ++]
-} // [!code ++]
-```
-
-The `prisma.config.ts` file created in the `packages/database` directory should look like this:
-
-```typescript title="packages/database/prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- schema: "prisma/schema.prisma",
- migrations: {
- path: "prisma/migrations",
- },
- datasource: {
- url: env("DATABASE_URL"),
- },
-});
-```
-
-:::warning
-
-It is recommended to add `../generated/prisma` to the `.gitignore` file because it contains platform-specific binaries that can cause compatibility issues across different environments.
-
-:::
-
-#### The importance of generating Prisma types in a custom directory
-
-In the `schema.prisma` file, we specify a custom [`output`](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path) path where Prisma will generate its types. This ensures Prisma's types are resolved correctly across different package managers.
-
-:::info
-
-In this guide, the types will be generated in the `database/generated/prisma` directory.
-
-:::
-
-### 2.3. Add scripts and run migrations
-
-Let's add some scripts to the `package.json` inside `packages/database`:
-
-```json title="packages/database/package.json"
-{
- "name": "@repo/db",
- "version": "0.0.0",
- "scripts": {
- // [!code ++]
- "db:generate": "prisma generate", // [!code ++]
- "db:migrate": "prisma migrate dev --skip-generate", // [!code ++]
- "db:deploy": "prisma migrate deploy" // [!code ++]
- }, // [!code ++]
- "devDependencies": {
- "prisma": "^6.6.0"
- },
- "dependencies": {
- "@prisma/client": "^6.6.0"
- }
-}
-```
-
-Let's also add these scripts to `turbo.json` in the root and ensure that `DATABASE_URL` is added to the environment:
-
-```json title="turbo.json"
-{
-"$schema": "https://turbo.build/schema.json",
-"ui": "tui",
-"tasks": {
- "build": {
- "dependsOn": ["^build"],
- "inputs": ["$TURBO_DEFAULT$", ".env*"],
- "outputs": [".next/**", "!.next/cache/**"],
- "env": ["DATABASE_URL"] // [!code ++]
- },
- "lint": {
- "dependsOn": ["^lint"]
- },
- "check-types": {
- "dependsOn": ["^check-types"]
- },
- "dev": {
- "cache": false,
- "persistent": true
- },
- "db:generate": { // [!code ++]
- "cache": false // [!code ++]
- }, // [!code ++]
- "db:migrate": { // [!code ++]
- "cache": false, // [!code ++]
- "persistent": true // This is necessary to interact with the CLI and assign names to your database migrations. // [!code ++]
- }, // [!code ++]
- "db:deploy": { // [!code ++]
- "cache": false // [!code ++]
- } // [!code ++]
-}
-```
-
-Migrate your `prisma.schema` and generate types
-
-Navigate to the project root and run the following command to automatically migrate our database:
-
-```npm tab="npm"
-npx turbo db:migrate
-```
-
-```bash tab="yarn"
-yarn turbo db:migrate
-```
-
-```bash tab="pnpm"
-pnpm turbo db:migrate
-```
-
-Generate your `schema.prisma`
-
-To generate the types from Prisma schema, from the project root run:
-
-```npm tab="npm"
-npx turbo db:generate
-```
-
-```bash tab="yarn"
-yarn turbo db:generate
-```
-
-```bash tab="pnpm"
-pnpm turbo db:generate
-```
-
-### 2.4. Export the Prisma client and types
-
-Next, export the generated types and an instance of `PrismaClient` so it can used in your applications.
-
-In the `packages/database` directory, create a `src` folder and add a `client.ts` file. This file will define an instance of `PrismaClient`:
-
-```ts title="packages/database/src/client.ts"
-import { PrismaClient } from "../generated/prisma/client";
-import { PrismaPg } from "@prisma/adapter-pg";
-
-const adapter = new PrismaPg({
- connectionString: process.env.DATABASE_URL,
-});
-
-const globalForPrisma = global as unknown as { prisma: PrismaClient };
-
-export const prisma =
- globalForPrisma.prisma ||
- new PrismaClient({
- adapter,
- });
-
-if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
-```
-
-Then create an `index.ts` file in the `src` folder to re-export the generated prisma types and the `PrismaClient` instance:
-
-```ts title="packages/database/src/index.ts"
-export { prisma } from "./client"; // exports instance of prisma
-export * from "../generated/prisma/client"; // exports generated types from prisma
-```
-
-Follow the [Just-in-Time packaging pattern](https://turbo.build/repo/docs/core-concepts/internal-packages#just-in-time-packages) and create an entrypoint to the package inside `packages/database/package.json`:
-
-:::warning
-
-If you're not using a bundler, use the [Compiled Packages](https://turborepo.com/docs/core-concepts/internal-packages#compiled-packages) strategy instead.
-
-:::
-
-```json title="packages/database/package.json"
-{
- "name": "@repo/db",
- "version": "0.0.0",
- "scripts": {
- "db:generate": "npx prisma generate",
- "db:migrate": "npx prisma migrate dev --skip-generate",
- "db:deploy": "npx prisma migrate deploy"
- },
- "devDependencies": {
- "prisma": "^6.6.0"
- },
- "dependencies": {
- "@prisma/client": "^6.6.0"
- },
- "exports": {
- // [!code ++]
- ".": "./src/index.ts" // [!code ++]
- } // [!code ++]
-}
-```
-
-By completing these steps, you'll make the Prisma types and `PrismaClient` instance accessible throughout the monorepo.
-
-## 3. Import the `database` package in the web app
-
-The `turborepo-prisma` project should have an app called `web` at `apps/web`. Add the `database` dependency to `apps/web/package.json`:
-
-```json tab="npm"
-{
- // ...
- "dependencies": {
- "@repo/db": "*" // [!code ++]
- // ...
- }
- // ...
-}
-```
-
-```json tab="yarn"
-{
- // ...
- "dependencies": {
- "@repo/db": "*" // [!code ++]
- // ...
- }
- // ...
-}
-```
-
-```json tab="pnpm"
-{
- // ...
- "dependencies": {
- "@repo/db": "workspace:*" // [!code ++]
- // ...
- }
- // ...
-}
-```
-
-Run your package manager's install command inside the `apps/web` directory:
-
-```npm tab="npm"
-cd apps/web
-npm install
-```
-
-```bash tab="yarn"
-cd apps/web
-yarn install
-```
-
-```bash tab="pnpm"
-cd apps/web
-pnpm install
-```
-
-Let's import the instantiated `prisma` client from the `database` package in the `web` app.
-
-In the `apps/web/app` directory, open the `page.tsx` file and add the following code:
-
-```tsx title="apps/web/app/page.tsx"
-import styles from "./page.module.css";
-import { prisma } from "@repo/db";
-
-export default async function Home() {
- const user = await prisma.user.findFirst();
- return
{user?.name ?? "No user added yet"}
;
-}
-```
-
-Then, create a `.env` file in the `web` directory and copy into it the contents of the `.env` file from the `/database` directory containing the `DATABASE_URL`:
-
-```bash title="apps/web/.env"
-DATABASE_URL="Same database url as used in the database directory" # [!code ++]
-```
-
-:::note
-
-If you want to use a single `.env` file in the root directory across your apps and packages in a Turborepo setup, consider using a package like [`dotenvx`](https://dotenvx.com/docs/monorepos/turborepo).
-
-To implement this, update the `package.json` files for each package or app to ensure they load the required environment variables from the shared `.env` file. For detailed instructions, refer to the [`dotenvx` guide for Turborepo](https://dotenvx.com/docs/monorepos/turborepo).
-
-Keep in mind that Turborepo [recommends using separate `.env` files for each package](https://turbo.build/repo/docs/crafting-your-repository/using-environment-variables#use-env-files-in-packages) to promote modularity and avoid potential conflicts.
-
-:::
-
-## 4. Configure task dependencies in Turborepo
-
-The `db:generate` and `db:deploy` scripts are not yet optimized for the monorepo setup but are essential for the `dev` and `build` tasks.
-
-If a new developer runs `turbo dev` on an application without first running `db:generate`, they will encounter errors.
-
-To prevent this, ensure that `db:generate` is always executed before running `dev` or `build`. Additionally, make sure both `db:deploy` and `db:generate` are executed before `db:build`. Here's how to configure this in your `turbo.json` file:
-
-```json title="turbo.json"
-{
- "$schema": "https://turbo.build/schema.json",
- "ui": "tui",
- "tasks": {
- "build": {
- "dependsOn": ["^build", "^db:generate"], // [!code highlight]
- "inputs": ["$TURBO_DEFAULT$", ".env*"],
- "outputs": [".next/**", "!.next/cache/**"],
- "env": ["DATABASE_URL"] // [!code ++]
- },
- "lint": {
- "dependsOn": ["^lint"]
- },
- "check-types": {
- "dependsOn": ["^check-types"]
- },
- "dev": {
- "dependsOn": ["^db:generate"], // [!code ++]
- "cache": false,
- "persistent": true
- },
- "db:generate": {
- "cache": false
- },
- "db:migrate": {
- "cache": false,
- "persistent": true
- },
- "db:deploy": {
- "cache": false
- }
- }
-}
-```
-
-## 5. Run the project in development
-
-:::warning
-
-Before starting the development server, note that if you are using Next.js v15.2.0, do not use Turbopack as there is a known [issue](https://github.com/vercel/next.js/issues/76497). Remove Turbopack from your dev script by updating your `apps/web/package.json`
-
-```json title="apps/web/package.json"
-"script":{
- "dev": "next dev --port 3000", // [!code highlight]
-}
-```
-
-:::
-
-Then from the project root run the project:
-
-```npm tab="npm"
-npx turbo run dev --filter=web
-```
-
-```bash tab="yarn"
-yarn turbo run dev --filter=web
-```
-
-```bash tab="pnpm"
-pnpm turbo run dev --filter=web
-```
-
-Navigate to the `http://localhost:3000` and you should see the message:
-
-```
-No user added yet
-```
-
-:::note
-
-You can add users to your database by creating a seed script or manually by using [Prisma Studio](/v6/orm/tools/prisma-studio).
-
-To use Prisma Studio to add manually data via a GUI, navigate inside the `packages/database` directory and run `prisma studio` using your package manager:
-
-```npm tab="npm"
-npx prisma studio
-```
-
-```bash tab="yarn"
-yarn prisma studio
-```
-
-```bash tab="pnpm"
-pnpm prisma studio
-```
-
-This command starts a server with a GUI at http://localhost:5555, allowing you to view and modify your data.
-
-:::
-
-Congratulations, you're done setting up Prisma for Turborepo!
-
-## Next Steps
-
-- Expand your Prisma models to handle more complex data relationships.
-- Implement additional CRUD operations to enhance your application's functionality.
-- Check out [Prisma Postgres](https://www.prisma.io/postgres) to see how you can scale your application.
-
-### More Info
-
-- [Turborepo Docs](https://turbo.build/repo/docs)
-- [Next.js Docs](https://nextjs.org/docs)
-- [Prisma ORM Docs](/v6/orm/overview/introduction/what-is-prisma)
diff --git a/apps/docs/content/docs.v6/guides/use-prisma-in-pnpm-workspaces.mdx b/apps/docs/content/docs.v6/guides/use-prisma-in-pnpm-workspaces.mdx
deleted file mode 100644
index 6d87d0df61..0000000000
--- a/apps/docs/content/docs.v6/guides/use-prisma-in-pnpm-workspaces.mdx
+++ /dev/null
@@ -1,360 +0,0 @@
----
-title: pnpm workspaces
-description: Learn step-by-step how to integrate Prisma ORM in a pnpm workspaces monorepo to build scalable and modular applications efficiently.
-image: /img/guides/prisma-orm-in-pnpm-monorepo.png
-url: /v6/guides/use-prisma-in-pnpm-workspaces
-metaTitle: How to use Prisma ORM and Prisma Postgres in a pnpm workspaces monorepo
-metaDescription: Learn step-by-step how to integrate Prisma ORM in a pnpm workspaces monorepo to build scalable and modular applications efficiently.
----
-
-Prisma is a powerful ORM for managing your database, and when combined with [pnpm Workspaces](https://pnpm.io/workspaces), you can maintain a lean and modular monorepo architecture. In this guide, we’ll walk through setting up Prisma in its own package within a pnpm Workspaces monorepo, enabling maintainable type sharing and efficient database management across your apps.
-
-### What you'll learn:
-
-- How to initialize a monorepo using pnpm Workspaces.
-- Steps to integrate Prisma as a standalone package.
-- How to generate and share the Prisma Client across packages.
-- Integrating the Prisma package into an application within your workspace.
-
-## 1. Prepare your project and configure pnpm workspaces
-
-Before integrating Prisma, you need to set up your project structure. Start by creating a new directory for your project (for example, `my-monorepo`) and initialize a Node.js project:
-
-```bash
-mkdir my-monorepo
-cd my-monorepo
-pnpm init
-```
-
-Next, create a `pnpm-workspace.yaml` file to define your workspace structure and pin the Prisma version:
-
-```bash
-touch pnpm-workspace.yaml
-```
-
-Add the following configuration to `pnpm-workspace.yaml`:
-
-```yaml title="pnpm-workspace.yaml"
-packages:
- - "apps/*"
- - "packages/*"
-catalogs:
- prisma:
- prisma: latest
-```
-
-:::note
-
-The `catalogs` help you pin a certain version of prisma across your repositories. You can learn more about them [here](https://pnpm.io/catalogs). _Explictly_ pin the lastest version of [prisma](https://www.npmjs.com/package/prisma) in the `pnpm-workspace.yaml` file. At the time of writing, this is version `6.3.1`.
-
-:::
-
-Finally, create directories for your applications and shared packages:
-
-```bash
-mkdir apps
-mkdir -p packages/database
-```
-
-## 2. Setup the shared database package
-
-This section covers creating a standalone database package that uses Prisma. The package will house all database models and the generated Prisma Client, making it reusable across your monorepo.
-
-### 2.1. Initialize the package and install dependencies
-
-Navigate to the `packages/database` directory and initialize a new package:
-
-```bash
-cd packages/database
-pnpm init
-```
-
-Add Prisma as a development dependency in your `package.json` using the pinned `catalog`:
-
-```json title="database/package.json"
-"devDependencies": { // [!code ++]
- "prisma": "catalog:prisma" // [!code ++]
-} // [!code ++]
-```
-
-Then install Prisma:
-
-```bash
-pnpm install
-```
-
-Then, add additional dependencies:
-
-```bash
-pnpm add typescript tsx @types/node @types/pg -D
-pnpm add @prisma/adapter-pg pg
-```
-
-:::info
-
-If you are using a different database provider (MySQL, SQL Server, SQLite), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/v6/orm/overview/databases/database-drivers).
-
-:::
-
-Initalize a `tsconfig.json` file for your `database` package:
-
-```bash
-pnpm tsc --init
-```
-
-### 2.2. Setup Prisma ORM in your database package
-
-Initialize Prisma ORM with an instance of [Prisma Postgres](/v6/postgres) in the `database` package by running the following command:
-
-```bash
-pnpm prisma init --db
-```
-
-Enter a name for your project and choose a database region.
-
-:::info
-
-We're going to be using [Prisma Postgres](/v6/postgres/getting-started) in this guide. If you're not using a Prisma Postgres database, you won't need to add the `--db` flag.
-
-:::
-
-This command:
-
-- Connects your CLI to your [Prisma Data Platform](https://console.prisma.io) account. If you're not logged in or don't have an account, your browser will open to guide you through creating a new account or signing into your existing one.
-- Creates a `prisma` directory containing a `schema.prisma` file for your database models.
-- Creates a `.env` file with your `DATABASE_URL` (e.g., for Prisma Postgres it should have something similar to `DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=eyJhbGciOiJIUzI..."`).
-
-Edit the `schema.prisma` file to define a `User` model in your database and specify a [custom `output` directory](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path) to generate the Prisma Client. This ensures that generated types are resolved correctly:
-
-```prisma title="prisma/schema.prisma"
-generator client {
- provider = "prisma-client"
- output = "../generated/client" // [!code ++]
-}
-
-datasource db {
- provider = "postgresql"
-}
-
-model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- email String @unique // [!code ++]
- name String? // [!code ++]
-} // [!code ++]
-```
-
-Now, create a `prisma.config.ts` file in the `database` package to configure Prisma:
-
-```typescript title="database/prisma.config.ts"
-import "dotenv/config"; // [!code ++]
-import { defineConfig, env } from "prisma/config"; // [!code ++]
-
-export default defineConfig({
- // [!code ++]
- schema: "prisma/schema.prisma", // [!code ++]
- migrations: {
- // [!code ++]
- path: "prisma/migrations", // [!code ++]
- }, // [!code ++]
- datasource: {
- // [!code ++]
- url: env("DATABASE_URL"), // [!code ++]
- }, // [!code ++]
-}); // [!code ++]
-```
-
-:::note
-
-You'll need to install the `dotenv` package to load environment variables from the `.env` file:
-
-```bash
-pnpm add dotenv
-```
-
-:::
-
-Next, add helper scripts to your `package.json` to simplify Prisma commands:
-
-```json title="database/package.json"
-{
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1", // [!code --]
- "db:generate": "prisma generate", // [!code ++]
- "db:migrate": "prisma migrate dev", // [!code ++]
- "db:deploy": "prisma migrate deploy", // [!code ++]
- "db:studio": "prisma studio" // [!code ++]
- }
-}
-```
-
-Use [Prisma Migrate](/v6/orm/prisma-migrate/getting-started) to migrate your database changes:
-
-```bash
-pnpm run db:migrate
-```
-
-When prompted by the CLI, enter a descriptive name for your migration.
-
-Once the migration is successful, create a `client.ts` file to initialize Prisma Client with a driver adapter:
-
-```ts title="database/client.ts"
-import { PrismaClient } from "./generated/client"; // [!code ++]
-import { PrismaPg } from "@prisma/adapter-pg"; // [!code ++]
-
-const adapter = new PrismaPg({
- // [!code ++]
- connectionString: process.env.DATABASE_URL, // [!code ++]
-}); // [!code ++]
-
-// Use globalThis for broader environment compatibility // [!code ++]
-const globalForPrisma = globalThis as typeof globalThis & {
- // [!code ++]
- prisma?: PrismaClient; // [!code ++]
-}; // [!code ++]
-
-// Named export with global memoization // [!code ++]
-export const prisma: PrismaClient = // [!code ++]
- globalForPrisma.prisma ?? // [!code ++]
- new PrismaClient({
- // [!code ++]
- adapter, // [!code ++]
- }); // [!code ++]
-
-if (process.env.NODE_ENV !== "production") {
- // [!code ++]
- globalForPrisma.prisma = prisma; // [!code ++]
-} // [!code ++]
-```
-
-Then, create an `index.ts` file to re-export the instance of Prisma Client and all generated types:
-
-```ts title="database/index.ts"
-export { prisma } from "./client"; // [!code ++]
-export * from "./generated/client"; // [!code ++]
-```
-
-At this point, your shared database package is fully configured and ready for use across your monorepo.
-
-## 3. Set up and integrate your frontend application
-
-Now that the database package is set up, create a frontend application (using Next.js) that uses the shared Prisma Client to interact with your database.
-
-### 3.1. Bootstrap a Next.js application
-
-Navigate to the `apps` directory:
-
-```bash
-cd ../../apps
-```
-
-Create a new Next.js app named `web`:
-
-```bash
-pnpm create next-app@latest web --yes
-```
-
-:::note[important]
-
-The `--yes` flag uses default configurations to bootstrap the Next.js app (which in this guide uses the app router without a `src/` directory and `pnpm` as the installer).
-
-Additionally, the flag may automatically initialize a Git repository in the `web` folder. If that happens, please remove the `.git` directory by running `rm -r .git`.
-
-:::
-
-Then, navigate into the web directory:
-
-```bash
-cd web/
-```
-
-Copy the `.env` file from the database package to ensure the same environment variables are available:
-
-```bash
-cp ../../packages/database/.env .
-```
-
-Open the `package.json` file of your Next.js app and add the shared `database` package as a dependency:
-
-```json title="web/package.json"
-"dependencies": {
- "database": "workspace:*", // [!code ++]
- // additional dependencies
- // ...
-}
-```
-
-Run the following command to install the `database` package:
-
-```bash
-pnpm install
-```
-
-### 3.2. Integrate the shared `database` package in your app code
-
-Modify your Next.js application code to use Prisma Client from the database package. Update `app/page.tsx` as follows:
-
-```tsx title="app/page.tsx"
-import { prisma } from "database"; // [!code ++]
-
-export default async function Home() {
- // [!code ++]
- const user = await prisma.user.findFirst({
- // [!code ++]
- select: {
- // [!code ++]
- name: true, // [!code ++]
- }, // [!code ++]
- }); // [!code ++]
-
- return (
- // [!code ++]
-
- {" "}
- // [!code ++]
- {user?.name &&
Hello from {user.name}
} // [!code ++]
- {!user?.name &&
No user has been added to the database yet.
} // [!code ++]
-
// [!code ++]
- ); // [!code ++]
-} // [!code ++]
-```
-
-This code demonstrates importing and using the shared Prisma Client to query your `User` model.
-
-### 3.3. Add helper scripts and run your application
-
-Add the following scripts to the root `package.json` of your monorepo. They ensure that database migrations, type generation, and app builds run in the proper order:
-
-```json
-"scripts": {
- "build": "pnpm --filter database db:deploy && pnpm --filter database db:generate && pnpm --filter web build", // [!code ++]
- "start": "pnpm --filter web start", // [!code ++]
- "dev": "pnpm --filter database db:generate && pnpm --filter web dev", // [!code ++]
- "studio": "pnpm --filter database db:studio" // [!code ++]
-}
-```
-
-### 3.4. Run your application
-
-Then head back to the root of the monorepo:
-
-```bash
-cd ../../
-```
-
-Start your development server by executing:
-
-```bash
-pnpm run dev
-```
-
-Open your browser at [`http://localhost:3000`](http://localhost:3000) to see your app in action.
-
-### 3.5. (Optional) Add data to your database using Prisma Studio
-
-There shouldn't be data in your database yet. You can execute `pnpm run studio` in your CLI to start a [Prisma Studio](/v6/orm/tools/prisma-studio) in [`http://localhost:5555`](http://localhost:5555) to interact with your database and add data to it.
-
-## Next Steps
-
-You have now created a monorepo that uses Prisma ORM effectively, with a shared database package integrated into a Next.js application.
-
-For further exploration and to enhance your setup, consider reading the [How to use Prisma ORM with Turborepo](/v6/guides/turborepo) guide.
diff --git a/apps/docs/content/docs.v6/guides/vercel-app-deployment.mdx b/apps/docs/content/docs.v6/guides/vercel-app-deployment.mdx
deleted file mode 100644
index d2a7d542cb..0000000000
--- a/apps/docs/content/docs.v6/guides/vercel-app-deployment.mdx
+++ /dev/null
@@ -1,624 +0,0 @@
----
-title: Vercel app deployment
-description: Learn how to programmatically deploy applications with Vercel and Prisma Postgres using the instant deployment API
-image: /img/guides/vercel_app_deployments.png
-url: /v6/guides/vercel-app-deployment
-metaTitle: Instant app deployment with Vercel and Prisma Postgres
-metaDescription: Learn how to programmatically deploy applications with Vercel and Prisma Postgres using the instant deployment API
----
-
-## Introduction
-
-This guide shows you how to implement instant app deployment using [Vercel](https://vercel.com)'s API with integrated [Prisma Postgres](/v6/postgres) databases. You'll learn to programmatically create, deploy, and transfer full-stack applications with a single API call.
-
-Instant app deployment solves a critical problem for AI coding platforms, no-code tools, and educational platforms: getting from generated code to a live, production-ready application. Instead of requiring users to manually set up hosting infrastructure, you can offer one-click deployments with both application and database.
-
-By the end of this guide, you'll understand how to integrate Vercel's deployment API with Prisma Postgres to create a smooth deployment experience for your users.
-
-## Try the live demo
-
-Experience the instant deployment flow with [our interactive demo](https://pris.ly/vercel-app-demo-live). You can deploy and claim real applications to see the complete process in action.
-
-
-
-**Available examples:**
-
-- **Next.js + Prisma**: Basic full-stack application with database integration
-- **Next.js + Prisma + Better Auth**: Complete application with authentication using [Better Auth](https://www.better-auth.com/)
-
-**Demo features:**
-
-- Deploy applications with one click
-- Generate claim codes for user transfer
-- Experience the complete claiming flow
-- View source code and implementation details
-
-[Visit the GitHub repository for the demo](https://pris.ly/vercel_app_deployment_demo?utm_source=docs).
-
-## Who is this for
-
-This guide is designed for developers building:
-
-- **AI-powered development platforms** that generate full applications and need instant deployment
-- **No-code/low-code tools** that want to offer hosting without managing infrastructure
-- **Educational platforms** where students need to deploy projects quickly
-- **CI/CD systems** that need programmatic deployment capabilities
-- **Rapid prototyping tools** that transform ideas into deployed applications
-
-## Core concepts
-
-Before implementing the deployment flow, let's understand the key concepts:
-
-### Vercel deployment architecture
-
-- **Projects**: Containers that hold your application code and configuration
-- **Deployments**: Specific instances of your project deployed to Vercel's edge network
-- **Teams**: Organizational units that own projects and manage billing
-- **Integrations**: Third-party services (like Prisma) that connect to your projects
-
-### Prisma integration components
-
-- **Integration configuration**: Your team's connection to the Prisma service
-- **Authorization**: Permission to create resources on behalf of your team
-- **Database stores**: Individual Prisma Postgres instances
-- **Resource connections**: Links between databases and Vercel projects
-
-### API endpoints overview
-
-The deployment process uses several key Vercel API endpoints:
-
-- `POST /v10/projects` - Create a new Vercel project
-- `POST /v1/integrations/billing/authorization` - Authorize Prisma integration
-- `POST /v1/storage/stores/integration` - Create Prisma Postgres database
-- `POST /v13/deployments` - Deploy application code
-- `POST /v9/projects/{id}/transfer-request` - Generate claim code for user transfer
-
-## Required API keys and environment variables
-
-:::tip[Contact us for elevated partner level access for db creation]
-
-By default, every new partner is on our free plan which limited to 5 dbs per account, so if you are trying out this API and need higher db creation limits (which we suspect that most of you will), then please [contact us](https://www.prisma.io/partners#contact-us) to get partner level access.
-:::
-
-### Vercel access token
-
-Your primary authentication token for Vercel API calls.
-
-**Where to get it:**
-
-1. Go to [Vercel Account Settings](https://vercel.com/account/tokens)
-2. Click **Create Token**
-3. Name it (e.g., "Instant Deployment API")
-4. Set scope to your **team** (not personal account)
-5. Copy the token immediately (you won't see it again)
-
-:::tip
-
-You need "Owner" level access to the Vercel team to ensure the `ACCESS_TOKEN` works for all the API calls.
-
-:::
-
-```bash
-ACCESS_TOKEN="vercel_token_here"
-```
-
-:::note[Credit card requirement]
-Vercel requires a credit card to be attached to your account (even on the Hobby plan) to use the deployment APIs. Make sure to add payment information in your Vercel account settings before proceeding.
-:::
-
-### Team ID
-
-Your Vercel team identifier for API requests.
-
-**Where to get it:**
-
-1. Go to [Vercel Dashboard](https://vercel.com/dashboard)
-2. Switch to your **Team** (not personal account)
-3. Go to **Team Settings**
-4. Copy the Team ID displayed at the top (format: `team_abc123xyz`)
-
-```bash
-TEAM_ID="team_abc123xyz"
-```
-
-### Prisma integration config ID
-
-Your team's Prisma integration configuration identifier.
-
-**Where to get it:**
-
-1. In Vercel Dashboard, go to your **Team**
-2. Click **Integrations** tab
-3. Find **Prisma** and click **Manage** (install it first if needed)
-4. In the browser URL, copy the config ID: `https://vercel.com/teams/your-team/integrations/icfg_abc123xyz`
-5. Copy the `icfg_abc123xyz` part
-
-```bash
-INTEGRATION_CONFIG_ID="icfg_abc123xyz"
-```
-
-### Prisma Product ID
-
-The Prisma Product ID is used to identify the Prisma integration in the Vercel API and it's a constant value of: `iap_yVdbiKqs5fLkYDAB` or `prisma-postgres`.
-
-```bash
-PRISMA_PRODUCT_ID="iap_yVdbiKqs5fLkYDAB"
-```
-
-### Prisma Postgres region
-
-The region where your Prisma Postgres database will be deployed. Choose a region close to your users for optimal performance.
-
-**Available regions:**
-
-- `iad1` - US East (Virginia)
-- `fra1` - Europe (Frankfurt)
-- `sfo1` - US West (San Francisco)
-- `sin1` - Asia Pacific (Singapore)
-- `hnd1` - Asia Pacific (Tokyo)
-- `cdg1` - Europe (Paris)
-
-```bash
-PRISMA_POSTGRES_REGION="iad1"
-```
-
-See the complete list of [supported Prisma Postgres regions](/v6/postgres/faq#what-regions-is-prisma-postgres-available-in) and their corresponding [Vercel region codes](https://vercel.com/docs/regions#region-list).
-
-### Prisma billing plan
-
-The billing plan determines database limits and features. Available plans:
-
-- `free` - Limited to 5 databases, suitable for development
-- `pro` - Higher limits with connection pooling and caching
-- `business` - Enterprise features with priority support
-- `enterprise` - Custom limits and dedicated support
-- `partnerEntry` - Partner-level access with high database limits
-
-```bash
-PRISMA_BILLING_PLAN="partnerEntry"
-```
-
-:::tip[Partner access recommended]
-For production deployments requiring multiple databases, we recommend the `partnerEntry` plan which provides higher database creation limits. [Apply for partner access](https://www.prisma.io/partners) to unlock these capabilities.
-:::
-
-## Complete deployment example
-
-The code snippet below shows the complete deployment flow:
-
-```typescript
-const CONFIG = {
- ACCESS_TOKEN: process.env.ACCESS_TOKEN,
- TEAM_ID: process.env.TEAM_ID,
- INTEGRATION_CONFIG_ID: process.env.INTEGRATION_CONFIG_ID,
- PRISMA_PRODUCT_ID: process.env.PRISMA_PRODUCT_ID || "iap_yVdbiKqs5fLkYDAB", // or can be `prisma-postgres`
- PRISMA_POSTGRES_REGION: process.env.PRISMA_POSTGRES_REGION || "iad1",
- PRISMA_BILLING_PLAN: process.env.PRISMA_BILLING_PLAN || "partnerEntry",
- VERCEL_API_URL: "https://api.vercel.com",
-};
-
-async function deployApp() {
- console.log("🚀 Starting instant deployment...");
-
- // 1. Create project
- const project = await createProject();
-
- // 2. Authorize Prisma integration
- const auth = await createPrismaAuthorization();
-
- // 3. Create database
- const database = await createPrismaDatabase(project.name, auth.id, auth.configId);
-
- // 4. Connect database to project
- await connectDatabaseToProject(project.id, database.id, auth.configId);
-
- // 5. Deploy application (assumes files already uploaded)
- const deployment = await deployApplication(project.name, fileSha);
-
- // 6. Generate claim code
- const transfer = await createProjectTransfer(project.id);
-
- console.log("🎉 Deployment completed!");
- console.log(`Live URL: https://${deployment.url}`);
- console.log(`Claim URL: ${transfer.claimUrl}`);
-
- return {
- projectId: project.id,
- deploymentUrl: `https://${deployment.url}`,
- claimCode: transfer.code,
- claimUrl: transfer.claimUrl,
- };
-}
-```
-
-## Step-by-step deployment process
-
-The complete example above demonstrates the entire deployment process. Now let's break down each step in detail.
-
-### Step 1: Create a Vercel project
-
-Every deployment starts with creating a project container.
-
-```typescript
-async function createProject(): Promise<{ id: string; name: string }> {
- const projectName = `demo-project-${Date.now()}`;
-
- const response = await fetch(`${CONFIG.VERCEL_API_URL}/v10/projects?teamId=${CONFIG.TEAM_ID}`, {
- method: "POST",
- headers: {
- Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ name: projectName }),
- });
-
- const project = await response.json();
- console.log(`✅ Project created: ${project.name} (${project.id})`);
-
- return { id: project.id, name: project.name };
-}
-```
-
-**Key parameters:**
-
-- `name`: Unique project identifier (auto-generated with timestamp)
-- `teamId`: Your team ID for proper project ownership
-
-Learn more in the [Vercel Projects API documentation](https://vercel.com/docs/rest-api/reference/endpoints/projects/create-a-new-project).
-
-### Step 2: Authorize Prisma integration
-
-Before creating databases, you need authorization to use Prisma on behalf of your team.
-
-```typescript
-async function createPrismaAuthorization(): Promise<{
- id: string;
- configId: string;
-}> {
- const response = await fetch(
- `${CONFIG.VERCEL_API_URL}/v1/integrations/billing/authorization?teamId=${CONFIG.TEAM_ID}`,
- {
- method: "POST",
- headers: {
- Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- integrationIdOrSlug: "prisma",
- productId: CONFIG.PRISMA_PRODUCT_ID,
- billingPlanId: CONFIG.PRISMA_BILLING_PLAN,
- metadata: JSON.stringify({ region: CONFIG.PRISMA_POSTGRES_REGION }),
- integrationConfigurationId: CONFIG.INTEGRATION_CONFIG_ID,
- }),
- },
- );
-
- const authData = await response.json();
-
- return {
- id: authData.authorization.id,
- configId: authData.authorization.integrationConfigurationId,
- };
-}
-```
-
-**Key parameters:**
-
-- `billingPlanId`: Billing plan ("partnerEntry" recommended for production)
-- `region`: Database region for optimal performance
-- `metadata`: JSON string containing region and other configuration
-
-Learn more in the [Vercel Integrations API documentation](https://vercel.com/docs/integrations/create-integration/marketplace-api).
-
-### Step 3: Provision Prisma Postgres database
-
-Create a new database instance with automatic connection pooling and caching.
-
-```typescript
-async function createPrismaDatabase(
- projectName: string,
- authId: string,
- configId: string,
-): Promise<{ id: string }> {
- const response = await fetch(
- `${CONFIG.VERCEL_API_URL}/v1/storage/stores/integration?teamId=${CONFIG.TEAM_ID}`,
- {
- method: "POST",
- headers: {
- Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- metadata: { region: CONFIG.PRISMA_POSTGRES_REGION },
- billingPlanId: CONFIG.PRISMA_BILLING_PLAN,
- name: `postgres-${projectName}`,
- integrationConfigurationId: configId,
- integrationProductIdOrSlug: CONFIG.PRISMA_PRODUCT_ID,
- authorizationId: authId,
- source: "marketplace",
- }),
- },
- );
-
- const storageData = await response.json();
-
- return {
- id: storageData.store.id,
- };
-}
-```
-
-**Key parameters:**
-
-- `name`: Database identifier (typically matches project name)
-- `source`: "marketplace" for Vercel marketplace integrations
-- `billingPlanId`: Billing plan that determines features and limits
-
-Learn more in the [Vercel Storage API documentation](https://vercel.com/docs/rest-api/reference/endpoints/integrations/create-integration-store-free-and-paid-plans).
-
-### Step 4: Connect database to project
-
-Link the database to your Vercel project for automatic environment variable injection.
-
-```typescript
-async function connectDatabaseToProject(
- projectId: string,
- storeId: string,
- configId: string,
-): Promise {
- await fetch(
- `${CONFIG.VERCEL_API_URL}/v1/integrations/installations/${configId}/products/${CONFIG.PRISMA_PRODUCT_ID}/resources/${storeId}/connections?teamId=${CONFIG.TEAM_ID}`,
- {
- method: "POST",
- headers: {
- Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ projectId }),
- },
- );
-
- console.log("✅ Database connected to project");
-}
-```
-
-This connection automatically adds `DATABASE_URL` and other environment variables to your project.
-
-Learn more in the [Vercel Integration Resources documentation](https://vercel.com/docs/rest-api/reference/endpoints/integrations/connect-integration-resource-to-project).
-
-### Step 5: Deploy the application
-
-Deploy your application code to Vercel.
-
-```typescript
-async function deployApplication(
- projectName: string,
- fileSha: string,
-): Promise<{ id: string; url: string }> {
- const response = await fetch(
- `${CONFIG.VERCEL_API_URL}/v13/deployments?teamId=${CONFIG.TEAM_ID}`,
- {
- method: "POST",
- headers: {
- Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- files: [{ file: ".vercel/source.tgz", sha: fileSha }],
- name: `deployment-${Date.now()}`,
- projectSettings: { framework: "nextjs" },
- project: projectName,
- }),
- },
- );
-
- const deploymentData = await response.json();
-
- return {
- id: deploymentData.id,
- url: deploymentData.alias?.[0] || deploymentData.url,
- };
-}
-```
-
-**Key parameters:**
-
-- `files`: Array of uploaded files (requires prior file upload in `tgz` format)
-- `framework`: "nextjs", "react", "vue", etc. for automatic configuration
-- `projectSettings`: Framework-specific build and runtime settings
-
-Learn more in the [Vercel Deployments API documentation](https://vercel.com/docs/rest-api/reference/endpoints/deployments/create-a-new-deployment) or see the [Vercel API Reference](https://vercel.com/docs/rest-api/reference).
-
-### Step 6: Generate claim code for user transfer
-
-Create a transfer code that allows users to claim ownership of the deployed project.
-
-```typescript
-async function createProjectTransfer(
- projectId: string,
-): Promise<{ code: string; claimUrl: string }> {
- const response = await fetch(
- `${CONFIG.VERCEL_API_URL}/v9/projects/${projectId}/transfer-request?teamId=${CONFIG.TEAM_ID}`,
- {
- method: "POST",
- headers: {
- Authorization: `Bearer ${CONFIG.ACCESS_TOKEN}`,
- "Content-Type": "application/json",
- },
- body: JSON.stringify({}),
- },
- );
-
- const transferData = await response.json();
- const claimUrl = `https://vercel.com/claim-deployment?code=${transferData.code}&returnUrl=https://myapp.com/dashboard/projects`;
-
- return {
- code: transferData.code,
- claimUrl,
- };
-}
-```
-
-**Key details:**
-
-- Transfer codes are valid for **24 hours**
-- Users can claim projects to any team in their Vercel account
-- The `returnUrl` redirects users to a specific page if the claim URL is invalid or expired
-
-Learn more in the [Vercel Claim Deployments documentation](https://vercel.com/docs/deployments/claim-deployments).
-
-## User claim flow
-
-After deployment, users can claim ownership through a secure transfer process:
-
-### How claiming works
-
-1. **User receives claim URL**: Your platform provides the generated claim URL
-2. **User authentication**: Vercel prompts for login if not authenticated
-3. **Team selection**: User chooses which Vercel team should own the project
-4. **Transfer completion**: Project and database transfer to user's selected team
-5. **Billing transfer**: User's team becomes responsible for hosting costs
-
-### Claim URL structure
-
-```
-https://vercel.com/claim-deployment?code=xxx&returnUrl=https://myapp.com/dashboard/projects
-```
-
-**Parameters:**
-
-- `code`: The transfer code from Step 6 (valid 24 hours)
-- `returnUrl`: Redirects users to a specific page if the claim URL is invalid or expired
-
-### What gets transferred
-
-When a user claims a deployment, they receive:
-
-- **Full project ownership** with all source code and configuration
-- **Database ownership** including all data and connection strings
-- **Environment variables** automatically updated for the new team
-- **Deployment history** and build logs
-
-Learn more in the [Claim Deployments documentation](https://vercel.com/docs/deployments/claim-deployments).
-
-## Error handling and best practices
-
-### Common error scenarios
-
-```typescript
-async function handleApiErrors(response: Response, operation: string) {
- if (!response.ok) {
- const errorData = await response.text();
-
- // Handle specific error cases
- switch (response.status) {
- case 401:
- throw new Error(`Authentication failed: Check your ACCESS_TOKEN`);
- case 403:
- throw new Error(`Permission denied: Verify team access and scopes`);
- case 429:
- throw new Error(`Rate limit exceeded: Implement retry logic`);
- case 404:
- throw new Error(`Resource not found: Check IDs and configuration`);
- default:
- throw new Error(`${operation} failed: ${response.status} - ${errorData}`);
- }
- }
-}
-```
-
-Proper error handling prevents deployment failures and provides clear debugging information to your users.
-
-### Rate limiting considerations
-
-Vercel enforces rate limits on API endpoints. You can implement exponential backoff to handle rate limits:
-
-```typescript
-async function apiCallWithRetry(url: string, options: RequestInit, maxRetries = 3) {
- for (let attempt = 1; attempt <= maxRetries; attempt++) {
- try {
- const response = await fetch(url, options);
-
- if (response.status === 429) {
- const waitTime = Math.pow(2, attempt) * 1000; // Exponential backoff
- await new Promise((resolve) => setTimeout(resolve, waitTime));
- continue;
- }
-
- return response;
- } catch (error) {
- if (attempt === maxRetries) throw error;
- }
- }
-}
-```
-
-Retry logic ensures your deployment service remains reliable during high-traffic periods.
-
-Learn more in the [Vercel API Limits documentation](https://vercel.com/docs/limits).
-
-### Security best practices
-
-- **Store tokens securely**: Never expose API tokens in client-side code
-- **Validate inputs**: Sanitize project names and user-provided data
-- **Monitor usage**: Track API calls to prevent abuse
-- **Implement timeouts**: Set reasonable request timeouts for reliability
-
-These practices protect your integration from common security vulnerabilities and ensure stable operation.
-
-## Production considerations
-
-The following are some production considerations for your deployment service:
-
-### Integration with existing platforms
-
-You can integrate your deployment service with existing platforms to provide a smooth experience for your users:
-
-```typescript
-// Example integration with an AI coding platform
-class DeploymentService {
- async deployGeneratedApp(code: string, userId: string) {
- // 1. Package generated code
- const packagedCode = await this.packageCode(code);
-
- // 2. Deploy with Vercel + Prisma
- const deployment = await this.deployApp(packagedCode);
-
- // 3. Store deployment info
- await this.storeDeployment(userId, deployment);
-
- // 4. Notify user
- await this.notifyUser(userId, deployment.claimUrl);
-
- return deployment;
- }
-}
-```
-
-### Monitoring and analytics
-
-Track key metrics for your deployment service:
-
-- **Deployment success rate**: Monitor API failures and timeouts
-- **Claim conversion rate**: Track how many users claim their deployments
-- **Performance metrics**: Measure deployment time and user experience
-- **Cost analysis**: Monitor Vercel and Prisma usage costs
-
-## Next steps
-
-Now that you understand instant app deployment with Vercel and Prisma Postgres, you can:
-
-- **Integrate into your platform**: Add deployment capabilities to your existing application
-- **Customize the flow**: Adapt the process for your specific use case and user experience
-- **Scale your implementation**: Handle high-volume deployments with proper queuing and error handling
-- **Monitor and optimize**: Track performance and user adoption metrics
-
-### Additional resources
-
-- [Vercel REST API Documentation](https://vercel.com/docs/rest-api)
-- [Vercel Claim Deployments Guide](https://vercel.com/docs/deployments/claim-deployments)
-- [Vercel Integration API Reference](https://vercel.com/docs/integrations/create-integration/marketplace-api)
-- [Prisma Postgres Documentation](/v6/postgres)
-- [Vercel Limits and Quotas](https://vercel.com/docs/limits)
-
-For questions or support with your integration, reach out through the [Prisma Community Discord](https://pris.ly/discord) or [Vercel Support](https://vercel.com/help).
diff --git a/apps/docs/content/docs.v6/meta.json b/apps/docs/content/docs.v6/meta.json
deleted file mode 100644
index 0c19876210..0000000000
--- a/apps/docs/content/docs.v6/meta.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "pages": [
- "(index)",
- "orm",
- "postgres",
- "accelerate",
- "guides",
- "platform",
- "ai"
- ]
-}
diff --git a/apps/docs/content/docs.v6/orm/getting-started/add-to-existing-project.mdx b/apps/docs/content/docs.v6/orm/getting-started/add-to-existing-project.mdx
deleted file mode 100644
index c3ba438b5a..0000000000
--- a/apps/docs/content/docs.v6/orm/getting-started/add-to-existing-project.mdx
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: Add Prisma ORM to an existing project
-description: Step-by-step guide to add Prisma ORM to your existing application.
-url: /v6/orm/getting-started/add-to-existing-project
-metaTitle: Add Prisma ORM to an existing project
-metaDescription: This section provides a step-by-step guide to add Prisma ORM to an existing project.
----
-
-Already have a project? Add Prisma ORM to integrate a type-safe database client.
-
-## Choose Your Database
-
-Select your database to get started:
-
-- [**PostgreSQL**](/v6/prisma-orm/add-to-existing-project/postgresql) - Add Prisma to a project with PostgreSQL
-- [**MySQL**](/v6/prisma-orm/add-to-existing-project/mysql) - Add Prisma to a project with MySQL
-- [**MongoDB**](/v6/prisma-orm/add-to-existing-project/mongodb) - Add Prisma to a project with MongoDB
-- [**SQLite**](/v6/prisma-orm/add-to-existing-project/sqlite) - Add Prisma to a project with SQLite
-- [**SQL Server**](/v6/prisma-orm/add-to-existing-project/sql-server) - Add Prisma to a project with SQL Server
-
-## Prisma Postgres
-
-For the easiest setup experience, use [Prisma Postgres](/v6/prisma-orm/add-to-existing-project/prisma-postgres) - Prisma's managed PostgreSQL database with built-in connection pooling.
diff --git a/apps/docs/content/docs.v6/orm/getting-started/index.mdx b/apps/docs/content/docs.v6/orm/getting-started/index.mdx
deleted file mode 100644
index 3a0c78868a..0000000000
--- a/apps/docs/content/docs.v6/orm/getting-started/index.mdx
+++ /dev/null
@@ -1,35 +0,0 @@
----
-title: Getting started with Prisma ORM
-description: Choose your path to start using Prisma ORM - quickstart for new projects or add to existing projects.
-url: /v6/orm/getting-started
-metaTitle: Getting started with Prisma ORM
-metaDescription: This section provides a quick step-by-step guide to get started with Prisma ORM.
----
-
-Prisma ORM is a next-generation Node.js and TypeScript ORM that provides type-safe database access, migrations, and a powerful query API.
-
-## Choose Your Path
-
-### Start Fresh
-
-New to Prisma? Start with our quickstart guides:
-
-- [**Quickstart with Prisma Postgres**](/v6/prisma-orm/quickstart/prisma-postgres) - Fastest way to get started with Prisma's managed PostgreSQL
-- [**Quickstart with PostgreSQL**](/v6/prisma-orm/quickstart/postgresql) - Use your own PostgreSQL database
-- [**Quickstart with SQLite**](/v6/prisma-orm/quickstart/sqlite) - Perfect for local development
-- [**Quickstart with MySQL**](/v6/prisma-orm/quickstart/mysql) - Use MySQL database
-- [**Quickstart with MongoDB**](/v6/prisma-orm/quickstart/mongodb) - Use MongoDB database
-
-### Add to Existing Project
-
-Already have a project? Add Prisma ORM to your existing application:
-
-- [**Add Prisma to existing project**](/v6/prisma-orm/add-to-existing-project/prisma-postgres) - Integrate Prisma ORM into your current codebase
-
-## What's Next?
-
-After getting started, explore these key topics:
-
-- [**Prisma Schema**](/v6/orm/prisma-schema/overview) - Learn how to define your data model
-- [**Prisma Client**](/v6/orm/prisma-client/setup-and-configuration/introduction) - Master the query API
-- [**Prisma Migrate**](/v6/orm/prisma-migrate/getting-started) - Handle database migrations
diff --git a/apps/docs/content/docs.v6/orm/getting-started/meta.json b/apps/docs/content/docs.v6/orm/getting-started/meta.json
deleted file mode 100644
index 027653c4c9..0000000000
--- a/apps/docs/content/docs.v6/orm/getting-started/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Getting started",
- "defaultOpen": true,
- "pages": ["index", "quickstart", "add-to-existing-project"]
-}
diff --git a/apps/docs/content/docs.v6/orm/getting-started/quickstart.mdx b/apps/docs/content/docs.v6/orm/getting-started/quickstart.mdx
deleted file mode 100644
index e59cd3cefe..0000000000
--- a/apps/docs/content/docs.v6/orm/getting-started/quickstart.mdx
+++ /dev/null
@@ -1,25 +0,0 @@
----
-title: Quickstart with Prisma ORM
-description: Get started with Prisma ORM quickly using our step-by-step guides.
-url: /v6/orm/getting-started/quickstart
-metaTitle: Quickstart with Prisma ORM
-metaDescription: This section provides a quick step-by-step guide to get started with Prisma ORM.
----
-
-Get up and running with Prisma ORM in minutes. Choose the guide that matches your setup:
-
-## Start Fresh
-
-If you're starting a new project, follow one of these quickstart guides:
-
-- [**Quickstart with Prisma Postgres**](/v6/prisma-orm/quickstart/prisma-postgres) - Use Prisma's managed PostgreSQL database
-- [**Quickstart with PostgreSQL**](/v6/prisma-orm/quickstart/postgresql) - Use your own PostgreSQL database
-- [**Quickstart with SQLite**](/v6/prisma-orm/quickstart/sqlite) - Use SQLite for local development
-- [**Quickstart with MySQL**](/v6/prisma-orm/quickstart/mysql) - Use MySQL database
-- [**Quickstart with MongoDB**](/v6/prisma-orm/quickstart/mongodb) - Use MongoDB database
-
-## Add to Existing Project
-
-If you already have a project and want to add Prisma ORM:
-
-- [**Add to existing project**](/v6/prisma-orm/add-to-existing-project/prisma-postgres) - Add Prisma ORM to your existing application
diff --git a/apps/docs/content/docs.v6/orm/meta.json b/apps/docs/content/docs.v6/orm/meta.json
deleted file mode 100644
index ac6372a72d..0000000000
--- a/apps/docs/content/docs.v6/orm/meta.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "title": "ORM",
- "root": true,
- "defaultOpen": true,
- "pages": [
- "index",
- "getting-started",
- "overview",
- "prisma-schema",
- "prisma-client",
- "prisma-migrate",
- "tools",
- "reference",
- "more"
- ]
-}
diff --git a/apps/docs/content/docs.v6/orm/more/meta.json b/apps/docs/content/docs.v6/orm/more/meta.json
deleted file mode 100644
index ad1c1e56e3..0000000000
--- a/apps/docs/content/docs.v6/orm/more/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "More",
- "defaultOpen": true,
- "pages": ["..."]
-}
diff --git a/apps/docs/content/docs.v6/orm/overview/meta.json b/apps/docs/content/docs.v6/orm/overview/meta.json
deleted file mode 100644
index c5adc39c23..0000000000
--- a/apps/docs/content/docs.v6/orm/overview/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Overview",
- "defaultOpen": true,
- "pages": ["..."]
-}
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/meta.json b/apps/docs/content/docs.v6/orm/prisma-client/meta.json
deleted file mode 100644
index 3b1ce98560..0000000000
--- a/apps/docs/content/docs.v6/orm/prisma-client/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Prisma Client",
- "defaultOpen": true,
- "pages": ["..."]
-}
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/meta.json b/apps/docs/content/docs.v6/orm/prisma-migrate/meta.json
deleted file mode 100644
index 432f53feef..0000000000
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Prisma Migrate",
- "defaultOpen": true,
- "pages": ["..."]
-}
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/meta.json b/apps/docs/content/docs.v6/orm/prisma-schema/meta.json
deleted file mode 100644
index 15ec300169..0000000000
--- a/apps/docs/content/docs.v6/orm/prisma-schema/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Prisma Schema",
- "defaultOpen": true,
- "pages": ["..."]
-}
diff --git a/apps/docs/content/docs.v6/orm/reference/meta.json b/apps/docs/content/docs.v6/orm/reference/meta.json
deleted file mode 100644
index 30dc40a9b7..0000000000
--- a/apps/docs/content/docs.v6/orm/reference/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Reference",
- "defaultOpen": true,
- "pages": ["..."]
-}
diff --git a/apps/docs/content/docs.v6/platform/about.mdx b/apps/docs/content/docs.v6/platform/about.mdx
deleted file mode 100644
index b298de9563..0000000000
--- a/apps/docs/content/docs.v6/platform/about.mdx
+++ /dev/null
@@ -1,146 +0,0 @@
----
-title: General
-description: Learn about the Console to integrate the Prisma Data Platform products.
-displayed_sidebar: platformSidebar
-url: /v6/platform/about
-metaTitle: General | Prisma Console
-metaDescription: Learn about the Console to integrate the Prisma Data Platform products.
----
-
-## Overview
-
-The [Console](https://console.prisma.io/login) enables you to manage and configure your projects that use Prisma Data Platform (PDP) products, and helps you integrate them into your application:
-
-- [Accelerate](/v6/accelerate): Speeds up your queries with a global database cache with scalable connection pooling.
-- [Query Insights](/query-insights): Provides you recommendations that can help you make your database queries faster.
-- [Prisma Postgres](/v6/postgres): A managed PostgreSQL database that is optimized for Prisma ORM.
-
-## Concepts
-
-The Console workflows are based on four main concepts:
-
-- [**User account**](#user-account): In order to use PDP products, you need to have a PDP user account. A _user_ will typically create one user account to manage all their workspaces, projects and environments. The _user_ can also be invited to join other workspaces to collaborate on the projects in that workspace.
-- [**Workspaces**](#workspace): A user account can belong to multiple workspaces. A workspace typically represents a _team_ of individuals working together on one or more projects. **Billing is on a workspace level**, i.e. the invoice for a workspace at the end of the month captures all costs associated with the projects in a given workspace.
-- [**Projects**](#project): A project belongs to a workspace. It typically represents the _application_ or _service_ a team is working on.
-- [**Environments**](#environment): An environment belongs to a project. It typically maps to a _development stage_, like `Development`, `Staging` or `Production`. **API keys are provisioned on the environment level**, and products are configured per environment as well (e.g. the database connection string used for Accelerate).
-
-Here is a visual illustration of how these concepts relate to each other:
-
-
-
-### User account
-
-A user account is the prerequisite for any interactions with PDP products. You can use it to manage your workspaces (and their projects). A user account can be invited to collaborate on workspaces created by other users as well.
-
-If you need to delete your user account, go [here](/v6/platform/support#deleting-your-pdp-account).
-
-### Workspace
-
-You can create several workspaces. A workspace is an isolated space to host projects. A workspace can have multiple user accounts associated with it so that multiple users can collaborate on the projects in the workspace.
-
-In each workspace, you can:
-
-- view and manage all projects (and their environments) in that workspace.
-- manage billing, i.e. select a [subscription plan](https://www.prisma.io/pricing?utm_source=docs&utm_medium=platform-docs), configure payment methods, or view the invoice history.
-- view the usage of your enabled PDP products across all projects in that workspace.
-- invite other users to collaborate in the workspace.
-- access [Query Insights](https://console.prisma.io) to monitor query performance.
-
-### Database Metrics
-
-You can have a single workspace that hosts several database. Within each database, you can view
-detailed reports on how your database is performing, with various metrics like:
-
-- Average response size
-- Average query duration
-- Total egress
-- Total operations
-- Cache utilization
-
-#### Query Insights
-
-[Query Insights](/query-insights) is available within your [Prisma Console](https://console.prisma.io) workspace and helps you identify slow queries and understand their performance characteristics.
-
-### Project
-
-In each workspace, you can create several projects. A project typically represents an application (a product or service). You typically have one [Prisma schema](/v6/orm/prisma-schema/overview) per project.
-
-In each project, you can:
-
-- view and manage all environments in that project.
-
-The number of project you can create in a workspace depends on the [subscription plan](https://www.prisma.io/pricing?utm_source=docs&utm_medium=platform-docs) configured in that workspace.
-
-### Environment
-
-An environment is an isolated space used to provision PDP products for a specific project. Environments typically correspond to development stages, such as `Development`, `Staging`, or `Production`. Every new project begins with a _default_ environment named `Production`. The default environment ensures that the project always has at least one active environment. It cannot be deleted unless another environment is designated as the default.
-
-In each environment, you can:
-
-- enable, disable and configure PDP products (Accelerate, ...).
-- generate API keys.
-- for **Accelerate**:
- - set your database connection string.
- - configure the _region_ where Accelerate's connection pool is running.
- - change the connection pool size.
- - configure query duration and query response size limits.
- - enable static IP.
-
-The number of environments you can create in a project depends on the [subscription plan](https://www.prisma.io/pricing?utm_source=docs&utm_medium=platform-docs) configured in your workspace.
-
-## Database connection management
-
-The **Database** tab in the left panel of a project environment lets you configure and manage connections to your remote database. Within this tab, the **Connections** section displays a table with the following columns:
-
-| Column Name | Description |
-| ------------- | -------------------------------------------------------------------------------- |
-| **Hint** | Provides the URL structure for the database in use. |
-| **Static IP** | Indicates whether static IP is enabled for the database and associated products. |
-| **Products** | Lists the products that are enabled using the database URL. |
-| **Action** | Allows you to disable all active products and remove the connection. |
-
-## Billing
-
-The [subscription plan](https://www.prisma.io/pricing?utm_source=docs&utm_medium=platform-docs) you select in your workspace determines how many databases you can create in that workspace:
-
-| | **Free** | **Starter** | **Pro** | **Business** | **Enterprise** |
-| ------------- | -------- | ----------- | ------- | ------------ | -------------- |
-| **Databases** | 5 | 10 | 100 | 1000 | Custom |
-
-### Per-workspace billing
-
-Billing is set up on a per-workspace basis:
-
-- A subscription plan is selected per workspace. That means, a user account can belong to multiple workspaces where each workspace uses a different plan.
-- A payment method is selected per workspace. That means, a user account can belong to multiple workspaces where each workspace has a different payment method.
-
-At the end of a billing period, your selected payment method will be charged with the incurred costs of products across _all_ projects (and their environments) in that workspace.
-
-You can configure all billing details in the **Billing** section of your workspace.
-
-### Prorated billing
-
-All base plan prices are prorated, which means you're only billed for the duration of your subscription to a specific plan. In addition, you're also billed for any usage costs you've incurred during your subscription.
-
-For example:
-
-- if you subscribe to our **Pro** plan on the 15th day of a month, you'll only be charged the base plan price for the days left in that month.
-- if you downgrade your subscription plan (e.g. from **Business** to **Pro**) after 10 days of a 30-day month, you'll be charged for 10 days of the base price of the **Business** plan and 20 days for the base price of the **Pro** plan.
-
-Visit our [pricing page](https://www.prisma.io/pricing?utm_source=docs&utm_medium=platform-docs) for more details.
-
-### Downgrading a subscription plan
-
-If you downgrade a subscription plan, you may need to delete some of your projects and/or their environments in order to adhere to the [limits](#environment) of the newly selected plan.
-
-For example, if your workspace is on a **Business** plan and currently has 14 (out of 15) projects, you will need to delete at least 4 projects to adhere to the project limit of the **Pro** plan. Additionally, you need to make sure that the remaining projects don't have more than 6 environments per project to adhere to the environment limit of the **Pro** plan.
-
-You also need to disable features that are exclusive to **Pro** or **Business** plans, such as Static IPs. Once these adjustments are made, including disabling Static IPs, you can proceed to downgrade your subscription plan.
-
-## Programmatic access via the Platform CLI
-
-In addition to the web interface of the Console, the Prisma CLI provides another way to interact with your PDP account and manage PDP products.
-
-This can be useful if you need programmatic access, e.g. for integrating it into CI workflows.
-
-Read more about the [Prisma CLI](/v6/platform/platform-cli/about).
diff --git a/apps/docs/content/docs.v6/platform/concepts/meta.json b/apps/docs/content/docs.v6/platform/concepts/meta.json
deleted file mode 100644
index fda448b629..0000000000
--- a/apps/docs/content/docs.v6/platform/concepts/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "concepts",
- "defaultOpen": true,
- "pages": ["index", "..."]
-}
diff --git a/apps/docs/content/docs.v6/platform/index.mdx b/apps/docs/content/docs.v6/platform/index.mdx
deleted file mode 100644
index 41dc09747c..0000000000
--- a/apps/docs/content/docs.v6/platform/index.mdx
+++ /dev/null
@@ -1,16 +0,0 @@
----
-title: Platform
-description: 'Get started with the Prisma Data Platform with its official documentation, and learn more about its features with reference documentation, guides, and more.'
-displayed_sidebar: platformSidebar
-url: /v6/platform
-metaTitle: Platform
-metaDescription: 'Get started with the Prisma Data Platform with its official documentation, and learn more about its features with reference documentation, guides, and more.'
----
-
-Learn about the main concepts and workflows of the [Prisma Data Platform](https://console.prisma.io/login).
-
-## Getting started
-
-- [About](/v6/platform/about) - Learn about the Prisma Data Platform
-- [Platform CLI](/v6/platform/platform-cli/about) - Manage platform resources from the command line
-- [Concepts](/v6/platform) - Understand workspaces, projects, and environments
diff --git a/apps/docs/content/docs.v6/platform/maturity-levels.mdx b/apps/docs/content/docs.v6/platform/maturity-levels.mdx
deleted file mode 100644
index ceb5625200..0000000000
--- a/apps/docs/content/docs.v6/platform/maturity-levels.mdx
+++ /dev/null
@@ -1,42 +0,0 @@
----
-title: Maturity levels
-description: Understand the maturity levels for features in Prisma Data Platform
-displayed_sidebar: platformSidebar
-url: /v6/platform/maturity-levels
-metaTitle: 'Console: Maturity levels'
-metaDescription: Understand the maturity levels for features in Prisma Data Platform
----
-
-Prisma releases updates to Prisma Data Platform multiple times per week, as opposed to the Prisma ORM that we release on a set schedule every few weeks. This is why we consider the lifecycle and process for maturing features in Prisma Data Platform differently.
-
-You can [check out the releases and maturity process for the Prisma ORM](/v6/orm/more/releases) for further details.
-
-You can find information about releases across _all_ Prisma tools and products in the [changelog](https://www.prisma.io/changelog).
-
-### Early Access
-
-If a feature on the Prisma Data Platform is labeled as **Early Access**:
-
-- We have validated a problem and are considering a solution to it but are not certain whether that solution is complete or a perfect fit.
-- We want to gather more feedback and adjust the solution as necessary, knowing that users are prepared for significant breaking changes
-- We reserve ourselves the right to throttle or remove access to a feature in Early Access to preserve the stability of the platform, or enforcing its use to stay within the scope defined in our [Terms of Service](https://pris.ly/terms).
-
-As always, your feedback in our [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=inline_text) is invaluable to shape the design of the features. This will help us ensure that they can solve your problems in the best way possible.
-
-### Preview
-
-If a feature on the Prisma Data Platform is labeled as **Preview**:
-
-- We have refined the software based on the valuable feedback we obtained during the Early Access phase.
-- We developed the feature further, bringing it closer to the final version, though it's not completely ready for production usage.
-- We have lifted the invite gate, so users no longer need an invitation to access the feature. Users just need to sign up to gain access.
-- We have increased the stability of the software compared to the Early Access phase. While there might still be some issues, they should be less frequent and less critical.
-- We use the Preview phase as a final stress test to ensure the product is ready for heavy production workloads.
-
-We recommend testing the product in a staging environment and welcome any feedback in our [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=inline_text). This will assist us in improving the product for its final release.
-
-### General Availability
-
-If a feature in the Prisma Data Platform is Generally Available:
-
-- The solution has undergone extensive testing and, based on significant feedback, is deemed stable and ready for production use cases.
diff --git a/apps/docs/content/docs.v6/platform/meta.json b/apps/docs/content/docs.v6/platform/meta.json
deleted file mode 100644
index 152983d965..0000000000
--- a/apps/docs/content/docs.v6/platform/meta.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "title": "Platform",
- "root": true,
- "defaultOpen": true,
- "pages": ["index", "about", "maturity-levels", "support", "platform-cli", "concepts"]
-}
diff --git a/apps/docs/content/docs.v6/platform/platform-cli/about.mdx b/apps/docs/content/docs.v6/platform/platform-cli/about.mdx
deleted file mode 100644
index 53fc1f2ccf..0000000000
--- a/apps/docs/content/docs.v6/platform/platform-cli/about.mdx
+++ /dev/null
@@ -1,12 +0,0 @@
----
-title: About the Platform CLI
-description: Learn how to manage your Prisma Data Platform projects directly from the command line using the Prisma CLI integration.
-displayed_sidebar: platformSidebar
-url: /v6/platform/platform-cli/about
-metaTitle: 'Platform CLI: About'
-metaDescription: Learn how to manage your Prisma Data Platform projects directly from the command line using the Prisma CLI integration.
----
-
-This guide demonstrates how to access the Prisma Data Platform using the [Prisma CLI](/v6/orm/tools/prisma-cli). Get started by ensuring you have the Prisma CLI installed, following our setup [instructions](/v6/orm/tools/prisma-cli#installation).
-
-This integration, now in Early Access, expands the capabilities of the Prisma CLI, enabling management of your Platform projects directly from the command line. For a detailed overview of all the commands, please refer to the [Commands page](/v6/platform/platform-cli/commands).
diff --git a/apps/docs/content/docs.v6/platform/platform-cli/commands.mdx b/apps/docs/content/docs.v6/platform/platform-cli/commands.mdx
deleted file mode 100644
index a0ffde5a62..0000000000
--- a/apps/docs/content/docs.v6/platform/platform-cli/commands.mdx
+++ /dev/null
@@ -1,268 +0,0 @@
----
-title: Commands
-description: 'Complete reference for Prisma Data Platform CLI commands, including authentication, project management, and database operations.'
-displayed_sidebar: platformSidebar
-url: /v6/platform/platform-cli/commands
-metaTitle: 'Platform CLI: Commands'
-metaDescription: 'Complete reference for Prisma Data Platform CLI commands, including authentication, project management, and database operations.'
----
-
-This document describes the Prisma Data Platform's integrated Prisma CLI commands, arguments, and options.
-
-## Getting started
-
-To get started, ensure you have the [Prisma CLI](/v6/orm/tools/prisma-cli) updated to version `5.10.0` or later. This is necessary to access the Platform through the Prisma CLI.
-
-:::info
-
-💡 When using commands, always start with `prisma platform` and include the `--early-access` flag to enable the use of the Prisma Data Platform whilst still in early access.
-
-:::
-
-## Authentication
-
-### `platform`
-
-#### `auth login`
-
-Opens a browser window that allows you to log into your Prisma Data Platform account or create a new one. Currently, GitHub is the only supported login method. We do have plan to add support for signing in with Google and email/password.
-
-```npm
-npx prisma platform auth login --early-access
-```
-
-#### `auth logout`
-
-Logs out of your Prisma Data Platform account.
-
-```npm
-npx prisma platform auth logout --early-access
-```
-
-#### `auth show`
-
-Displays information about the currently authenticated user.
-
-```npm
-npx prisma platform auth show --early-access
-```
-
-### Workspace Management
-
-### `platform`
-
-#### `workspace show`
-
-Lists all workspaces available to your account.
-
-```npm
-npx prisma platform workspace show --early-access
-```
-
-### Project Management
-
-### `platform`
-
-#### `project show`
-
-Lists all projects within the specified workspace.
-
-```npm
-npx prisma platform project show \
---workspace $INSERT_WORKSPACE_ID \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| ------------------ | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
-| `--workspace` `-w` | `string` | yes | The workspace id.
**Hint:** You can view your workspace ids with the [`workspace show`](#workspace-show) command. |
-
-#### `project create`
-
-Creates a new project within the specified workspace.
-
-```npm
-npx prisma platform project create \
---workspace $INSERT_WORKSPACE_ID \
---name "INSERT_PROJECT_NAME" \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| ------------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
-| `--workspace` `-w` | `string` | yes | The workspace `id`.
**Hint:** You can view your workspace ids with the [`workspace show`](#workspace-show) command. |
-| `--name` `-n` | `string` | no | The display name for the project.
If omitted, a default project name will be generated for you. |
-
-#### `project delete`
-
-Deletes the specified project.
-
-```npm
-npx prisma platform project delete \
---project $INSERT_PROJECT_ID \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| ---------------- | -------- | -------- | --------------------------------------------------------------------------------------------------------------------- |
-| `--project` `-p` | `string` | yes | The project `id`.
**Hint:** You can view your project ids with the [`project show`](#project-show) command. |
-
-### Environment Management
-
-### `platform`
-
-#### `environment show`
-
-Lists all environments within the specified project.
-
-```npm
-npx prisma platform environment show \
---project $INSERT_PROJECT_ID \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| ---------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
-| `--project` `-p` | `string` | yes | The project `id`.
**Hint:** You can view your project ids with the [`project show`](#project-show) command. |
-
-#### `environment create`
-
-Creates a new environment within the specified project.
-
-```npm
-npx prisma platform environment create \
---project $INSERT_PROJECT_ID \
---name $INSERT_ENVIRONMENT_NAME \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| ---------------- | -------- | -------- | --------------------------------------------------------------------------------------------------------------------- |
-| `--project` `-p` | `string` | yes | The project `id`.
**Hint:** You can view your project ids with the [`project show`](#project-show) command. |
-| `--name` `-n` | `string` | no | The display name for the environment.
If omitted, a default environment name will be generated for you. |
-
-#### `environment delete`
-
-Deletes the specified environment.
-
-```npm
-npx prisma platform environment delete \
---environment $INSERT_ENVIRONMENT_ID \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| -------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
-| `--environment` `-e` | `string` | yes | The environment `id`.
**Hint:** You can view your environment ids with the [`environment show`](#environment-show) command. |
-
-### API Key Management
-
-### `platform`
-
-#### `apikey show`
-
-Lists all API keys for the specified environment.
-
-```npm
-npx prisma platform apikey show \
---environment $INSERT_ENVIRONMENT_ID \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| -------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
-| `--environment` `-e` | `string` | yes | The environment `id`.
**Hint:** You can view your environment ids with the [`environment show`](#environment-show) command. |
-
-#### `apikey create`
-
-Creates a new API key for the specified project.
-
-```npm
-npx prisma platform apikey create \
---environment $INSERT_ENVIRONMENT_ID \
---name $INSERT_API_KEY_NAME \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| -------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
-| `--environment` `-e` | `string` | yes | The environment `id`.
**Hint:** You can view your environment ids with the [`environment show`](#environment-show) command. |
-| `--name` `-n` | `string` | no | The display name for the API key.
If omitted, a default API key name will be generated for you. |
-
-#### `apikey delete`
-
-Deletes the specified API Key.
-
-```npm
-npx prisma platform apikey delete \
---apikey $INSERT_API_KEY_ID \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| ---------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
-| `--apikey` | `string` | yes | The API key `id`.
**Hint**: You can view your API key ids with the [`apikey show`](#apikey-show) command. |
-
-### Prisma Accelerate
-
-### `platform`
-
-#### `accelerate enable`
-
-Enables Prisma Accelerate for the specified environment.
-
-```npm
-npx prisma platform accelerate enable \
---environment $INSERT_ENVIRONMENT_ID \
---url "postgresql://username:password@host:port/database" \
---region $INSERT_CONNECTION_POOL_REGION \
---apikey true \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| -------------------- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `--environment` `-e` | `string` | yes | The environment `id`.
**Hint:** You can view your environment ids with the [`environment show`](#environment-show) command. |
-| `--url` | `string` | yes | Your database connection string. |
-| `--region` | `string` | no | The region for Prisma Accelerate’s managed connection pool.
View the list of available regions [here](/v6/accelerate/faq#what-regions-is-accelerates-connection-pool-available-in).
**Hint**: Select the region _nearest_ your database for optimal latency. |
-| `--apikey` | `boolean` | no | If yes, a new API key will be generated for the associated environment. |
-
-#### `accelerate disable`
-
-Disables Prisma Accelerate for the specified environment.
-
-```npm
-npx prisma platform accelerate disable \
---environment $INSERT_ENVIRONMENT_ID \
---early-access
-```
-
-##### Arguments
-
-| Argument | Type | Required | Description |
-| -------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
-| `--environment` `-e` | `string` | yes | The environment `id`.
**Hint:** You can view your environment ids with the [`environment show`](#environment-show) command. |
-
-## Help
-
-Have a question? Let us know, we’re here to help. Reach out to us on [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=generated_text_cta).
diff --git a/apps/docs/content/docs.v6/platform/platform-cli/meta.json b/apps/docs/content/docs.v6/platform/platform-cli/meta.json
deleted file mode 100644
index 240bf2a173..0000000000
--- a/apps/docs/content/docs.v6/platform/platform-cli/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Platform CLI",
- "defaultOpen": true,
- "pages": ["about", "commands"]
-}
diff --git a/apps/docs/content/docs.v6/platform/support.mdx b/apps/docs/content/docs.v6/platform/support.mdx
deleted file mode 100644
index 073426e855..0000000000
--- a/apps/docs/content/docs.v6/platform/support.mdx
+++ /dev/null
@@ -1,39 +0,0 @@
----
-title: Support
-description: Find the right support for any Console question.
-displayed_sidebar: platformSidebar
-url: /v6/platform/support
-metaTitle: 'Console: Support'
-metaDescription: Find the right support for any Console question.
----
-
-Your feedback is invaluable, and we encourage you to share your experiences with us on [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=intro_text).
-
-## Support
-
-Your support options are based on your workspace's active plan. For more details, take a look at our [pricing page](https://www.prisma.io/pricing).
-
-### Community support
-
-Reach out to us in our [Discord](https://pris.ly/discord?utm_source=docs&utm_medium=inline_text).
-
-### Standard support
-
-- Email support, [support@prisma.io](mailto:support@prisma.io), or reach out via the Console
-- 2 business days, Mon-Fri, 9am-5pm CET
-
-### Premium support
-
-- Email support, [support@prisma.io](mailto:support@prisma.io), or reach out via the Console
-- 1 business hour, Mon-Fri, 9am-5pm CET
-
-### Dedicated support
-
-Dedicated contact person.
-
-## Deleting your PDP account
-
-If you want to delete your PDP account, **email us at [support@prisma.io](mailto:support@prisma.io)** specifying the email id or GitHub handle with which you signed up.
-
-To ensure that you're not accidentally disabling any infrastructure powering one of your applications, we require that you **disable Accelerate in _all_ environments of _all_ your projects** that live in the account to be deleted.
-Additionally there should be no active subscriptions in the account to be deleted. Please cancel any active subscriptions before requesting account deletion.
diff --git a/apps/docs/content/docs.v6/postgres/database/api-reference/error-reference.mdx b/apps/docs/content/docs.v6/postgres/database/api-reference/error-reference.mdx
deleted file mode 100644
index 8da6455770..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/api-reference/error-reference.mdx
+++ /dev/null
@@ -1,124 +0,0 @@
----
-title: Error reference
-description: Error reference documentation for Prisma Postgres.
-url: /v6/postgres/database/api-reference/error-reference
-metaTitle: 'Prisma Postgres: Error Reference'
-metaDescription: Error reference documentation for Prisma Postgres.
----
-
-When working with Prisma Postgres, you may encounter errors often highlighted by specific error codes during development and operations.
-
-It is important to understand the meaning of these errors, why they occur, and how to resolve them in order to ensure the smooth operation of your applications. This guide aims to provide insights and steps to troubleshoot specific error codes encountered with Prisma Postgres.
-
-## [`P6009`](/v6/orm/reference/error-reference#p6009-responsesizelimitexceeded) (`ResponseSizeLimitExceeded`)
-
-This error is triggered when the response size from a database query exceeds [the configured query response size limit](/v6/postgres/database/connection-pooling#response-size-limit). We've implemented this restriction to safeguard your application performance, as retrieving data over `5MB` can significantly slow down your application due to multiple network layers.
-
-Typically, transmitting more than `5MB` of data is common when conducting ETL (Extract, Transform, Load) operations. However, for other scenarios such as transactional queries, real-time data fetching for user interfaces, bulk data updates, or aggregating large datasets for analytics outside of ETL contexts, it should generally be avoided. These use cases, while essential, can often be optimized to work within [the configured query response size limit](/v6/postgres/database/connection-pooling#response-size-limit), ensuring smoother performance and a better user experience.
-
-### Possible causes for [`P6009`](/v6/orm/reference/error-reference#p6009-responsesizelimitexceeded)
-
-#### Transmitting images/files in response
-
-This error may arise if images or files stored within your table are being fetched, resulting in a large response size. Storing assets directly in the database is generally discouraged because it significantly impacts database performance and scalability. In addition to performance, it makes database backups slow and significantly increases the cost of storing routine backups.
-
-**Suggested solution:** Configure the [query response size limit](/v6/postgres/database/connection-pooling#response-size-limit) to be larger. If the limit is still exceeded, consider storing the image or file in a BLOB store like [Cloudflare R2](https://developers.cloudflare.com/r2/), [AWS S3](https://aws.amazon.com/pm/serv-s3/), or [Cloudinary](https://cloudinary.com/). These services allow you to store assets optimally and return a URL for access. Instead of storing the asset directly in the database, store the URL, which will substantially reduce the response size.
-
-#### Over-fetching of data
-
-In certain cases, a large number of records or fields are unintentionally fetched, which results in exceeding [the configured query response size limit](/v6/postgres/database/connection-pooling#response-size-limit). This could happen when [the `where` clause](/v6/orm/reference/prisma-client-reference#where) in the query is incorrect or entirely missing.
-
-**Suggested solution:** Configure the [query response size limit](/v6/postgres/database/connection-pooling#response-size-limit) to be larger. If the limit is still exceeded, double-check that the `where` clause is filtering data as expected. To prevent fetching too many records, consider using [pagination](/v6/orm/prisma-client/queries/pagination). Additionally, use the [`select`](/v6/orm/reference/prisma-client-reference#select) clause to return only the necessary fields, reducing the response size.
-
-#### Fetching a large volume of data
-
-In many data processing workflows, especially those involving ETL (Extract-Transform-Load) processes or scheduled CRON jobs, there's a need to extract large amounts of data from data sources (like databases, APIs, or file systems) for analysis, reporting, or further processing. If you are running an ETL/CRON workload that fetches a huge chunk of data for analytical processing then you might run into this limit.
-
-**Suggested solution:** Configure the [query response size limit](/v6/postgres/database/connection-pooling#response-size-limit) to be larger. If the limit is exceeded, consider splitting your query into batches. This approach ensures that each batch fetches only a portion of the data, preventing you from exceeding the size limit for a single operation.
-
-## [`P6004`](/v6/orm/reference/error-reference#p6004-querytimeout) (`QueryTimeout`)
-
-This error occurs when a database query fails to return a response within [the configured query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit). The query timeout limit includes the duration of waiting for a connection from the pool, network latency to the database, and the execution time of the query itself. We enforce this limit to prevent unintentional long-running queries that can overload system resources.
-
-:::info
-
-The time for Prisma Postgres's cross-region networking is excluded from [the configured query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit) limit.
-
-:::
-
-### Possible causes for [`P6004`](/v6/orm/reference/error-reference#p6004-querytimeout)
-
-This error could be caused by numerous reasons. Some of the prominent ones are:
-
-#### High traffic and insufficient connections
-
-If the application is receiving very high traffic and there are not a sufficient number of connections available to the database, then the queries would need to wait for a connection to become available. This situation can lead to queries waiting longer than [the configured query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit) for a connection, ultimately triggering a timeout error if they do not get serviced within this duration.
-
-**Suggested solution**: Review and possibly increase the `connection_limit` specified in the connection string parameter when setting up Accelerate in a platform environment ([reference](/v6/postgres/database/connection-pooling#configuring-the-connection-pool-size)). This limit should align with your database's maximum number of connections.
-
-By default, the connection limit is set to 10 unless a different `connection_limit` is specified in your database connection string.
-
-#### Long-running queries
-
-Queries may be slow to respond, hitting [the configured query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit) even when connections are available. This could happen if a very large amount of data is being fetched in a single query or if appropriate indexes are missing from the table.
-
-**Suggested solution**: Configure the [query timeout limit](/v6/postgres/database/connection-pooling#query-timeout-limit) to be larger. If the limit is exceeded, identify the slow-running queries and fetch only the necessary data. Use the `select` clause to retrieve specific fields and avoid fetching unnecessary data. Additionally, consider adding appropriate indexes to improve query efficiency. You might also isolate long-running queries into separate environments to prevent them from affecting transactional queries.
-
-#### Database resource contention
-
-A common yet challenging issue is when other services operating on the same database perform heavy analytics or data processing tasks, significantly consuming database resources. These operations can monopolize database connections and processing power, leading to a scenario where even simple queries cannot be executed in a timely manner. This "busy" or "noisy" database environment can cause queries that are typically fast to run slowly or even timeout, particularly during periods of high activity from other services.
-
-Users often rely on CPU and memory usage metrics to gauge database load, which can be misleading. While these are important indicators, they might not fully represent the database's operational state. Direct metrics like the number of reads, writes, and wait times offer a clearer view of the database's performance and should be monitored closely. A noticeable degradation in these metrics, especially in the absence of changes to the queries or data model, suggests that external pressures are affecting database performance.
-
-**Suggested solution**: If normally quick queries are intermittently slow or timing out without any modifications to them, it's probable that competing queries are exerting pressure on the same database tables. To diagnose this, adopt monitoring tools or leverage your database's inherent capabilities to observe reads, writes, and wait times. Such monitoring will unveil activity patterns or spikes that align with the observed performance dips.
-
-Moreover, it's crucial to periodically scrutinize and refine essential queries and verify that tables are properly indexed. This proactive approach minimizes the vulnerability of these queries to slowdowns caused by competing workloads.
-
-## [`P6008`](/v6/orm/reference/error-reference#p6008-connectionerrorenginestarterror) (`ConnectionError|EngineStartError`)
-
-This error indicates that Prisma ORM cannot establish a connection to your Prisma Postgres database, potentially due to several reasons.
-
-### Possible causes for [`P6008`](/v6/orm/reference/error-reference#p6008-connectionerrorenginestarterror)
-
-#### Unreachable Database Host/Port
-
-If the database's server address (hostname) and port are incorrect or unreachable then you may encounter this error.
-
-**Suggested solution:** Verify the hostname/port of the database connection string that was provided while creating the project. Additionally, attempt to connect to the database using a Database GUI tool (e.g., [Prisma Studio](https://www.prisma.io/studio), [TablePlus](https://tableplus.com/), or [DataGrip](https://www.jetbrains.com/datagrip/)) for further investigation.
-
-#### Incorrect username/password/database name
-
-This error can happen when the wrong credentials are provided, preventing it from establishing a connection to your database.
-
-**Suggested solution:** Verify the correctness of your database's username, password, and name in the connection string provided to Prisma Postgres. Ensure that these credentials match those required by your database. Testing the connection using a direct database GUI tool can also help in confirming if the provided credentials are correct.
-
-## [`P5011`](/v6/orm/reference/error-reference#p5011-too-many-requests) (`TooManyRequests`)
-
-This error occurs when Prisma Postgres detects a high volume of requests that surpasses allowable thresholds. It acts as a protective measure to safeguard both Prisma Postgres and your underlying database from excessive load.
-
-### Possible causes for [`P5011`](/v6/orm/reference/error-reference#p5011-too-many-requests)
-
-#### Aggressive retry loops
-
-If your application retries queries immediately or with minimal delay, especially after receiving certain errors, the rapid accumulation of requests can surpass the threshold.
-
-**Suggested solution:**
-
-- Implement an exponential backoff strategy. Rather than retrying immediately or with a fixed delay, gradually increase the delay period after each failed attempt.
-
-#### Sudden traffic spikes
-
-Unpredicted traffic surges (for example, during product launches, flash sales, or viral growth events) can cause the threshold to be met and result into `P5011`.
-
-**Suggested solution:**
-
-- Monitor traffic and resource usage. If you anticipate a surge, please contact [support](/v6/platform/support) for capacity planning and potential configuration adjustments.
-
-#### Prolonged or planned high workloads
-
-Certain processes, such as bulk data imports, ETL operations, or extended CRON jobs, can generate continuous high query volume over time.
-
-**Suggested solution:**
-
-- Use batching or chunking techniques to break large operations into smaller parts.
-- Establish throttling or scheduling to distribute the load more evenly.
diff --git a/apps/docs/content/docs.v6/postgres/database/api-reference/index.mdx b/apps/docs/content/docs.v6/postgres/database/api-reference/index.mdx
deleted file mode 100644
index d3a82b9a39..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/api-reference/index.mdx
+++ /dev/null
@@ -1,8 +0,0 @@
----
-title: API reference
-description: API reference documentation for Prisma Postgres.
-url: /v6/postgres/database/api-reference
-metaTitle: 'Prisma Postgres: API Reference'
-metaDescription: API reference documentation for Prisma Postgres.
----
-
diff --git a/apps/docs/content/docs.v6/postgres/database/backups.mdx b/apps/docs/content/docs.v6/postgres/database/backups.mdx
deleted file mode 100644
index 8c414c06f6..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/backups.mdx
+++ /dev/null
@@ -1,81 +0,0 @@
----
-title: Backups
-description: Learn about backups in Prisma Postgres
-url: /v6/postgres/database/backups
-metaTitle: Backups in Prisma Postgres
-metaDescription: Learn about backups in Prisma Postgres
----
-
-## Overview
-
-On [Pro and Business plans](https://www.prisma.io/pricing), Prisma Postgres automatically creates snapshots of your database to support recovery and backup workflows. Navigate to the **Backups** tab of your Prisma Postgres instance in the [Prisma Console](https://console.prisma.io) to view and re-instantiate your available backups.
-
-Snapshots are created _daily_, but only on days when the database has activity. Depending on your plan, you will see a different number of available snapshots:
-
-| Plan | Snapshot retention |
-| -------- | ------------------ |
-| Pro | Last 7 days |
-| Business | Last 30 days |
-
-Please note that any database changes or events that occurred after the most recent snapshot may not be restored.
-
-For more details about backup availability and plan-specific features, visit our [pricing page](https://www.prisma.io/pricing).
-
-:::note
-In the future, Prisma Postgres will provide more fine-grained backup mechanisms based on user specific configurations and with point-in-time restore functionality.
-:::
-
-## Manually creating a backup file via `pg_dump`
-
-If you would like to create a backup file of your database, you can use `pg_dump` and use a [direct connection](/v6/postgres/database/direct-connections). This is useful for migrating data between databases or creating a local copy of your database.
-
-## Prerequisites
-
-Before you begin, make sure you have:
-
-- **Node.js** installed (version 16 or higher).
-- **PostgreSQL CLI Tools** (`pg_dump`) for creating backups. Use Postgres version 17 as Prisma Postgres is based on this version.
-- A **direct connection string** for your Prisma Postgres database.
-
-## 1. Install PostgreSQL command-line tools
-
-To create backups, ensure you have the PostgreSQL command-line tools installed. Run the following commands based on your operating system:
-
-```bash tab="macOS"
-brew install postgresql@17
-which pg_dump
-which pg_restore
-```
-
-```bash tab="Windows"
-# Download from the official PostgreSQL website:
-# https://www.postgresql.org/download/windows/
-# During installation, select "Command Line Tools".
-# Then verify with:
-
-where pg_dump
-where pg_restore
-```
-
-```bash tab="Linux"
-sudo apt-get update
-sudo apt-get install postgresql-client-17
-which pg_dump
-which pg_restore
-```
-
-:::tip
-If you installed PostgreSQL but still see a “command not found” error for `pg_dump` or `pg_restore`, ensure your installation directory is in your system’s `PATH` environment variable.
-:::
-
-### 2. Creating the Backup with `pg_dump`
-
-Get your direct connection string for Prisma Postgres by following the instructions [here](/v6/postgres/database/direct-connections#how-to-connect-to-prisma-postgres-via-direct-tcp).
-
-You can now dump the database by running the following command and using your own connection string:
-
-```bash
-pg_dump --dbname="postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require" > ./mydatabase.bak
-```
-
-This will create your backup file named `mydatabase.bak` in the current directory.
diff --git a/apps/docs/content/docs.v6/postgres/database/caching.mdx b/apps/docs/content/docs.v6/postgres/database/caching.mdx
deleted file mode 100644
index 34a3192259..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/caching.mdx
+++ /dev/null
@@ -1,297 +0,0 @@
----
-title: Caching queries in Prisma Postgres
-description: Learn about caching queries in Prisma Postgres
-url: /v6/postgres/database/caching
-metaTitle: Caching queries in Prisma Postgres
-metaDescription: Learn about caching queries in Prisma Postgres
----
-
-Prisma Postgres supports built-in query caching to reduce database load and improve query performance. You can configure cache behavior using the `cacheStrategy` option available in all read queries.
-
-This feature is powered by an internal caching layer enabled through [Prisma Accelerate](/v6/accelerate), but you do not need to interact with Accelerate directly unless you're using your own database.
-
-## Setting up caching in Prisma Postgres
-
-To enable query caching in your Prisma Postgres project, you need to configure Accelerate caching and set up the client extension. Follow these steps:
-
-### 1. Enable caching in the Platform Console
-
-1. Go to the [Platform Console](https://console.prisma.io) and navigate to your project dashboard
-2. In the "Connect to your database" section, click **Connect**
-3. Toggle **Enable Accelerate caching** to activate the caching layer
-4. Copy the generated connection string
-
-Your connection string will look like this:
-
-```text
-DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=ey...."
-```
-
-Replace the connection string in your `.env` file with this new Accelerate-enabled URL.
-
-### 2. Install the Accelerate extension
-
-Install the required client extension in your project:
-
-```npm
-npm install @prisma/extension-accelerate
-```
-
-### 3. Configure Prisma Client with caching
-
-Update your Prisma Client setup to use the Accelerate extension:
-
-```ts tab="standard"
-import { PrismaClient } from "../generated/prisma/client";
-import { withAccelerate } from "@prisma/extension-accelerate";
-
-const prisma = new PrismaClient({
- accelerateUrl: process.env.DATABASE_URL,
-}).$extends(withAccelerate());
-```
-
-```ts tab="edge"
-import { PrismaClient } from "@prisma/client/edge";
-import { withAccelerate } from "@prisma/extension-accelerate";
-
-const prisma = new PrismaClient({
- accelerateUrl: process.env.DATABASE_URL,
-}).$extends(withAccelerate());
-```
-
-### 4. Start caching your queries
-
-Once configured, you can add caching to any read query using the `cacheStrategy` option:
-
-```ts
-await prisma.user.findMany({
- cacheStrategy: {
- ttl: 60, // Cache for 60 seconds
- },
-});
-```
-
-Your caching setup is now complete! Continue reading to learn about different cache strategies and how to optimize them for your use case.
-
-## Cache strategies
-
-For all read queries in Prisma Client, you can define the `cacheStrategy` parameter that configures cache behavior. The cache strategy allows you to define two main characteristics of the cache:
-
-- **Time-to-live (TTL):** Duration in seconds a cached response is considered _fresh_.
-- **Stale-while-Revalidating (SWR):** Duration in seconds a stale cache response is considered acceptable while the cache is refreshed in the background
-
-## Time-to-live (TTL)
-
-Time-to-Live (TTL) determines how long cached data is considered fresh. By specifying the `ttl` in seconds, you can control the duration for which data in the cache remains valid. When a read query is executed, if the cached response is within the `ttl` limit, Prisma Client retrieves the data from the cache without querying the database. If the cached data is not available or has expired, Prisma Client queries the database and stores the results in the cache for future requests.
-
-Use `ttl` in `cacheStrategy` and specify the TTL of the query in seconds:
-
-```javascript
-await prisma.user.findMany({
- cacheStrategy: {
- ttl: 60, // [!code ++]
- },
-});
-```
-
-With a specified TTL of 60 seconds, the majority of requests will result in
-a cache hit throughout the TTL duration:
-
-
-
-TTL is useful for reducing database load and latency for data that does not require frequent updates.
-
-### Invalidate the TTL and keep your cached query results up-to-date
-
-If your application requires real-time or near-real-time data, cache invalidation ensures that users see the most current data, even when using a large `ttl` (Time-To-Live). By invalidating your cache, you can bypass extended caching periods to show live data whenever it's needed.
-
-For example, if a dashboard displays customer information and a customer’s contact details change, TTL (Time-To-Live) settings ensure the cache automatically expires after a set duration. This allows the system to refresh only the updated data at the next access, ensuring support staff always see the latest information without manually refreshing the cache.
-
-However, in cases where immediate updates are required before the TTL expires, cache invalidation allows the system to proactively clear specific data from the cache. This forces a refresh of the updated information instantly, so support staff always have the most current details without waiting for the TTL to trigger.
-
-To invalidate a cached query result, you can add tags and then use the `$accelerate.invalidate` API.
-
-:::note
-
-On-demand cache invalidation is available with our paid plans. For more details, please see our [pricing](https://www.prisma.io/pricing#accelerate).
-
-:::
-
-To invalidate the query below, you need to provide the cache tag in the `$accelerate.invalidate` API:
-
-```ts
-await prisma.user.findMany({
- cacheStrategy: {
- ttl: 60,
- tags: ["findMany_users"], // [!code ++]
- },
-});
-
-// This is how you would invalidate the cached query above.
-await prisma.$accelerate.invalidate({
- // [!code ++]
- tags: ["findMany_users"], // [!code ++]
-}); // [!code ++]
-```
-
-## Stale-While-Revalidate (SWR)
-
-Stale-While-Revalidate (SWR) allows you to control how long Prisma Postgres can serve stale cache data while fetching fresh data in the background. When a read query is executed, Prisma Postgres checks the age of the cached response against the `swr` duration. If the cache data is within the `swr` limit, Prisma Postgres serves the stale data while simultaneously refreshing the cache by fetching the latest data from the database.
-
-Use `swr` in `cacheStrategy` and specify the SWR of the query in seconds:
-
-```javascript
-await prisma.user.findMany({
- cacheStrategy: {
- swr: 60, // [!code ++]
- },
-});
-```
-
-When specifying a SWR of 60 seconds, the cache serves stale data until the cache refreshes itself in the background after each request:
-
-
-
-### Invalidate the SWR and keep your cached query results up-to-date
-
-If your application requires real-time or near-real-time data, cache invalidation ensures that users see the most current data, even when using a large `swr` (Stale-While-Revalidate). By invalidating your cache, you can bypass extended caching periods to show live data whenever it's needed.
-
-For example, consider a dashboard that displays stock levels for products in a warehouse. With SWR (Stale-While-Revalidate) settings, the dashboard can immediately display the last known stock data, even if it’s slightly outdated, while new data is fetched in the background. This ensures that staff can continue working with recent information without waiting, with the stock levels updating as soon as revalidation completes.
-
-However, in cases where stock data needs to be updated immediately—for instance, if a product is low in stock and the count needs real-time accuracy—cache invalidation allows the system to proactively clear specific data from the cache. This forces a refresh of the latest stock data instantly, so staff always have the most up-to-date information without waiting for SWR to complete the revalidation.
-
-To invalidate a cached query result, you can add tags and then use the `$accelerate.invalidate` API.
-
-:::note
-
-On-demand cache invalidation is available with our paid plans. For more details, please see our [pricing](https://www.prisma.io/pricing#accelerate).
-
-:::
-
-To invalidate the query below, you need to provide the cache tag in the `$accelerate.invalidate` API:
-
-```ts
-await prisma.user.findMany({
- cacheStrategy: {
- swr: 60,
- tags: ["findMany_users"], // [!code ++]
- },
-});
-
-// This is how you would invalidate the cached query above.
-await prisma.$accelerate.invalidate({
- // [!code ++]
- tags: ["findMany_users"], // [!code ++]
-}); // [!code ++]
-```
-
-## Selecting a cache strategy
-
-Caching helps you improve query response times and reduce database load. However, it also means you might serve stale data to the client. Whether or not serving stale data is acceptable and to what extent depends on your use case. `ttl` and `swr` are parameters you can use the tweak the cache behavior.
-
-### Cache strategy using TTL
-
-Use TTL to reduce database load when stale cached data is acceptable.
-
-#### Use case: Product catalog in e-commerce applications
-
-Consider an e-commerce application with a product catalog that doesn't frequently change. By setting a `ttl` of, let's say, 1 hour, Prisma Client can serve cached product data for subsequent user requests within that hour without hitting the database. This significantly reduces the database load and improves the response time for product listing pages.
-
-**When to invalidate:** If there are critical updates to the catalog, such as a major price change or product availability adjustment, the [cache should be invalidated](/v6/postgres/database/caching#on-demand-cache-invalidation) immediately to prevent customers from seeing outdated information.
-
-### Cache strategy using SWR
-
-Use SWR to respond quickly to requests with minimal stale data. While it does not reduce database load, it can improve response times significantly.
-
-#### Use case: User profile in social media platforms
-
-Imagine a social media platform where user profiles are frequently accessed. By leveraging `swr` with a duration of, let's say, 5 minutes, Prisma Postgres can serve the cached user profile information quickly, reducing the latency for profile pages. Meanwhile, in the background, it refreshes the cache after every request, ensuring that any updates made to the profile are eventually reflected for subsequent requests.
-
-**When to invalidate:** If a user makes significant updates to their profile, such as changing their profile picture or bio, the cache should be [invalidated](/v6/postgres/database/caching#on-demand-cache-invalidation) immediately to ensure that followers see the latest updates without waiting for the SWR refresh.
-
-### Cache strategy using TTL + SWR
-
-For very fast response times and reduced database load, use both TTL and SWR. You can use this strategy to fine-tune your application’s tolerance for stale data.
-
-Use `ttl` and `swr` in `cacheStrategy` and specify the TTL and SWR of the query in seconds:
-
-```javascript
-await prisma.user.findMany({
- cacheStrategy: {
- ttl: 30, // [!code ++]
- swr: 60, // [!code ++]
- },
-});
-```
-
-When specifying a TTL of 30 seconds and SWR of 60 seconds, the cache serves fresh data for the initial 30 seconds. Subsequently, it serves stale data until the cache refreshes itself in the background after each request:
-
-
-
-#### Use case: News articles
-
-Consider a news application where articles are frequently accessed but don't require real-time updates. By setting a `ttl` of 2 hours and an `swr` duration of 5 minutes, Prisma Client can serve cached articles quickly, reducing latency for readers. As long as the articles are within the `ttl`, users get fast responses. After the `ttl` expires, Prisma Client continues to serve the stale articles for up to an additional 5 minutes, revalidating the cache with the latest news from the database in response to a new query. This helps maintain a balance between performance and freshness.
-
-**When to invalidate:** If a critical update or breaking news article is published, the cache should be [invalidated](/v6/postgres/database/caching#on-demand-cache-invalidation) immediately to ensure readers see the latest information without delay. This approach is especially useful for applications where certain news items may need to override the normal cache cycle for timeliness.
-
-## On-demand cache invalidation
-
-If your application requires real-time or near-real-time data, cache invalidation ensures that users see the most current data, even when using a large `ttl` (Time-To-Live) or `swr` (Stale-While-Revalidate) [cache strategy](/v6/postgres/database/caching#cache-strategies). By invalidating your cache, you can bypass extended caching periods to show live data whenever it's needed.
-
-You can invalidate the cache using the [`$accelerate.invalidate` API](/v6/accelerate/api-reference#accelerateinvalidate):
-
-:::note
-
-To programmatically invalidate cached queries, a paid plan is required. See our [pricing for more details](https://www.prisma.io/pricing#accelerate).
-
-:::
-
-```ts
-await prisma.user.findMany({
- where: {
- email: {
- contains: "alice@prisma.io",
- },
- },
- cacheStrategy: {
- swr: 60,
- ttl: 60,
- tags: ["emails_with_alice"], // [!code highlight]
- },
-});
-```
-
-You need to provide the cache tag in the `$accelerate.invalidate` API:
-
-```ts
-try {
- await prisma.$accelerate.invalidate({
- // [!code highlight]
- tags: ["emails_with_alice"], // [!code highlight]
- }); // [!code highlight]
-} catch (e) {
- if (e instanceof Prisma.PrismaClientKnownRequestError) {
- // The .code property can be accessed in a type-safe manner
- if (e.code === "P6003") {
- console.log("The cache invalidation rate limit has been reached. Please try again later.");
- }
- }
- throw e;
-}
-```
-
-Explore the [demo app](https://pris.ly/test-cache-invalidation) to see how cached query results in Prisma Postgres are invalidated on demand, shown in a clear timeline.
-
-## Default cache strategy
-
-Prisma Postgres defaults to **no cache** to avoid unexpected issues. While caching can improve performance, incorrect usage may lead to errors.
-
-For instance, if a query is executed on a critical path without specifying a cache strategy, the result may be incorrect, with no clear explanation. This issue often arises when implicit caching is unintentionally left enabled.
-
-To avoid such problems, you must explicitly opt-in to caching. This ensures you are aware that caching is not enabled by default, preventing potential errors.
-
-:::note
-
-When no cache strategy is specified or during a cache miss, the cache layer routes all queries to the database through a connection pool instance near the database region.
-
-:::
diff --git a/apps/docs/content/docs.v6/postgres/database/connection-pooling.mdx b/apps/docs/content/docs.v6/postgres/database/connection-pooling.mdx
deleted file mode 100644
index 357b3e9bad..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/connection-pooling.mdx
+++ /dev/null
@@ -1,134 +0,0 @@
----
-title: Connection pooling
-description: Learn about connection pooling in Prisma Postgres
-url: /v6/postgres/database/connection-pooling
-metaTitle: Connection pooling in Prisma Postgres
-metaDescription: Learn about connection pooling in Prisma Postgres
----
-
-Prisma Postgres provides built-in [connection pooling](https://www.prisma.io/dataguide/database-tools/connection-pooling) without you having to configure anything. The efficient management of database connections allows the database to process more queries without exhausting the available database connections, making your application more scalable.
-
-### Connection pooling in Prisma Postgres
-
-For Prisma Postgres, the connection limit depends on the plan you have signed up for.
-
-| | Free | Starter | Pro | Business |
-| ------------------------- | ---- | ------- | --- | -------- |
-| Connection Limit (Pooled) | 10 | 100 | 500 | 1000 |
-
-You can compare plans on the [Prisma pricing page](https://www.prisma.io/pricing).
-
-### Configuring the connection pool size
-
-If you're not using Prisma Postgres, you can configure the connection pool size for Prisma ORM by specifying it in the connection string.
-
-For Prisma Postgres, the connection limit is currently fixed at 10 and cannot be changed.
-
-If you're using Prisma Accelerate with your own database, you can configure the connection pool size through the Connection limit setting in your project on the Accelerate setup page.
-
-### Connection pool timeout
-
-The connection pool timeout is the maximum number of seconds that a query will block while waiting for a connection from Prisma Postgres's internal connection pool. This occurs if the number of concurrent requests exceeds the connection limit, resulting in queueing of additional requests until a free connection becomes available. An exception is thrown if a free connection does not become available within the pool timeout. The connection pool timeout can be disabled by setting the value to 0.
-
-For example:
-
-```text no-copy
-postgresql://user:password@localhost:5432/db?connection_limit=10&pool_timeout=20
-```
-
-The default value for `pool_timeout` is `10` seconds.
-
-## Configuring query limits
-
-You can configure the minimum and maximum query response size, query duration, and transaction limits when using Prisma Accelerate from the **Settings** tab in your Prisma Postgres project environment.
-
-### Query timeout limit
-
-Prisma Postgres has a default global timeout of `10s` for each query, configurable using the slider labeled **Query duration**, based on your subscription plan:
-
-| Plan | Free | Starter | Pro | Business |
-| ------------- | ------------------ | ------------------ | ------------------ | ------------------ |
-| Query timeout | Up to `10` seconds | Up to `10` seconds | Up to `20` seconds | Up to `60` seconds |
-
-See the [error reference](/v6/postgres/database/api-reference/error-reference#p6004-querytimeout) and our [pricing page](https://www.prisma.io/pricing) for more information.
-
-:::warning
-
-While you can increase the query timeout, it's recommended to inspect and optimize your database queries if they take longer than `10` seconds. This helps reduce stress on your underlying database, as long-running queries often indicate a need for optimization. Learn more in the [error reference](/v6/postgres/database/api-reference/error-reference#p6004-querytimeout).
-:::
-
-### Interactive transactions query timeout limit
-
-Prisma Postgres has a default global timeout of `15s` for each [interactive transaction](/v6/orm/prisma-client/queries/transactions#interactive-transactions), configurable using the slider labeled **Transaction duration**, based on your subscription plan:
-
-| Plan | Free | Starter | Pro | Business |
-| ----------------------------- | ------------------ | ------------------ | ------------------ | ------------------ |
-| Interactive transaction limit | Up to `15` seconds | Up to `15` seconds | Up to `30` seconds | Up to `90` seconds |
-
-See the [error reference](/v6/postgres/database/api-reference/error-reference#p6004-querytimeout) and our [pricing page](https://www.prisma.io/pricing#accelerate) for more information.
-
-When you set a higher interactive transaction timeout in the Prisma Console, you **must also** specify a matching `timeout` value in your interactive transaction query via timeout [transaction option](/v6/orm/prisma-client/queries/transactions#transaction-options). Otherwise, transactions will still time out at the lower default (e.g., 5 seconds limit when no timeout value is specified). Here's an example of how to set a `30`-second timeout in your code:
-
-```ts
-await prisma.$transaction(
- async (tx) => {
- // Your queries go here
- },
- {
- timeout: 30000, // 30s
- },
-);
-```
-
-:::warning
-
-While you can increase the interactive transaction timeout limit, it's recommended to inspect and optimize your database transactions if they take longer than 15 seconds. Long-running transactions can negatively impact performance and often signal the need for optimization. Learn more in the [error reference](/v6/postgres/database/api-reference/error-reference#p6004-querytimeout) and review the [warning in the Interactive Transactions section](/v6/orm/prisma-client/queries/transactions#interactive-transactions-1) in our documentation.
-
-:::
-
-### Response size limit
-
-Prisma Postgres has a default global response size limit of `5MB`, configurable using the slider labeled **Response size**, based on your subscription plan:
-
-| Plan | Free | Starter | Pro | Business |
-| ---------- | ----------- | ----------- | ------------ | ------------ |
-| Query size | Up to `5MB` | Up to `5MB` | Up to `10MB` | Up to `20MB` |
-
-See the [error reference](/v6/postgres/database/api-reference/error-reference#p6009-responsesizelimitexceeded) and our [pricing page](https://www.prisma.io/pricing#accelerate) for more information.
-
-:::warning
-
-While you can increase the query response size, it’s recommended to limit data retrieval to what you actually need. This improves database performance, reduces stress on your database, and makes your frontend applications more responsive. Queries exceeding `5` MB in size often indicate a need for optimization. Learn more in the [error reference](/v6/postgres/database/api-reference/error-reference#p6009-responsesizelimitexceeded).
-
-:::
-
-## Autoscaling (Accelerate + Your own database only)
-
-Autoscaling is currently available **only when using Prisma Accelerate with your own database**. It enables dynamic resource allocation based on your application's traffic. As usage nears the defined connection limit, Prisma will begin provisioning additional resources to handle the load. If traffic continues to grow, the system will scale out further. When traffic decreases, it scales back down—ensuring efficient use of resources.
-
-### How it works
-
-Autoscaling is powered by a **connection pooler** that horizontally scales your environment by distributing total available connections across multiple **Query Engine instances**.
-
-Here’s how this works in practice:
-
-- Suppose your environment’s connection limit is set to `1000`.
-- Prisma Accelerate will scale up to multiple Query Engine instances (e.g., 100 instances).
-- Each instance is allocated a share of the total—**10 connections per instance**, in this example.
-- This is why each Query Engine instance reports a limit of 10, even though the full environment supports 1000 concurrent connections.
-
-This distributed model allows your application to handle increased traffic by spinning up more Query Engine instances, while efficiently managing connection usage.
-
-### Enabling Autoscaling
-
-Autoscaling is automatically enabled **when your Accelerate connection limit is set above the default (10)**. This feature is **not available on the Free or Starter plan**.
-
-Your environment's maximum connection limit is based on your [Prisma Data Platform plan](https://www.prisma.io/pricing):
-
-| Plan | Max Connection Limit |
-| ---------- | ------------------------------------ |
-| Free | `10` |
-| Starter | `10` |
-| Pro | `100` |
-| Business | `1000` |
-| Enterprise | [Contact Us](mailto:sales@prisma.io) |
diff --git a/apps/docs/content/docs.v6/postgres/database/direct-connections.mdx b/apps/docs/content/docs.v6/postgres/database/direct-connections.mdx
deleted file mode 100644
index 2db6b739bd..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/direct-connections.mdx
+++ /dev/null
@@ -1,163 +0,0 @@
----
-title: Direct connections
-description: Learn about connecting directly to your Prisma Postgres database via direct TCP.
-url: /v6/postgres/database/direct-connections
-metaTitle: Direct connections (TCP)
-metaDescription: Learn about connecting directly to your Prisma Postgres database via direct TCP.
----
-
-## Overview
-
-Prisma Postgres is the perfect choice for your applications, whether you connect to it via [Prisma ORM](/v6/orm) or any other ORM, database library / tool of your choice. If you use it with Prisma ORM, Prisma Postgres comes with built-in connection pooling, and an integrated caching layer (powered by [Prisma Accelerate](/v6/accelerate)).
-
-If you connect to it via another tool, you can do so with a [direct connection string](#connection-string) following the conventional PostgreSQL format.
-
-## How to connect to Prisma Postgres via direct TCP
-
-In order to get a direct connection string, you need to:
-
-1. Open a project in your [Prisma Console](https://console.prisma.io) account (or create a new one)
-1. Navigate to your active Prisma Postgres instance.
-1. Click the **Connect to your database** button in your dashboard.
-1. Click the **Generate new connection string** button.
-1. If enabling connection pooling, click the toggle button
-1. Copy the connection string that is generated below.
-
-
-
-## Connection string
-
-### Format
-
-When you connect to Prisma Postgres via direct TCP, your [connection string](/v6/orm/reference/connection-urls) looks as follows:
-
-```bash
-DATABASE_URL="postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require"
-```
-
-The `USER` and `PASSWORD` values are provided when you generate credentials for your Prisma Postgres instance in the [Prisma Console](https://console.prisma.io). Here is an example with sample values:
-
-```bash
-DATABASE_URL="postgres://2f9881cc7eef46f094ac913df34c1fb441502fe66cbe28cc48998d4e6b20336b:sk_QZ3u8fMPFfBzOID4ol-mV@db.prisma.io:5432/?sslmode=require"
-```
-
-### SSL mode
-
-SSL mode is required when connecting to Prisma Postgres via direct TCP, so you need to append `sslmode=require` to your TCP connection string.
-
-## Billing
-
-When using direct TCP to connect to a Prisma Postgres instance, every request is counted as a [billable operation](/v6/postgres/introduction/overview#usage-based-pricing). Learn more on our [pricing page](https://www.prisma.io/pricing).
-
-## Temporary limitations
-
-### Closing idle connections
-
-Prisma Postgres closes idle connections after an extended period of time. If that happens in your application, you can re-open a new connection. (Most database clients re-connect automatically.)
-
-### Connection limit
-
-| | Free | Starter | Pro | Business |
-| -------------------- | ------ | ------- | ------ | -------- |
-| **Connection limit** | Max 10 | Max 10 | Max 50 | Max 100 |
-
-### Query and transaction timeouts
-
-| | Free | Starter | Pro | Business |
-| ------------------------------------ | ---------------- | ---------------- | ---------------- | ---------------- |
-| **Query timeout** | Up to 10 seconds | Up to 10 seconds | Up to 10 seconds | Up to 10 seconds |
-| **Interactive transactions timeout** | Up to 15 seconds | Up to 15 seconds | Up to 15 seconds | Up to 15 seconds |
-
-### Limited user permissions
-
-User permissions are limited to read, write and schema changes. It is not possible to create separate databases, manage users and roles, or perform other administrative actions.
-
-## TCP tunnel (deprecated)
-
-:::warning
-
-The TCP tunnel feature has been **deprecated** in favor of [direct connections](#how-to-connect-to-prisma-postgres-via-direct-tcp). Please use direct connections for all new integrations and migrate existing implementations.
-
-:::
-
-Prisma Postgres can be accessed securely via a TCP tunnel using the [`@prisma/ppg-tunnel`](https://www.npmjs.com/package/@prisma/ppg-tunnel) package, an authentication proxy designed for local database workflows. This package establishes a secure connection to Prisma Postgres through a local TCP server, enabling secure access while automatically handling traffic routing and authentication.
-
-:::note
-
-This is a [Early Access](/v6/platform/maturity-levels#early-access) feature of Prisma Postgres. It is not recommended for production use and is not intended for application-level access.
-
-While in Early Access, usage of the TCP tunnel will be free of charge.
-
-:::
-
-### Prerequisites
-
-- Node.js installed on your machine
-- A [Prisma Postgres](/v6/postgres) database connection string set as an environment variable called `DATABASE_URL`
-
-### Exporting environment variables
-
-The tunnel expects you to have the following `DATABASE_URL` environment variable set to the connection URL of your Prisma Postgres instance. If you are running the tunnel command from your project where an `.env` file has `DATABASE_URL` already set, you can skip this step as the tunnel will automatically pick it up.
-
-To export the `DATABASE_URL` environment variable temporarily in a terminal session:
-
-```bash tab="macOS"
-export DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=API_KEY"
-```
-
-```bash tab="Linux"
-export DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=API_KEY"
-```
-
-```bash tab="Windows"
-set "DATABASE_URL=prisma+postgres://accelerate.prisma-data.net/?api_key=API_KEY"
-```
-
-Replace the `API_KEY` placeholder with the API key value of your Prisma Postgres instance.
-
-### Starting the TCP tunnel
-
-To start the proxy server, run the following command:
-
-```npm
-npx @prisma/ppg-tunnel
-```
-
-```text no-copy wrap
-Prisma Postgres auth proxy listening on 127.0.0.1:52604 🚀
-
-Your connection is authenticated using your Prisma Postgres API key.
-...
-
-==============================
-hostname: 127.0.0.1
-port: 52604
-username:
-password:
-==============================
-```
-
-This will start the tunnel on a randomly assigned TCP port. The proxy automatically handles authentication, so any database credentials are accepted. The tunnel also encrypts traffic, meaning clients should be set to not require SSL.
-
-You can now connect to your Prisma Postgres editor using your favorite PostgreSQL client, e.g. `psql` or a GUI like [TablePlus](/v6/postgres/integrations/viewing-data#2a-connect-to-prisma-postgres-using-tableplus) or [DataGrip](/v6/postgres/integrations/viewing-data#2b-connect-to-prisma-postgres-using-datagrip). To do so, you only need to provide the **`host`** and **`port`** from the output above. The TCP tunnel will handle authentication via the API key in your Prisma Postgres connection URL, so you can omit the values for **`username`** and **`password`.**
-
-### Customizing host and port
-
-By default, the tunnel listens on `127.0.0.1` and assigns a random port. Since it provides access to your Prisma Postgres database, it should only be exposed within a trusted network. You can specify a custom host and port using the `--host` and `--port` flags:
-
-```npm
-npx @prisma/ppg-tunnel --host 127.0.0.1 --port 5432
-```
-
-### Next steps
-
-The local tunnel enables you to access Prisma Postgres from 3rd party database editors such as Postico, DataGrip, TablePlus and pgAdmin. Learn more in this [section](/v6/postgres/integrations/viewing-data).
-
-### Security considerations
-
-When using the TCP tunnel, keep the following in mind:
-
-- The tunnel does not support schema management (i.e., DDL queries outside of Prisma Migrate).
-- The tunnel should not be exposed to untrusted networks.
-- Always store API keys securely and avoid hardcoding them.
-- Ensure that only necessary users have direct access to the Prisma Postgres database.
diff --git a/apps/docs/content/docs.v6/postgres/database/local-development.mdx b/apps/docs/content/docs.v6/postgres/database/local-development.mdx
deleted file mode 100644
index 750a74815b..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/local-development.mdx
+++ /dev/null
@@ -1,281 +0,0 @@
----
-title: Local development with Prisma Postgres
-description: Guide to setting up local development using Prisma Postgres (Early Access)
-badge: preview
-url: /v6/postgres/database/local-development
-metaTitle: Local development with Prisma Postgres (Early Access)
-metaDescription: Guide to setting up local development using Prisma Postgres (Early Access)
----
-
-[Prisma Postgres](/v6/postgres) is a production-grade, cloud-native database and is ideal for staging and production environments. For rapid iteration and isolated testing, you can run a _local_ Prisma Postgres instance (powered by [PGlite](https://pglite.dev)) via the `prisma dev` command. This page explains how to install and launch a local Prisma Postgres database.
-
-Local Prisma Postgres is in [Preview](/v6/orm/more/releases#preview) and is being actively developed.
-
-## Setting up local development for Prisma Postgres
-
-Follow these steps to set up local Prisma Postgres for development.
-
-Node.js v20 or later is required for local Prisma Postgres
-
-### 1. Launching local Prisma Postgres
-
-Navigate into your project and start the local Prisma Postgres server using the following command:
-
-```npm
-npx prisma dev
-```
-
-This starts a local Prisma Postgres server that you can connect to using Prisma ORM or another tool. The output of the command looks like this:
-
-```text
-$ npx prisma dev
-✔ Great Success! 😉👍
-
- Your prisma dev server default is ready and listening on ports 63567-63569.
-
-╭──────────────────────────────╮
-│[q]uit [h]ttp url [t]cp urls│
-╰──────────────────────────────╯
-```
-
-Now hit:
-
-- q to quit
-- h to view the connection URL enabling connections via **Prisma ORM**
-- t to view the connection URL enabling connections via **any tool**
-
-If you want to connect via Prisma ORM, hit h on your keyboard, copy the `DATABASE_URL` and store it in your `.env` file. This will be used to connect to the local Prisma Postgres server:
-
-```bash title=".env"
-DATABASE_URL="prisma+postgres://localhost:51213/?api_key=__API_KEY__"
-```
-
-Keep the local Prisma Postgres server running in the background while you work on your application.
-
-### 2. Applying migrations and seeding data
-
-Then in a separate terminal tab, run the `prisma migrate dev` command to create the database and run the migrations:
-
-```npm
-npx prisma migrate dev
-```
-
-:::note
-
-Make sure the local Prisma Postgres server is running before running the `prisma migrate dev` command.
-
-If you must use a different port, append [`--port `](/v6/orm/reference/prisma-cli-reference#dev) (for example, `npx prisma migrate dev --port 5422`) and update your `DATABASE_URL` (or other connection settings) to match.
-
-:::
-
-This will create the database and run the migrations.
-
-If you have a seeder script to seed the database, you should also run it in this step.
-
-### 3. Running your application locally
-
-Start your application's development server. You can now perform queries against the local Prisma Postgres instance using Prisma ORM.
-
-To transition to production, you only need to update the database URL in the `.env` file with a Prisma Postgres connection url without additional application logic changes.
-
-## Using different local Prisma Postgres instances
-
-You can target a specific, local Prisma Postgres instance via the `--name` (`-n`) option of the `prisma dev` command, for example:
-
-```npm
-npx prisma dev --name="mydb1"
-```
-
-Whenever you pass the `--name="mydb1"` to `prisma dev`, the command will return the same connection string pointing to a local instance called `mydb1`. This creates a named instance that you can later manage using the instance management commands.
-
-## Starting existing Prisma Postgres instances in the background
-
-You can start existing Prisma Postgres instances in the background using:
-
-```npm
-npx prisma dev start
-```
-
-:::note
-
-The `dev start` command only works with instances that already exist.
-
-:::
-
-`` is a placeholder for a glob pattern to specify which local Prisma Postgres instances should be started, for example:
-
-```npm
-npx prisma dev start mydb # starts a DB called `mydb` in the background (only if it already exists)
-```
-
-To start all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`), you can use a glob:
-
-```npm
-npx prisma dev start mydb* # starts all existing DBs starting with `mydb`
-```
-
-This command enables you to manage Prisma Postgres instances outside of the VS Code extension, allowing for background instance management in your development workflow.
-
-## Listing Prisma Postgres instances
-
-You can view all your local Prisma Postgres instances using:
-
-```npm
-npx prisma dev ls
-```
-
-This command lists all available instances on your system, showing their current status and configuration.
-
-## Stopping Prisma Postgres instances
-
-You can stop a running Prisma Postgres instance with this command:
-
-```npm
-npx prisma dev stop
-```
-
-`` is a placeholder for a glob pattern to specify which local Prisma Postgres instances should be stopped, for example:
-
-```npm
-npx prisma dev stop mydb # stops a DB called `mydb`
-```
-
-To stop all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`), you can use a glob:
-
-```npm
-npx prisma dev stop mydb* # stops all DBs starting with `mydb`
-```
-
-:::note
-
-The `stop` command is interactive and includes safety prompts to prevent accidental operations. You'll be asked to confirm the action by typing a confirmation phrase.
-
-:::
-
-## Removing Prisma Postgres instances
-
-Prisma Postgres saves the information and data from your local Prisma Postgres instances on your file system. To remove any trace from a database that's not in use any more, you can run the following command:
-
-```npm
-npx prisma dev rm
-```
-
-`` is a placeholder for a glob pattern to specify which local Prisma Postgres instances should be removed, for example:
-
-```npm
-npx prisma dev rm mydb # removes a DB called `mydb`
-```
-
-To stop all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`), you can use a glob:
-
-```npm
-npx prisma dev rm mydb* # removes all DBs starting with `mydb`
-```
-
-:::note
-
-The `rm` command is interactive and includes safety prompts to prevent accidental data loss. You'll be asked to confirm the action by typing a confirmation phrase that hints at the risks involved.
-
-:::
-
-## Using local Prisma Postgres with any ORM
-
-Local Prisma Postgres supports [direct TCP connections](/v6/postgres/database/direct-connections), allowing you to connect to it via any tool.
-
-In order to connect to your local Prisma Postgres instance, use the `postgres://` connection string that's returned by `prisma dev`.
-
-## Managing local Prisma Postgres instances via the Prisma VS Code extension
-
-The [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) has a dedicated UI managing Prisma Postgres instances.
-
-To use it, install the VS Code extension and find the **Prisma logo** in the activity bar of your VS Code editor. It enables the following workflows:
-
-- creating and deleting databases
-- starting and stopping the server for a particular database
-- "push to cloud": move a database from local to remote
-
-## Manage local Prisma Postgres programmatically
-
-You can start and stop a local Prisma Postgres server from Node.js without invoking the CLI. This uses undocumented, unstable APIs from `@prisma/dev` and may change without notice. Use it at your own risk. It’s especially useful for integration tests that need an ephemeral local database per test or suite.
-
-This is a complete runnable example that will print `[{abba: 1}]` when run:
-
-```ts
-import { Client } from "pg";
-import { unstable_startServer } from "@prisma/dev";
-import { getPort } from "get-port-please";
-
-async function startLocalPrisma(name: string) {
- const port = await getPort();
-
- return await unstable_startServer({
- name, // required, use a unique name if running tests in parallel
- port, //optional, defaults to 51213
- databasePort: port + 1, // optional, defaults to 51214
- shadowDatabasePort: port + 2, // optional, defaults to 51215
- persistenceMode: "stateless", // optional, defaults to 'stateless'. Use 'stateful' to persist data between runs
- });
-}
-
-// Usage in tests
-const server = await startLocalPrisma(`my-tests-${Date.now()}`);
-try {
- const client = new Client({
- connectionString: server.database.connectionString,
- });
- await client.connect();
-
- const res = await client.query(`SELECT 1 as "abba"`);
- console.log(res.rows);
-
- client.end();
-} finally {
- await server.close!();
-}
-```
-
-### API Arguments
-
-The `unstable_startServer()` function accepts the following options:
-
-| **Argument** | **Required** | **Description** | **Default** |
-| ------------------------ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------- | ------------- |
-| **`name`** | ✅ | Unique identifier for the local Prisma Postgres instance. Use distinct names if running multiple servers in parallel. | — |
-| **`port`** | ❌ | Port for the Prisma engine server. Throws an error if the port is already in use. | `51213` |
-| **`databasePort`** | ❌ | Port for the embedded PostgreSQL database. Used for all Prisma ORM connections. | `51214` |
-| **`shadowDatabasePort`** | ❌ | Port for the shadow database used during migrations. | `51215` |
-| **`persistenceMode`** | ❌ | Defines how data is persisted: • `'stateless'` — no data is retained between runs • `'stateful'` — data persists locally | `'stateless'` |
-
-:::tip
-
-You can dynamically choose available ports using libraries like [`get-port-please`](https://www.npmjs.com/package/get-port-please) to avoid conflicts when running multiple instances.
-
-:::
-
-Notes:
-
-- Allocate unique ports and `name` values when running tests concurrently.
-- Use `server.database.connectionString` to connect with Postgres clients or ORMs.
-- This pattern is great for running tests that require a local database.
-
-## Known limitations
-
-### Caching is mocked locally
-
-[Prisma Postgres caching](/v6/postgres/database/caching) is simulated locally. Queries always directly interact with the local Prisma Postgres instance, bypassing cache configurations:
-
-```typescript
-const users = await prisma.user.findMany({
- cache: { ttl: 60 },
-});
-```
-
-Caching works normally when you're using Prisma Postgres in staging and production.
-
-### Single connection only
-
-The local Prisma Postgres database server accepts one connection at a time. Additional connection attempts queue until the active connection closes. This constraint is sufficient for most local development and testing scenarios.
-
-### No HTTPS connections
-
-The local Prisma Postgres server doesn't use HTTPS. We advise against self-hosting it.
diff --git a/apps/docs/content/docs.v6/postgres/database/meta.json b/apps/docs/content/docs.v6/postgres/database/meta.json
deleted file mode 100644
index 29a8bcbfd8..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/meta.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "title": "Database",
- "pages": [
- "caching",
- "connection-pooling",
- "direct-connections",
- "backups",
- "postgres-extensions",
- "serverless-driver",
- "local-development",
- "prisma-studio"
- ]
-}
diff --git a/apps/docs/content/docs.v6/postgres/database/postgres-extensions.mdx b/apps/docs/content/docs.v6/postgres/database/postgres-extensions.mdx
deleted file mode 100644
index 02dc0db762..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/postgres-extensions.mdx
+++ /dev/null
@@ -1,223 +0,0 @@
----
-title: Postgres extensions
-description: Learn about using Postgres extensions with Prisma Postgres
-badge: early-access
-url: /v6/postgres/database/postgres-extensions
-metaTitle: Postgres extensions
-metaDescription: Learn about using Postgres extensions with Prisma Postgres
----
-
-## Overview
-
-Prisma Postgres supports [PostgreSQL extensions](https://www.postgresql.org/docs/current/sql-createextension.html), such as:
-
-- [`pgvector`](https://github.com/pgvector/pgvector)
-- [`citext`](https://www.postgresql.org/docs/current/citext.html)
-- [`pg_trgm`](https://www.postgresql.org/docs/current/pgtrgm.html)
-- [`fuzzystrmatch`](https://www.postgresql.org/docs/current/fuzzystrmatch.html)
-- [`pg_search`](https://pgxn.org/dist/pg_search)
-- [`pgcrypto`](https://www.postgresql.org/docs/current/pgcrypto.html)
-- [`contrib`](https://www.postgresql.org/docs/current/contrib.html) extensions
-
-See below for a [full list of supported extensions](#all-supported-extensions).
-
-If there are specific extensions you'd like to see in Prisma Postgres, [fill out this form](https://pris.ly/i-want-extensions).
-
-:::warning
-
-Postgres extensions support in Prisma Postgres is currently in [Early Access](/v6/platform/maturity-levels#early-access) and not yet recommended for production scenarios.
-
-:::
-
-## Using extensions with Prisma ORM
-
-Some extensions may already be supported by Prisma Postgres but not yet by Prisma ORM. Native support for some Postgres extensions in Prisma ORM is coming soon. In the meantime, you can still use these extensions with Prisma ORM by using [customized migrations](/v6/orm/prisma-migrate/workflows/customizing-migrations) and [TypedSQL](/v6/orm/prisma-client/using-raw-sql/typedsql) (or another mechanism to send [raw SQL](/v6/orm/prisma-client/using-raw-sql) via in Prisma ORM).
-
-Let's walk through an example with `pgvector`.
-
-### 1. Create an empty migration file
-
-To customize a migration, first create an empty migration file:
-
-```npm
-npx prisma migrate dev --name add-pgvector --create-only
-```
-
-Notice the `--create-only` flag which will create an empty migration file in your migrations directory.
-
-### 2. Create and use the extension in your migration file
-
-In the empty migration file, you can write any custom SQL to be executed in the database:
-
-```sql
--- prisma/migrations/-add-pgvector/migration.sql
-CREATE EXTENSION IF NOT EXISTS vector;
-
-CREATE TABLE "Document" (
- id SERIAL PRIMARY KEY,
- title TEXT NOT NULL,
- embedding VECTOR(4) -- use 4 for demo purposes; real-world values are much bigger
-);
-```
-
-In this case, you:
-
-- install the `pgvector` extension in your database using the `CREATE EXTENSION` statement
-- create a `Document` table that uses the `VECTOR` type from that extension
-
-### 3. Execute the migration against the database
-
-Run the following command to execute the migration and apply its changes in your database:
-
-```npm
-npx prisma migrate deploy
-```
-
-This command will apply the pending `prisma/migrations/-add-pgvector/migration.sql` migration and create the `Document` table in your database.
-
-### 4. Pull the document table into your Prisma schema
-
-Introspect the database schema with the new `Document` table and update your Prisma schema with it:
-
-```npm
-npx prisma db pull
-```
-
-```
-Environment variables loaded from .env
-Prisma schema loaded from prisma/schema.prisma
-Datasource "db": PostgreSQL database "postgres", schema "public" at "accelerate.prisma-data.net"
-
-✔ Introspected 3 models and wrote them into prisma/schema.prisma in 3.23s
-
-*** WARNING ***
-
-These fields are not supported by Prisma Client, because Prisma currently does not support their types:
- - Model: "Document", field: "embedding", original data type: "vector"
-
-Run prisma generate to generate Prisma Client.
-```
-
-The [warning in the CLI output of the command is expected](/v6/orm/prisma-schema/introspection#introspection-warnings-for-unsupported-features) because Prisma ORM doesn't natively support the `VECTOR` type yet.
-
-You Prisma schema will now contain the `Document` model:
-
-```prisma
-model Document {
- id Int @id @default(autoincrement())
- title String
- embedding Unsupported("vector")?
-}
-```
-
-Because the `VECTOR` type is not yet natively supported by Prisma ORM, it's represented as an [`Unsupported`](/v6/orm/prisma-schema/data-model/models#unsupported-types) type.
-
-### 4. Query with raw SQL
-
-Here's an example query for inserting a new row into the `Document` table:
-
-```ts
-await prisma.$executeRaw`
- INSERT INTO "Document" (title, embedding)
- VALUES ('My Title', '[1,22,1,42]'::vector)
-`;
-```
-
-You can also use [TypedSQL](/v6/orm/prisma-client/using-raw-sql/typedsql) for type-safe SQL queries against your database.
-
-## Temporary limitations
-
-### Limited availability of extensions
-
-Extensions are supported on:
-
-- _all_ instances on Pro and Business plans
-- _all_ instances on Free and Starter plans created after August 12th, 2025
-
-Remaining instances will receive support for extensions soon.
-
-If you're using an instance today where PostgreSQL extensions are not supported and you need an extension, [reach out to us](mailto:support@prisma.io) for help.
-
-### No Prisma Studio support for special data types from extensions
-
-Prisma Studio currently doesn't support tables where special types from PostgreSQL extensions are used. It will show an error similar to this one for `pgvector`:
-
-
-Show Prisma Studio error message
-
-```js
-{
- "error": "KnownError { message: \"Raw query failed. Code: `N/A`. Message: `Failed to deserialize column of type 'vector'. If you're using $queryRaw and this column is explicitly marked as `Unsupported` in your Prisma schema, try casting this column to any supported Prisma type such as `String`.`\", meta: Object {\"code\": String(\"N/A\"), \"message\": String(\"Failed to deserialize column of type 'vector'. If you're using $queryRaw and this column is explicitly marked as `Unsupported` in your Prisma schema, try casting this column to any supported Prisma type such as `String`.\")}, error_code: \"P2010\" }",
- "user_facing_error": {
- "is_panic": false,
- "message": "Raw query failed. Code: `N/A`. Message: `Failed to deserialize column of type 'vector'. If you're using $queryRaw and this column is explicitly marked as `Unsupported` in your Prisma schema, try casting this column to any supported Prisma type such as `String`.`",
- "meta": {
- "code": "N/A",
- "message": "Failed to deserialize column of type 'vector'. If you're using $queryRaw and this column is explicitly marked as `Unsupported` in your Prisma schema, try casting this column to any supported Prisma type such as `String`."
- },
- "error_code": "P2010"
- }
-}
-```
-
-
-
-## All supported extensions
-
-Here’s the full list with corrected URLs:
-
-- [`amcheck`](https://www.postgresql.org/docs/current/amcheck.html)
-- [`autoinc`](https://www.postgresql.org/docs/current/contrib-spi.html)
-- [`bloom`](https://www.postgresql.org/docs/current/bloom.html)
-- [`btree_gin`](https://www.postgresql.org/docs/current/btree-gin.html)
-- [`btree_gist`](https://www.postgresql.org/docs/current/btree-gist.html)
-- [`citext`](https://www.postgresql.org/docs/current/citext.html)
-- [`cube`](https://www.postgresql.org/docs/current/cube.html)
-- [`dblink`](https://www.postgresql.org/docs/current/dblink.html)
-- [`dict_int`](https://www.postgresql.org/docs/current/dict-int.html)
-- [`dict_xsyn`](https://www.postgresql.org/docs/current/dict-xsyn.html)
-- [`earthdistance`](https://www.postgresql.org/docs/current/earthdistance.html)
-- [`file_fdw`](https://www.postgresql.org/docs/current/file-fdw.html)
-- [`fuzzystrmatch`](https://www.postgresql.org/docs/current/fuzzystrmatch.html)
-- [`hstore`](https://www.postgresql.org/docs/current/hstore.html)
-- [`insert_username`](https://www.postgresql.org/docs/current/contrib-spi.html)
-- [`intagg`](https://www.postgresql.org/docs/current/intagg.html)
-- [`intarray`](https://www.postgresql.org/docs/current/intarray.html)
-- [`isn`](https://www.postgresql.org/docs/current/isn.html)
-- [`lo`](https://www.postgresql.org/docs/current/lo.html)
-- [`ltree`](https://www.postgresql.org/docs/current/ltree.html)
-- [`moddatetime`](https://www.postgresql.org/docs/current/contrib-spi.html)
-- [`pageinspect`](https://www.postgresql.org/docs/current/pageinspect.html)
-- [`pg_buffercache`](https://www.postgresql.org/docs/current/pgbuffercache.html)
-- [`pg_freespacemap`](https://www.postgresql.org/docs/current/pgfreespacemap.html)
-- [`pg_prewarm`](https://www.postgresql.org/docs/current/pgprewarm.html)
-- [`pg_search`](https://pgxn.org/dist/pg_search/)
-- [`pg_stat_statements`](https://www.postgresql.org/docs/current/pgstatstatements.html)
-- [`pg_surgery`](https://www.postgresql.org/docs/current/pgsurgery.html)
-- [`pg_trgm`](https://www.postgresql.org/docs/current/pgtrgm.html)
-- [`pg_visibility`](https://www.postgresql.org/docs/current/pgvisibility.html)
-- [`pg_walinspect`](https://www.postgresql.org/docs/current/pgwalinspect.html)
-- [`pgcrypto`](https://www.postgresql.org/docs/current/pgcrypto.html)
-- [`pgrowlocks`](https://www.postgresql.org/docs/current/pgrowlocks.html)
-- [`pgstattuple`](https://www.postgresql.org/docs/current/pgstattuple.html)
-- [`plpgsql`](https://www.postgresql.org/docs/current/plpgsql.html)
-- [`postgres_fdw`](https://www.postgresql.org/docs/current/postgres-fdw.html)
-- [`refint`](https://www.postgresql.org/docs/current/contrib-spi.html)
-- [`seg`](https://www.postgresql.org/docs/current/seg.html)
-- [`sslinfo`](https://www.postgresql.org/docs/current/sslinfo.html)
-- [`tablefunc`](https://www.postgresql.org/docs/current/tablefunc.html)
-- [`tcn`](https://www.postgresql.org/docs/current/tcn.html)
-- [`tsm_system_rows`](https://www.postgresql.org/docs/current/tsm-system-rows.html)
-- [`tsm_system_time`](https://www.postgresql.org/docs/current/tsm-system-time.html)
-- [`unaccent`](https://www.postgresql.org/docs/current/unaccent.html)
-- [`uuid-ossp`](https://www.postgresql.org/docs/current/uuid-ossp.html)
-- [`vector`](https://github.com/pgvector/pgvector)
-- [`xml2`](https://www.postgresql.org/docs/current/xml2.html)
-
-## Other extensions are coming soon
-
-Support for the following extensions is going to come soon:
-
-- [`postgis`](https://postgis.net/)
-
-If there are specific extensions you'd like to see, [fill out this form](https://pris.ly/i-want-extensions).
diff --git a/apps/docs/content/docs.v6/postgres/database/prisma-studio/embedding-studio.mdx b/apps/docs/content/docs.v6/postgres/database/prisma-studio/embedding-studio.mdx
deleted file mode 100644
index 030e5edd8a..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/prisma-studio/embedding-studio.mdx
+++ /dev/null
@@ -1,307 +0,0 @@
----
-title: Embed Studio
-description: Learn how to embed Prisma Studio in your own applications to provide users with an amazing data editing experience.
-url: /v6/postgres/database/prisma-studio/embedding-studio
-metaTitle: Embed Prisma Studio in your own application
-metaDescription: Learn how to embed Prisma Studio in your own applications to provide users with an amazing data editing experience.
----
-
-## Embed Prisma Studio in your own application
-
-Prisma Studio can be embedded in your own application via the [`@prisma/studio-core`](https://www.npmjs.com/package/@prisma/studio-core) package.
-
-It provides `Studio`, a React component which renders Prisma Studio for your database. The `Studio` component accepts an executor that calls a `/studio` endpoint in your backend. The backend uses your `DATABASE_URL` (connection string) to connect to the correct Prisma Postgres instance and execute the SQL query.
-
-:::tip
-If you want to see what embedded Studio looks like, **[check out the demo](https://github.com/prisma/studio-core-demo) on GitHub**!
-:::
-
-## Use cases
-
-You can embed Prisma Studio in your own app in various scenarios:
-
-- Create an quick admin dashboard for editing data
-- Multi-tenant application where every user has their own DB
-- Provide an easy way to view and edit data to your users
-
-## Prerequisites
-
-- Frontend: A React application
-- Backend:
- - A server-side application to expose the `/studio` endpoint (e.g. with Express or Hono)
- - A Prisma Postgres instance (you can create one with `npx prisma init --db`)
-
-:::note
-The embeddable version of Prisma Studio will be available for other databases in combination with Prisma ORM soon.
-:::
-
-## Installation
-
-Install the npm package:
-
-```npm
-npm install @prisma/studio-core
-```
-
-## Frontend setup
-
-In your React app, you can use the `Studio` component to render the tables in your database via Prisma Studio. It receives an _executor_ which is responsible for packaging the current SQL query in an HTTP request (also allowing for custom headers/payloads) and sending it to the `/studio` endpoint in your backend.
-
-> Check out the [demo](https://github.com/prisma/studio-core-demo/blob/main/frontend/index.tsx) on GitHub for a full reference implementation.
-
-### Minimal implementation
-
-Here's what a minimal implementation looks like:
-
-```tsx
-import { Studio } from "@prisma/studio-core/ui";
-import { createPostgresAdapter } from "@prisma/studio-core/data/postgres-core";
-import { createStudioBFFClient } from "@prisma/studio-core/data/bff";
-import "@prisma/studio-core/ui/index.css";
-
-function App() {
- const adapter = useMemo(() => {
- // 1. Create a client that points to your backend endpoint
- const executor = createStudioBFFClient({
- url: "http://localhost:4242/studio",
- });
-
- // 2. Create a Postgres adapter with the executor
- const adapter = createPostgresAdapter({ executor });
- return adapter;
- }, []);
-
- return (
-
-
-
- );
-}
-```
-
-### Custom headers/payload implementation
-
-Here's what an implementation with custom headers/payload looks like:
-
-```tsx
-import { Studio } from "@prisma/studio-core/ui";
-import { createPostgresAdapter } from "@prisma/studio-core/data/postgres-core";
-import { createStudioBFFClient } from "@prisma/studio-core/data/bff";
-import "@prisma/studio-core/ui/index.css";
-
-function App() {
- const adapter = useMemo(() => {
- // 1. Create a client that points to your backend endpoint
- const executor = createStudioBFFClient({
- url: "http://localhost:4242/studio",
- customHeaders: {
- "X-Custom-Header": "example-value", // Pass any custom headers
- },
- customPayload: {
- customValue: "example-value", // Pass any custom data
- },
- });
-
- // 2. Create a Postgres adapter with the executor
- const adapter = createPostgresAdapter({ executor });
- return adapter;
- }, []);
-
- return (
-
-
-
- );
-}
-```
-
-### Custom styling
-
-You can customize the look and feel of Prisma Studio so that it matches your application’s design. This is done by passing a custom theme to the `Studio` component. A theme is simply a set of CSS variables that define colors, spacing, and other style properties for both light and dark modes.
-
-Here's an example of applying a custom theme:
-
-```tsx
-import { Studio } from "@prisma/studio-core/ui";
-import { createPostgresAdapter } from "@prisma/studio-core/data/postgres-core";
-import { createStudioBFFClient } from "@prisma/studio-core/data/bff";
-import "@prisma/studio-core/ui/index.css";
-
-const customTheme = `
-@layer base {
- :root {
- --background: 0 0% 100%;
- --foreground: 20 14.3% 4.1%;
- --primary: 47.9 95.8% 53.1%;
- --primary-foreground: 26 83.3% 14.1%;
- --border: 20 5.9% 90%;
- --input: 20 5.9% 90%;
- --ring: 20 14.3% 4.1%;
- --radius: 0rem;
- }
-
- .dark {
- --background: 20 14.3% 4.1%;
- --foreground: 60 9.1% 97.8%;
- --primary: 47.9 95.8% 53.1%;
- --primary-foreground: 26 83.3% 14.1%;
- --border: 12 6.5% 15.1%;
- --input: 12 6.5% 15.1%;
- --ring: 35.5 91.7% 32.9%;
- }
-}
-`;
-
-function App() {
- const adapter = useMemo(() => {
- const executor = createStudioBFFClient({
- url: "http://localhost:4242/studio",
- });
- return createPostgresAdapter({ executor });
- }, []);
-
- return (
-
-
-
- );
-}
-```
-
-With this setup, Studio inherits your custom colors, borders, and typography rules, making it feel like a natural part of your app rather than a separate tool. You can define as many or as few variables as you need depending on the level of customization you want.
-
-### Concepts
-
-Here's an overview of the key concepts in your frontend:
-
-- **Executor**: The bridge between Studio and your backend, it's created using the `createStudioBFFClient` function
-- **Adapter**: Handles Postgres-specific query formatting
-- **Custom headers**: Pass authentication tokens, user info, etc.
-- **Custom payload**: Send additional context/data with each request
-
-## Backend setup
-
-Your backend needs to expose a `/studio` endpoint where the frontend sends its requests. The implementation below uses `createPrismaPostgresHttpClient` from `@prisma/studio-core`.
-
-The backend also needs to have access to the Prisma Postgres API key, we recommend setting it as an environment variable as a best practice.
-
-> Check out the [demo](https://github.com/prisma/studio-core-demo/blob/main/server/index.ts) on GitHub for a full reference implementation.
-
-### Minimal implementation
-
-Here's what a minimal implementation for the `/studio` endpoint looks like with [Hono](https://hono.dev/). This assumes that your connection URL is available via the `DATABASE_URL` env var:
-
-```ts
-import { Hono } from "hono";
-import { createPrismaPostgresHttpClient } from "@prisma/studio-core/data/ppg";
-import { serializeError } from "@prisma/studio-core/data/bff";
-
-const app = new Hono().use("*", cors());
-
-app.post("/studio", async (c) => {
- // 1. Extract the query and custom data from the request
- const { query } = await c.req.json();
-
- // 2. Read DB URL from env vars
- const url = process.env.DATABASE_URL;
-
- // 3. Execute the query against Prisma Postgres
- const [error, results] = await createPrismaPostgresHttpClient({ url }).execute(query);
-
- // 6. Return results or errors
- if (error) {
- return c.json([serializeError(error)]);
- }
-
- return c.json([null, results]);
-});
-```
-
-### Custom headers/payload implementation
-
-Here's what a slightly more advanced implementation for the `/studio` endpoint looks like with [Hono](https://hono.dev/). In this case, a multi-tenant scenario is assumed where the frontend sends over a user ID and authentication token which is used on the backend to determine the Prisma Postgres instance that belongs to that user via a hypothetical `determineUrlFromContext` function:
-
-```ts
-// server/index.ts
-import { Hono } from "hono";
-import { createPrismaPostgresHttpClient } from "@prisma/studio-core/data/ppg";
-import { serializeError } from "@prisma/studio-core/data/bff";
-
-const app = new Hono().use("*", cors());
-
-app.post("/studio", async (c) => {
- // 1. Extract the query and custom data from the request
- const { query, customPayload } = await c.req.json();
-
- // 2. Access custom headers (great for auth!)
- const customHeader = c.req.header("X-Custom-Header");
- console.log("Received headers:", { customHeader });
-
- // 3. Use custom payload data
- console.log("Received value:", customPayload.customValue);
-
- // 4. Determine the URL (this is where you'd implement your auth logic)
- const url = determineUrlFromContext(customHeader, customPayload);
-
- // 5. Execute the query using Prisma Postgres or Prisma Accelerate
- const [error, results] = await createPrismaPostgresHttpClient({ url }).execute(query);
-
- // 6. Return results or errors
- if (error) {
- return c.json([serializeError(error)]);
- }
-
- return c.json([null, results]);
-});
-```
-
-### Concepts
-
-- Query object: Contains the SQL query and parameters from Studio
-- Custom payload: Additional data sent with each request
-- Prisma Postgres client: Executes queries against your database
-- Error handling: Properly serialize errors for Studio to display
-
-## Execution flow
-
-Here's an overview of the execution flow in your embedded Prisma Studio version:
-
-
-
-## Adding user authentication
-
-When you want to authenticate the users of your app against Prisma Studio, you can do that by adding custom logic around your embedded Prisma Studio version.
-
-On the frontend, you can ensure to pass the `Authorization` header and other data (e.g. a user ID) when creating the executor:
-
-```tsx
-const executor = createStudioBFFClient({
- url: "http://localhost:4242/studio",
- customHeaders: {
- "X-User-ID": currentUser.id,
- Authorization: `Bearer ${userToken}`,
- },
-});
-```
-
-In your server-side implementation, you can then retrieve these values from the incoming request and extract the Prisma Postgres API key that's needed for this user's query:
-
-```typescript
-const userId = c.req.header("X-User-ID");
-const token = c.req.header("Authorization");
-
-const userApiKey = await getUserApiKey(userId, token);
-```
-
-## Licensing
-
-Embeddable Prisma Studio (Free) is licensed under Apache 2.0.
-
-✔️ Free for production use
-⚠️ Prisma branding must remain visible and unaltered
-🔐 To remove our branding or to inquire about upcoming partner-only features, ping us here: [partnerships@prisma.io](mailto:partnerships@prisma.io)
-
-## Telemetry
-
-This package includes anonymized telemetry to help us improve Prisma Studio.
-Use implies consent. Learn more in our [Privacy Policy](https://www.prisma.io/privacy).
diff --git a/apps/docs/content/docs.v6/postgres/database/prisma-studio/index.mdx b/apps/docs/content/docs.v6/postgres/database/prisma-studio/index.mdx
deleted file mode 100644
index 1e77584aa2..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/prisma-studio/index.mdx
+++ /dev/null
@@ -1,22 +0,0 @@
----
-title: Prisma Studio
-description: 'Learn about the various ways of using Prisma Studio, from running locally, to using it in VS Code to embedding it in your own application.'
-url: /v6/postgres/database/prisma-studio
-metaTitle: Prisma Studio for Prisma Postgres
-metaDescription: 'Learn about the various ways of using Prisma Studio, from running locally, to using it in VS Code to embedding it in your own application.'
----
-
-## Overview
-
-Prisma Postgres comes with Prisma Studio built-in. You can use it in several ways:
-
-- Run `npx prisma studio --url "postgresql://user:password@localhost:5432/dbname"` to use Studio locally on your machine (also works with any other database)
-- Find the **Studio** tab in your project in the [Prisma Console](https://console.prisma.io) to use Studio online
-- Install the [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) to use Studio directly in VS Code
-- [Embed Prisma Studio](/v6/postgres/database/prisma-studio/embedding-studio) in your own app (e.g. as an admin dashboard)
-
-:::note
-
-If you want to use Prisma Studio with another database than Prisma Postgres, check the docs [here](/v6/orm/tools/prisma-studio).
-
-:::
diff --git a/apps/docs/content/docs.v6/postgres/database/prisma-studio/meta.json b/apps/docs/content/docs.v6/postgres/database/prisma-studio/meta.json
deleted file mode 100644
index 85387e994f..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/prisma-studio/meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Prisma Studio",
- "defaultOpen": false,
- "pages": ["index", "embedding-studio", "studio-in-vs-code"]
-}
diff --git a/apps/docs/content/docs.v6/postgres/database/prisma-studio/studio-in-vs-code.mdx b/apps/docs/content/docs.v6/postgres/database/prisma-studio/studio-in-vs-code.mdx
deleted file mode 100644
index 61b8b4015a..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/prisma-studio/studio-in-vs-code.mdx
+++ /dev/null
@@ -1,26 +0,0 @@
----
-title: Studio in VS Code
-description: Learn how to use Prisma Studio directly in VS Code.
-url: /v6/postgres/database/prisma-studio/studio-in-vs-code
-metaTitle: Prisma Studio in VS Code
-metaDescription: Learn how to use Prisma Studio directly in VS Code.
----
-
-## Overview
-
-You can use Prisma Studio directly in VS Code via the [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma).
-
-:::info[Supported databases]
-
-Prisma Studio currently supports PostgreSQL, MySQL, and SQLite. Support for CockroachDB and MongoDB is not available yet but may be added in future releases.
-
-For detailed database support information, including SQLite requirements, see [Databases supported by Prisma Studio](/v6/orm/tools/prisma-studio#databases-supported-by-prisma-studio).
-
-:::
-
-## Usage
-
-1. Install the [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma)
-1. Find the **Prisma logo** in the VS Code Activity Bar
-1. Sign in to [Prisma Console](https://console.prisma.io)
-1. Once authenticated, select the database you want to explore in Prisma Studio
diff --git a/apps/docs/content/docs.v6/postgres/database/serverless-driver.mdx b/apps/docs/content/docs.v6/postgres/database/serverless-driver.mdx
deleted file mode 100644
index 6bffdd5d3d..0000000000
--- a/apps/docs/content/docs.v6/postgres/database/serverless-driver.mdx
+++ /dev/null
@@ -1,332 +0,0 @@
----
-title: Serverless driver
-description: 'A lightweight PostgreSQL driver for Prisma Postgres optimized for serverless and edge environments with HTTP/WebSocket support, result streaming, and minimal memory footprint.'
-badge: early-access
-url: /v6/postgres/database/serverless-driver
-metaTitle: Serverless driver
-metaDescription: 'A lightweight PostgreSQL driver for Prisma Postgres optimized for serverless and edge environments with HTTP/WebSocket support, result streaming, and minimal memory footprint.'
----
-
-The Prisma Postgres serverless driver ([`@prisma/ppg`](https://www.npmjs.com/package/@prisma/ppg)) is a lightweight client for connecting to Prisma Postgres using raw SQL. It uses HTTP and WebSocket protocols instead of traditional TCP connections, enabling database access in constrained environments where native PostgreSQL drivers cannot run.
-
-:::warning
-
-The Prisma Postgres serverless driver is currently in [Early Access](/v6/orm/more/releases#early-access) and not yet recommended for production scenarios.
-
-:::
-
-## Key features
-
-The serverless driver uses HTTP and WebSocket protocols instead of TCP, enabling database access in environments where traditional PostgreSQL drivers cannot run:
-
-- Compatible with Cloudflare Workers, Vercel Edge Functions, Deno Deploy, AWS Lambda, Bun, and browsers
-- Stream results row-by-row to handle large datasets with constant memory usage
-- Pipeline multiple queries over a single connection, reducing latency by up to 3x
-- SQL template literals with automatic parameterization and full TypeScript support
-- Built-in transactions, batch operations, and extensible type system
-- Automatic connection pooling across [all available Prisma Postgres regions](/v6/postgres/faq#what-regions-is-prisma-postgres-available-in) for optimal performance
-
-Use this driver for edge/serverless environments without full Node.js support, or when working with large result sets that benefit from streaming.
-
-For standard Node.js environments, use the [`node-postgres` driver](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver) for lower latency with direct TCP connections.
-
-## Prerequisite: Get your connection string
-
-The serverless driver requires a Prisma Postgres Direct TCP connection URL:
-
-```
-postgres://identifier:key@db.prisma.io:5432/postgres?sslmode=require
-```
-
-Find this in the API Keys section of your [Prisma Postgres dashboard](https://console.prisma.io). The connection string is used only to extract authentication credentials. No direct TCP connection is made from the client.
-
-If you don't have a Prisma Postgres database, create one using the [`create-db` CLI](/v6/postgres/introduction/npx-create-db) tool:
-
-```npm
-npx prisma create-db
-```
-
-## Installation
-
-Install the appropriate package based on your use case:
-
-```npm tab="Without Prisma ORM"
-npm install @prisma/ppg
-```
-
-```npm tab="With Prisma ORM"
-npm install @prisma/ppg @prisma/adapter-ppg
-```
-
-## Usage
-
-### Query with SQL template literals
-
-Use the `prismaPostgres()` high-level API with SQL template literals and automatic parameterization:
-
-```ts
-import { prismaPostgres, defaultClientConfig } from "@prisma/ppg";
-
-const ppg = prismaPostgres(defaultClientConfig(process.env.PRISMA_DIRECT_TCP_URL!));
-
-type User = { id: number; name: string; email: string };
-
-// SQL template literals with automatic parameterization
-const users = await ppg.sql`
- SELECT * FROM users WHERE email = ${"user@example.com"}
-`.collect();
-
-console.log(users[0].name);
-```
-
-### Use with Prisma ORM
-
-Use the [`PrismaPostgresAdapter`](https://www.npmjs.com/package/@prisma/adapter-ppg) to connect Prisma Client via the serverless driver:
-
-```ts
-import { PrismaClient } from "../generated/prisma/client";
-import { PrismaPostgresAdapter } from "@prisma/adapter-ppg";
-
-const prisma = new PrismaClient({
- adapter: new PrismaPostgresAdapter({
- connectionString: process.env.PRISMA_DIRECT_TCP_URL,
- }),
-});
-
-const users = await prisma.user.findMany();
-```
-
-### Stream results
-
-Results are returned as `CollectableIterator`. Stream rows one at a time for constant memory usage, or collect all rows into an array:
-
-```ts
-type User = { id: number; name: string; email: string };
-
-// Stream rows one at a time (constant memory usage)
-for await (const user of ppg.sql`SELECT * FROM users`) {
- console.log(user.name);
-}
-
-// Or collect all rows into an array
-const allUsers = await ppg.sql`SELECT * FROM users`.collect();
-```
-
-### Pipeline queries
-
-Send multiple queries over a single WebSocket connection without waiting for responses. Queries are sent immediately and results arrive in FIFO order:
-
-```ts
-import { client, defaultClientConfig } from "@prisma/ppg";
-
-const cl = client(defaultClientConfig(process.env.PRISMA_DIRECT_TCP_URL!));
-const session = await cl.newSession();
-
-// Send all queries immediately (pipelined)
-const [usersResult, ordersResult, productsResult] = await Promise.all([
- session.query("SELECT * FROM users"),
- session.query("SELECT * FROM orders"),
- session.query("SELECT * FROM products"),
-]);
-
-session.close();
-```
-
-With 100ms network latency, 3 sequential queries take 300ms (3 x RTT), but pipelined queries take only 100ms (1 x RTT).
-
-### Parameter streaming
-
-Parameters over 1KB are automatically streamed without buffering in memory. For large binary parameters, you must use `boundedByteStreamParameter()` which creates a `BoundedByteStreamParameter` object that carries the total byte size, required by the PostgreSQL protocol:
-
-```ts
-import { client, defaultClientConfig, boundedByteStreamParameter, BINARY } from "@prisma/ppg";
-
-const cl = client(defaultClientConfig(process.env.PRISMA_DIRECT_TCP_URL!));
-
-// Large binary data (e.g., file content)
-const stream = getReadableStream(); // Your ReadableStream source
-const totalSize = 1024 * 1024; // Total size must be known in advance
-
-// Create a bounded byte stream parameter
-const streamParam = boundedByteStreamParameter(stream, BINARY, totalSize);
-
-// Automatically streamed - constant memory usage
-await cl.query("INSERT INTO files (data) VALUES ($1)", streamParam);
-```
-
-For `Uint8Array` data, use `byteArrayParameter()`:
-
-```ts
-import { client, defaultClientConfig, byteArrayParameter, BINARY } from "@prisma/ppg";
-
-const cl = client(defaultClientConfig(process.env.PRISMA_DIRECT_TCP_URL!));
-
-const bytes = new Uint8Array([1, 2, 3, 4]);
-const param = byteArrayParameter(bytes, BINARY);
-
-await cl.query("INSERT INTO files (data) VALUES ($1)", param);
-```
-
-The `boundedByteStreamParameter()` function is provided by the `@prisma/ppg` library and requires the total byte size to be known in advance due to PostgreSQL protocol requirements.
-
-### Transactions and batch operations
-
-Transactions automatically handle BEGIN, COMMIT, and ROLLBACK:
-
-```ts
-const result = await ppg.transaction(async (tx) => {
- await tx.sql.exec`INSERT INTO users (name) VALUES ('Alice')`;
- const users = await tx.sql`SELECT * FROM users WHERE name = 'Alice'`.collect();
- return users[0].name;
-});
-```
-
-Batch operations execute multiple statements in a single round-trip within an automatic transaction:
-
-```ts
-const [users, affected] = await ppg.batch<[User[], number]>(
- { query: "SELECT * FROM users WHERE id < $1", parameters: [5] },
- { exec: "INSERT INTO users (name) VALUES ($1)", parameters: ["Charlie"] },
-);
-```
-
-## Type handling
-
-When using `defaultClientConfig()`, common PostgreSQL types are automatically parsed (`boolean`, `int2`, `int4`, `int8`, `float4`, `float8`, `text`, `varchar`, `json`, `jsonb`, `date`, `timestamp`, `timestamptz`):
-
-```ts
-import { prismaPostgres, defaultClientConfig } from "@prisma/ppg";
-
-const ppg = prismaPostgres(defaultClientConfig(process.env.PRISMA_DIRECT_TCP_URL!));
-
-// JSON/JSONB automatically parsed
-const rows = await ppg.sql<{ data: { key: string } }>`
- SELECT '{"key": "value"}'::jsonb as data
-`.collect();
-console.log(rows[0].data.key); // "value"
-
-// BigInt parsed to JavaScript BigInt
-const bigints = await ppg.sql<{
- big: bigint;
-}>`SELECT 9007199254740991::int8 as big`.collect();
-
-// Dates parsed to Date objects
-const dates = await ppg.sql<{
- created: Date;
-}>`SELECT NOW() as created`.collect();
-```
-
-### Custom parsers and serializers
-
-Extend or override the type system with custom parsers (by PostgreSQL OID) and serializers (by type guard):
-
-```ts
-import { client, defaultClientConfig } from "@prisma/ppg";
-import type { ValueParser } from "@prisma/ppg";
-
-// Custom parser for UUID type
-const uuidParser: ValueParser = {
- oid: 2950,
- parse: (value) => (value ? value.toUpperCase() : null),
-};
-
-const config = defaultClientConfig(process.env.PRISMA_DIRECT_TCP_URL!);
-const cl = client({
- ...config,
- parsers: [...config.parsers, uuidParser], // Append to defaults
-});
-```
-
-For custom serializers, place them before defaults so they take precedence:
-
-```ts
-import type { ValueSerializer } from "@prisma/ppg";
-
-class Point {
- constructor(
- public x: number,
- public y: number,
- ) {}
-}
-
-const pointSerializer: ValueSerializer = {
- supports: (value: unknown): value is Point => value instanceof Point,
- serialize: (value: Point) => `(${value.x},${value.y})`,
-};
-
-const config = defaultClientConfig(process.env.PRISMA_DIRECT_TCP_URL!);
-const cl = client({
- ...config,
- serializers: [pointSerializer, ...config.serializers], // Your serializer first
-});
-
-await cl.query("INSERT INTO locations (point) VALUES ($1)", new Point(10, 20));
-```
-
-See the [npm package documentation](https://www.npmjs.com/package/@prisma/ppg) for more details.
-
-## Platform compatibility
-
-The driver works in any environment with `fetch` and `WebSocket` APIs:
-
-| Platform | HTTP Transport | WebSocket Transport |
-| --------------------- | -------------- | ------------------- |
-| Cloudflare Workers | ✅ | ✅ |
-| Vercel Edge Functions | ✅ | ✅ |
-| AWS Lambda | ✅ | ✅ |
-| Deno Deploy | ✅ | ✅ |
-| Bun | ✅ | ✅ |
-| Node.js 18+ | ✅ | ✅ |
-| Browsers | ✅ | ✅ (with CORS) |
-
-## Transport modes
-
-- **HTTP transport (stateless):** Each query is an independent HTTP request. Best for simple queries and edge functions.
-- **WebSocket transport (stateful):** Persistent connection for multiplexed queries. Best for transactions, pipelining, and multiple queries. Create a session with `client().newSession()`.
-
-## API overview
-
-### `prismaPostgres(config)`
-
-High-level API with SQL template literals, transactions, and batch operations. Recommended for most use cases.
-
-### `client(config)`
-
-Low-level API with explicit parameter passing and session management. Use when you need fine-grained control.
-
-See the [npm package](https://www.npmjs.com/package/@prisma/ppg) for complete API documentation.
-
-## Error handling
-
-Structured error types are provided: `DatabaseError`, `HttpResponseError`, `WebSocketError`, `ValidationError`.
-
-```ts
-import { DatabaseError } from "@prisma/ppg";
-
-try {
- await ppg.sql`SELECT * FROM invalid_table`.collect();
-} catch (error) {
- if (error instanceof DatabaseError) {
- console.log(error.code);
- }
-}
-```
-
-## Connection pooling enabled by default
-
-The serverless driver automatically uses connection pooling [across all available Prisma Postgres regions](/v6/postgres/faq#what-regions-is-prisma-postgres-available-in) for optimal performance and resource utilization.
-
-Connection pooling is enabled by default and requires no additional configuration.
-
-This ensures efficient database connections regardless of your deployment region, reducing connection overhead and improving query performance.
-
-## Limitations
-
-- Requires a Prisma Postgres instance and does not work with [local development](/v6/postgres/database/local-development) databases
-- Currently in Early Access and not yet recommended for production
-
-## Learn more
-
-- [`@prisma/ppg` npm package](https://www.npmjs.com/package/@prisma/ppg)
-- [prisma/ppg-client GitHub repository](https://github.com/prisma/ppg-client)
-- [Prisma Postgres documentation](/v6/postgres/introduction)
diff --git a/apps/docs/content/docs.v6/postgres/faq.mdx b/apps/docs/content/docs.v6/postgres/faq.mdx
deleted file mode 100644
index 2012b6208d..0000000000
--- a/apps/docs/content/docs.v6/postgres/faq.mdx
+++ /dev/null
@@ -1,388 +0,0 @@
----
-title: FAQ
-description: Learn about the FAQ regarding Prisma Postgres.
-url: /v6/postgres/faq
-metaTitle: FAQ | Prisma Postgres
-metaDescription: Learn about the FAQ regarding Prisma Postgres.
----
-
-Common questions about how Prisma Postgres works, how queries are billed, and how it integrates with the Prisma ORM.
-
-## General
-
-### Can I use Prisma Postgres without Prisma ORM?
-
-Yes, you can use Prisma Postgres with any database library or tool via a [direct connection](/v6/postgres/database/direct-connections).
-
-### How do I switch from GitHub login to email and password login?
-
-If you previously signed up using GitHub and want to switch to email and password login, follow these steps:
-
-1. Verify Your GitHub Email Address
- - Check the primary email address associated with your GitHub account (e.g., from your GitHub profile or notification settings).
-2. Create a New Email/Password Account
- - Go to the email/password sign-up page.
- - Use the _same email address_ linked to your GitHub account to create the new account.
- - Our system will automatically connect your new email/password account to your existing data.
-3. Test Your Login
- - Log out and try logging in with your email and the password you just created.
-
-If you encounter any issues, please contact our support team for help linking your accounts.
-
-### VS Code does not recognize the `$extends` method
-
-If you add the Prisma Client extension for Accelerate to an existing project that is currently open in VS Code, the editor might not immediately recognize the `$extends` method.
-
-This might be an issue with the TypeScript server not yet recognizing the regenerated Prisma Client. To resolve this, you need to restart TypeScript.
-
-1. In VS Code, open the Command Palette. You can do so when you press F1 or select **View** > **Command Palette**.
-2. Enter `typescript` and select and run the **TypeScript: Restart TS server** command.
-
-VS Code should now recognize the `$extends` method.
-
-## What regions is Prisma Postgres available in?
-
-Prisma Postgres is currently available in the following regions:
-
-| Region Code | Location |
-| ---------------- | -------------- |
-| `us-west-1` | San Francisco |
-| `us-east-1` | North Virginia |
-| `eu-west-3` | Paris |
-| `eu-central-1` | Frankfurt |
-| `ap-northeast-1` | Tokyo |
-| `ap-southeast-1` | Singapore |
-
-We're continuously working to expand regional support. If you'd like to request a specific region, reach out to us via [Discord](https://pris.ly/discord).
-
-## Pricing
-
-Prisma Postgres bills based on _operations_ and _storage_ consumed. Visit the [pricing page](https://www.prisma.io/pricing) for details and our [blog post explaining operations-based billing](https://www.prisma.io/blog/operations-based-billing) for a detailed explanation on what an operation is and how this pricing model works.
-
-### What is an operation?
-
-An operation is counted each time you interact with your database. Read, write, simple or complex. It all simply counts as one.
-
-An operation can be:
-
-- a Prisma ORM query (when using Prisma ORM)
-- a SQL query (when using a [direct TCP connection](/v6/postgres/database/direct-connections))
-
-### Does query execution time affect pricing in Prisma Postgres?
-
-No, cost for Prisma Postgres is based solely on the _number of operations_, not the amount of compute required to execute them.
-
-Whether a query takes 10ms or 10sec to execute, its pricing impact remains the same.
-
-### How does pricing differ between using Prisma ORM and direct TCP connections?
-
-The fundamental principle of operations-based pricing remains the same for Prisma ORM and [direct TCP connection](/v6/postgres/database/direct-connections). However, depending on whether you use Prisma ORM or direct SQL to interact with your database, an operation is something different:
-
-- when using Prisma ORM: a query sent with Prisma Client (e.g. `prisma.user.findMany()`)
-- when using another tool: a SQL query sent via the direct connection (e.g. `SELECT * from "User"`)
-
-Note that a single Prisma ORM query may translate into multiple SQL queries which may make using Prisma ORM more economical than direct SQL.
-
-### Do read and write queries cost the same?
-
-Yes, read and write queries are counted equally as _operations_ and are billed the same way.
-
-### Does a `SELECT 1` query count as a billable operation?
-
-Yes, a query like `SELECT 1` counts as an operation and will be billed accordingly (even if no actual data is accessed in the query).
-
-### How can I estimate the number of operations in Prisma ORM?
-
-You can estimate your operation usage in Prisma ORM by integrating an application performance monitoring tool like Prometheus.
-
-### What strategies can I use to optimize cost per operation?
-
-Prisma Postgres bills by operation. The more you can perform using a single operation, the lower your bill. Some tips to reduce the number of operations:
-
-- [**Batch your writes**](/v6/orm/prisma-client/queries/transactions#batchbulk-operations) with `createMany`, `updateMany`, or `deleteMany` instead of looping over single-row calls.
-
- ```ts
- // One operation, three users
- await prisma.user.createMany({
- data: [{ name: "Alice" }, { name: "Bob" }, { name: "Carol" }],
- });
- ```
-
-- **Use nested-relation helpers** such as [`connectOrCreate`](/v6/orm/reference/prisma-client-reference#connectorcreate) or [`set`](/v6/orm/reference/prisma-client-reference#set) to create or link related records in a single operation.
-
- ```ts
- // Post and (if needed) its author, all in one request
- await prisma.post.create({
- data: {
- title: "Hello World",
- author: {
- connectOrCreate: {
- where: { email: "alice@example.com" },
- create: { name: "Alice", email: "alice@example.com" },
- },
- },
- },
- });
- ```
-
-- **Prefer regular (array) [transactions](/v6/orm/prisma-client/queries/transactions#transaction-api) over [interactive transactions](/v6/orm/prisma-client/queries/transactions#interactive-transactions)** when the individual queries don't depend on each other.
-
- ```ts
- // Interactive transaction: counted as 2 operations
- await prisma.$transaction(async (tx) => {
- await tx.user.create({ data: { name: "Alice" } });
- await tx.post.create({ data: { title: "Hello", authorId: 1 } });
- });
-
- // Array transaction: counted as 1 operation
- await prisma.$transaction([
- prisma.user.create({ data: { name: "Alice" } }),
- prisma.post.create({ data: { title: "Hello", authorId: 1 } }),
- ]);
- ```
-
-If a later query needs the result of an earlier one (for example, you need the user ID you just created), stick with an interactive transaction for correctness. Otherwise, batching and array transactions let you collapse multiple queries into a single billed operation, keeping both your operation count, and your cost down.
-
-### Is there a sample workload to estimate my expected charges?
-
-We will demonstrate three example workloads and estimate bills for small, medium, and large workloads. Each combine a realistic number of monthly active users (MAUs), a typical level of daily activity per user, and a rounded storage footprint.
-
-We will use the following equations to estimate the monthly bill:
-
-```
-total_ops = MAUs x actions_per_user_per_day x 30
-billable_ops = total_ops - included_ops_for_plan
-ops_cost = (billable_ops ÷ 1_000_000) x plan_rate
-
-billable_storage_GB = storage_used_GB - free_storage_for_plan
-storage_cost = billable_storage_GB x storage_rate_for_plan
-
-total_monthly_cost = ops_cost + storage_cost + base_plan_fee
-```
-
-:::note
-
-You can use your own MAU count, activity level, and storage used to project costs on any plan using the equations above.
-
-:::
-
-We will associate each workload with a paid plan and its corresponding pricing details, for example, the **Starter plan** for the small workload, the **Pro plan** for the medium workload, and the **Business plan** for the large workload. Then we will apply the equations to the example workloads to generate a rough estimate of a monthly bill. For example:
-
-:::note[Pricing details]
-
-Here are the details for each pricing plan:
-
-- **Starter plan** - \$8 per million operations
- - Base plan fee - \$10 per month
- - Included operations - 1,000,000
- - Storage - 10 GB free then \$2 per additional GB
-- **Pro plan** - \$2 per million operations
- - Base plan fee - \$49.00 per month
- - Included operations - 10,000,000
- - Storage - 50 GB free then \$1.5 per additional GB
-- **Business plan** - \$1 per million operations
- - Base plan fee - \$129.00 per month
- - Included operations - 50,000,000
- - Storage - 100 GB free then \$1 per additional GB
-
-We also have a Free plan, but we are leaving it out in the following calculations because it's intended for evaluation only and is not meant for production workloads. You can also learn more about the pricing details for each plan on the [pricing page](https://www.prisma.io/pricing?utm_source=docs).
-
-:::
-
-**Example of a small workload on the Starter plan**:
-
-A hobby or early-stage side-project with ~`500` MAUs. Each user performs ~`10` actions per day, and the entire database uses ~`0.5` GB of storage. Based on the assumptions, you would calculate the monthly bill using the following equations:
-
-- `total_ops` = `500` x `10` x `30` = `150000`
-- `billable_ops` = `0` (150,000 operations is below the 1 million free operations)
-- `ops_cost` = $`0`
-- `storage_cost` = $`0` (0.5 GB is below the 10 GB storage already included)
-- `base_plan_fee` = $`10`
-
-`total_monthly_cost` = $`10.00` per month
-
-**Example of a medium workload on the Pro plan**:
-
-A growing SaaS product serving ~`5000` MAUs. Power users average ~`40` actions per day, and the app stores ~`6` GB of data. Based on the assumptions, you would calculate the monthly bill using the following equations:
-
-- `total_ops` = `5000` x `40` x `30` = `6000000`
-- `billable_ops` = `0` (6 million operations is below the 10 million free operations)
-- `ops_cost` = $`0`
-- `storage_cost` = $`0` (6 GB is below the 50 GB storage already included)
-- `base_plan_fee` = $`49.00`
-
-`total_monthly_cost` = $`49.00` per month
-
-**Example of a large workload on the Business plan**:
-
-A production-grade, consumer-facing application handling ~`50000` MAUs. Heavy usage with ~`60` actions per user per day drives significant traffic, and the dataset reaches ~`40` GB. Based on the assumptions, you would calculate the monthly bill using the following equations:
-
-- `total_ops` = `50000` x `60` x `30` = `90000000`
-- `billable_ops` = `90000000` - `50000000` = `40000000`
-- `ops_cost` = (`40000000` ÷ `1000000`) = `40.00` x $`1` = $`40.00`
-- `storage_cost` = $`0.00` (40 GB is below the 100 GB storage already included)
-- `base_plan_fee` = $`129.00`
-
-`total_monthly_cost` = $`40.00` + $`129.00` = $`169.00` per month
-
-### Are cached operations billed the same?
-
-Every request, whether it hits the database or is served from cache, counts as an operation. Prisma Postgres use a flat per-operation price and never charge for egress traffic, so a cached response doesn't incur any extra or reduced fee. This unified rate keeps the billing model predictable and avoids per-request complexity.
-
-### How do I upgrade my plan if I am using Prisma Postgres via Vercel?
-
-To upgrade your plan via Vercel, follow these steps:
-
-- Open your [Vercel](https://vercel.com/) Dashboard.
-- Go to the **Integrations** tab in your Vercel Team.
-- Click **Manage** on the Prisma Integration.
-- Navigate to the **Settings** tab.
-- Under Current Installation Plan Level, click **Change Plan**.
-- Select the plan you want to upgrade to.
-
-## Caching
-
-Prisma Postgres includes built-in connection pooling and global caching. These features improve performance by optimizing how your queries are routed and cached.
-
-### How does Prisma Postgres's cache layer know what region to fetch the cache from?
-
-Under the hood, Prisma Postgres's cache layer uses Cloudflare, which uses [Anycast](https://www.cloudflare.com/learning/cdn/glossary/anycast-network/) for network addressing and routing. An incoming request will be routed to the nearest data center or "node" in their network that has the capacity to process the request efficiently. To learn more about how this works, we recommend looking into [Anycast](https://www.cloudflare.com/learning/cdn/glossary/anycast-network/).
-
-### How can I invalidate a cache for Prisma Postgres?
-
-You can invalidate the cache on-demand via the [`$accelerate.invalidate` API](/v6/accelerate/api-reference#accelerateinvalidate) if you're on a [paid plan](https://www.prisma.io/pricing#accelerate), or you can invalidate your entire cache, on a project level, a maximum of five times a day. This limit is set based on [your plan](https://www.prisma.io/pricing). You can manage this via the Accelerate configuration page.
-
-### What is Prisma Postgres's caching layer's consistency model?
-
-The caching layer in Prisma Postgres does not have a consistency model. It is not a distributed system where nodes need to reach a consensus (because data is only stored in the cache node(s) closest to the user). However, the data cached in Prisma Postgres's cache nodes doesn't propagate to other nodes, so the cache layer by design doesn't need a consistency model.
-
-Prisma Postgres implements a [read-through caching strategy](https://www.prisma.io/dataguide/managing-databases/introduction-database-caching#read-through) particularly suitable for read-heavy workloads.
-
-The freshness of the data served by the cache depends on the cache strategy defined in your query. Refer to [this section](/v6/postgres/database/caching#selecting-a-cache-strategy) for more information on selecting the right cache strategy for your query.
-
-### How is Prisma Postgres's caching layer different from other caching tools, such as Redis?
-
-The caching layer of Prisma Postgres:
-
-- Is a _specialized_ cache that allows you to optimize data access in code at the query level with a cache strategy. On the other hand, tools such as Redis and Memcached are _general-purpose_ caches designed to be adaptable and flexible.
-- Is a managed service that reduces the time, risk, and engineering effort of building and maintaining a cache service.
-- Is globally distributed, by default, reducing the latency of your queries. Other cache tools would require additional configuration to make them available globally.
-
-### When should I not use Prisma Postgres's caching features?
-
-The caching layer of Prisma Postgres is a global data cache and connection pool that allows you to optimize data access in code at the query level. While caching with Prisma Postgres can greatly boost the performance of your app, it may not always the best choice for your use case.
-
-This global cache feature may not be a good fit for your app if:
-
-- Your app is exclusively used within a specific region and both your application server and database are situated in that same region on the same network. For example, database queries will likely be much faster if your application server and database are in the same region and network. However, If your application server is in different regions or networks from your database, the cache nodes will speed up your queries because the data will be cached in the closest data center to your application.
-
-- Your application data _always_ needs to be up-to-date on retrieval, making it difficult to establish a reasonable cache strategy.
-
-### What is the maximum allowed value for the `ttl` parameter when configuring `cacheStrategy`?
-
-The [Time-to-live](/v6/postgres/database/caching#time-to-live-ttl) (`ttl`) parameter can be set for up to a _year_. However, it's important to note that items within the cache may be evicted if they are not frequently accessed.
-
-Based on our experimentation, we’ve seen cache items persist for around 18 hours. While items may remain in the cache for an extended period if they are actively accessed, there is no guarantee.
-
-:::note
-
-Even frequently accessed items may occasionally be evicted from the cache. It's unlikely for an item to survive for up to or longer than a month, regardless of its activity level.
-
-:::
-
-### Why do I sometimes see unexpected cache behavior?
-
-Prisma Postgres's cache layer performs best when it observes a higher load from a project. Many cache operations, such as committing data to cache and refreshing stale data, happen asynchronously. When benchmarking the cache layer, we recommend doing so with loops or a load testing approach. This will mimic higher load scenarios better and reduce outliers from low frequency operations.
-
-Prisma operations are sent to Prisma Postgres over HTTP. As a result, the first request to Prisma Postgres must establish an HTTP handshake and may have additional latency as a result. We're exploring ways to reduce this initial request latency in the future.
-
-### What regions are Prisma Postgres's cache nodes available in?
-
-Prisma Postgres's cache layer runs on Cloudflare's network and cache hits are served from Cloudflare's 300+ locations. You can find the regions where Prisma Postgres's cache nodes are available here: [https://www.cloudflare.com/network/](https://www.cloudflare.com/network/).
-
-### How long does it take to invalidate a cache query result?
-
-As the cache needs to be cleared globally, it is difficult to provide a specific time frame. However, the cached data is eventually consistent and typically propagates to all PoPs within a few seconds. In very rare cases, it may take longer.
-
-Here is a [demo app](https://pris.ly/test-cache-invalidation) to test the time it takes to invalidate a cache query result.
-
-### What is the difference between **Invalidate** and **Revalidate**?
-
-**Invalidate**: The cache entry is deleted, and new data will be fetched on the next request, causing a cache miss. This removes stale data but may lead to slower responses until the cache is repopulated.
-
-**Revalidate**: The cache entry is updated proactively, ensuring the next request uses fresh data from the cache. This keeps the cache valid and maintains faster response times by avoiding cache misses.
-
-### What is on-demand cache invalidation?
-
-[On-demand cache invalidation](/v6/postgres/database/caching#on-demand-cache-invalidation) lets applications instantly update specific cached data when it changes, instead of waiting for regular cache refresh cycles. This keeps information accurate and up-to-date for users.
-
-### When should I use the cache invalidate API?
-
-The [cache invalidate API](/v6/postgres/database/caching#on-demand-cache-invalidation) is essential when data consistency cannot wait for the cache’s standard expiration or revalidation. Key use cases include:
-
-- **Content updates**: When critical changes occur, such as edits to a published article, product updates, or profile modifications, that need to be visible immediately.
-- **Inventory management**: In real-time applications, like inventory or booking systems, where stock levels, availability, or reservation statuses must reflect the latest information.
-- **High-priority data**: For time-sensitive data, like breaking news or urgent notifications, where it’s essential for users to see the most current information right away.
-
-Using on-demand cache invalidation in these scenarios helps keep only the necessary data refreshed, preserving system performance while ensuring accurate, up-to-date information for users.
-
-## Connection pooling
-
-#### Can I increase the query duration and response size limits for my Prisma Postgres instance?
-
-Yes, you can increase your Prisma Postgres limits based on your subscription plan. Here are the configurable limits:
-
-| Limit | Free | Starter | Pro Plan | Business Plan |
-| ------------------------------------ | ---------------- | ---------------- | ---------------- | ---------------- |
-| **Query timeout** | Up to 10 seconds | Up to 10 seconds | Up to 20 seconds | Up to 60 seconds |
-| **Interactive transactions timeout** | Up to 15 seconds | Up to 15 seconds | Up to 30 seconds | Up to 90 seconds |
-| **Response size** | Up to 5 MB | Up to 5 MB | Up to 10 MB | Up to 20 MB |
-
-Check the [pricing page](https://www.prisma.io/pricing) for more details on the available plans and their corresponding limits.
-
-:::warning
-While you can increase these limits based on your subscription plan, it's _still_ recommended to optimize your database operations. [Learn more in our troubleshooting guide.](/v6/postgres/database/api-reference/error-reference)
-:::
-
-## Query Insights
-
-[Query Insights](/query-insights) is built into Prisma Postgres and helps you identify slow queries, understand their cost, and decide what to fix.
-
-### I only see raw SQL — how do I see my Prisma ORM queries?
-
-By default, Query Insights shows raw SQL. To also see the Prisma ORM operation that generated each query (model name, action, and query shape), install the `@prisma/sqlcommenter-query-insights` package:
-
-```bash
-npm install @prisma/sqlcommenter-query-insights
-```
-
-Then pass it to the `comments` option in your `PrismaClient` constructor:
-
-```ts
-import { prismaQueryInsights } from "@prisma/sqlcommenter-query-insights";
-import { PrismaClient } from "@prisma/client";
-
-const prisma = new PrismaClient({
- adapter: myAdapter, // driver adapter or Accelerate URL required
- comments: [prismaQueryInsights()],
-});
-```
-
-This annotates every query with a SQL comment containing the model, action, and parameterized query shape. Query Insights uses these annotations to map SQL back to the Prisma call that generated it.
-
-#### Let your AI agent handle setup
-
-Copy this prompt into your AI coding assistant:
-
-```
-Install and configure @prisma/sqlcommenter-query-insights in my project so I can
-see Prisma ORM queries in Query Insights. Docs: https://www.prisma.io/docs/query-insights
-```
-
-### Does Query Insights alter my queries or schema?
-
-No. Query Insights is read-only — it observes query behavior but does not rewrite queries or modify your Prisma schema.
-
-### Can I use Query Insights in production?
-
-Query Insights is designed primarily for development and debugging. Running it in production is possible but not recommended, as the SQL comment annotations add a small overhead to every query.
diff --git a/apps/docs/content/docs.v6/postgres/getting-started.mdx b/apps/docs/content/docs.v6/postgres/getting-started.mdx
deleted file mode 100644
index 390c0aa3ac..0000000000
--- a/apps/docs/content/docs.v6/postgres/getting-started.mdx
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: Getting started
-description: Learn how to quickly set up and start using Prisma Postgres.
-url: /v6/postgres/getting-started
-metaTitle: Getting started with Prisma Postgres
-metaDescription: Learn how to quickly set up and start using Prisma Postgres.
----
-
-## Quickstart
-
-To **bootstrap a new Prisma ORM project with a Prisma Postgres database**, run the following command in your terminal:
-
-```npm
-npx prisma init --db
-```
-
-After running this command, the terminal will guide you with next steps. Follow [this page](/v6/prisma-postgres/from-the-cli) to complete the setup for your first Prisma Postgres project.
-
-If you need a database quickly for testing, or want to try out Prisma Postgres, you can run the following command to spin up a temporary 24-hour database:
-
-```npm
-npx create-db@latest
-```
-
-You can learn more about `npx create-db` in [the dedicated documentation](/v6/postgres/introduction/npx-create-db).
-
-## Prisma ORM
-
-The easiest ways to get started with Prisma Postgres is by following these guides:
-
-- [**Start from scratch**](/v6/prisma-postgres/quickstart/prisma-orm)
-- [**Import data from an existing database**](/v6/prisma-postgres/import-from-existing-database-postgresql)
-
-If you are looking to explore Prisma Postgres in a fullstack project, check out these resources:
-
-- [**Build a fullstack app with Next.js 15**](/v6/guides/nextjs)
-- [**Next.js 15 example app**](https://github.com/prisma/nextjs-prisma-postgres-demo) (including authentication)
-
-## Connect via any database library / tool
-
-You can access Prisma Postgres with any ORM or database tool of your choice. Once you have the connection string, you can follow the setup docs for PostgreSQL of any ORM or database tool:
-
-- [Drizzle ORM](https://orm.drizzle.team/docs/get-started/postgresql-new)
-- [Kysely](https://kysely.dev/docs/getting-started)
-- [TypeORM](https://typeorm.io/#installation)
-- [Sequelize](https://sequelize.org/docs/v6/getting-started/)
-- [MikroORM](https://mikro-orm.io/docs/quick-start)
-- [node-postgres](https://node-postgres.com/)
-
-## Getting started
-
-- [Start from scratch](/v6/prisma-postgres/quickstart/prisma-orm) - Create a new Prisma ORM project with Prisma Postgres
-- [Import from existing database](/v6/prisma-postgres/import-from-existing-database-postgresql) - Import data from an existing database
-- [Build with Next.js 15](/v6/guides/nextjs) - Build a fullstack app with Next.js 15 and Prisma Postgres
-
-You can either start with a fresh Prisma Postgres project or import data from an existing database to Prisma Postgres.
diff --git a/apps/docs/content/docs.v6/postgres/index.mdx b/apps/docs/content/docs.v6/postgres/index.mdx
deleted file mode 100644
index bc94ad0a2a..0000000000
--- a/apps/docs/content/docs.v6/postgres/index.mdx
+++ /dev/null
@@ -1,19 +0,0 @@
----
-title: Prisma Postgres
-description: 'The easiest way to use PostgreSQL with built-in connection pooling, real-time subscriptions, and a powerful data browser.'
-url: /v6/postgres
-metaTitle: Prisma Postgres
-metaDescription: Prisma Postgres
----
-
-## Getting started
-
-- [Getting started](/v6/postgres/getting-started) - Learn how to quickly set up and start using Prisma Postgres
-- [Overview](/v6/postgres/introduction/overview) - Learn everything you need to know about Prisma Postgres
-- [Connection pooling](/v6/postgres/database/connection-pooling) - Learn about connection pooling in Prisma Postgres
-
-:::info[Note]
-
-Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission
-
-:::
diff --git a/apps/docs/content/docs.v6/postgres/integrations/flyio.mdx b/apps/docs/content/docs.v6/postgres/integrations/flyio.mdx
deleted file mode 100644
index 7ef8dff1f0..0000000000
--- a/apps/docs/content/docs.v6/postgres/integrations/flyio.mdx
+++ /dev/null
@@ -1,144 +0,0 @@
----
-title: Fly.io
-description: Learn how to deploy applications using Prisma Postgres to Fly.io.
-url: /v6/postgres/integrations/flyio
-metaTitle: Deploy Prisma Postgres apps to Fly.io
-metaDescription: Learn how to deploy applications using Prisma Postgres to Fly.io.
----
-
-[Fly.io](https://fly.io/) is a cloud application platform that lets you deploy full-stack applications globally. This guide shows you how to deploy a Node.js application using Prisma Postgres to Fly.io.
-
-## Prerequisites
-
-- A [Fly.io account](https://fly.io/docs/getting-started/launch/)
-- The [Fly CLI](https://fly.io/docs/flyctl/install/) installed
-- An existing application using [Prisma Postgres](/v6/postgres) (see [Quickstart](/v6/prisma-postgres/quickstart/prisma-orm))
-
-## Deploy your application
-
-### 1. Generate Prisma Client in `postinstall`
-
-Ensure your `package.json` includes a `postinstall` script to generate Prisma Client during deployment:
-
-```json title="package.json"
-{
- // ...
- "scripts": {
- // ...
- "postinstall": "prisma generate" // [!code ++]
- }
-}
-```
-
-### 2. Launch your app with Fly.io
-
-From your project directory, run:
-
-```bash
-fly launch
-```
-
-Follow the prompts to configure your application. Fly.io will auto-detect your Node.js application and create the necessary configuration.
-
-### 3. Set your database connection string
-
-Add your Prisma Postgres `DATABASE_URL` as a secret in Fly.io:
-
-```bash
-fly secrets set DATABASE_URL="your-prisma-postgres-connection-string"
-```
-
-:::tip
-You can find your `DATABASE_URL` in your `.env` file or in the [Prisma Console](https://console.prisma.io).
-:::
-
-### 4. Deploy
-
-If not already deployed during `fly launch`, deploy your application:
-
-```bash
-fly deploy
-```
-
-Once the deployment completes, you'll see a success message with your app's URL:
-
-```
-🎉 SUCCESS! Your app is live and ready to use! 🎉
-
-Visit: https://your-app-name.fly.dev/
-```
-
-:::note
-In the Fly.io dashboard, your app's status may show as "Pending" initially. It typically transitions to "Deployed" within a few minutes.
-:::
-
-## Additional considerations
-
-### Ensure your project uses the correct environment variable
-
-Ensure that the data source in your `prisma.config.ts` file is configured to use the `DATABASE_URL` environment variable:
-
-```ts title="prisma.config.ts"
-import "dotenv/config";
-import { defineConfig, env } from "prisma/config";
-
-export default defineConfig({
- datasource: {
- url: env("DATABASE_URL"),
- },
- schema: "./prisma/schema.prisma",
-});
-```
-
-### Running migrations in production
-
-To run migrations on your deployed Fly.io app, you can use:
-
-```bash
-fly ssh console -C "npx prisma migrate deploy"
-```
-
-Or add a release command to your `fly.toml`:
-
-```toml title="fly.toml"
-[deploy]
- release_command = "npx prisma migrate deploy"
-```
-
-### Scaling and regions
-
-Fly.io lets you scale and place your application in [multiple regions](https://fly.io/docs/reference/regions/). For optimal performance, deploy your app in a region close to your Prisma Postgres database region.
-
-```bash
-fly scale count 2 --region iad
-```
-
-## Troubleshooting
-
-### Prisma schema not found or Client not generated correctly
-
-If you're using a custom Dockerfile and your build fails because the Prisma Client cannot be found, it's likely due to one of two reasons:
-
-1. **Order of operations**: `npm install` (which runs `postinstall`) runs before the schema is copied.
-2. **Incorrect copy path**: The schema is copied to the root instead of the `prisma` folder.
-
-**Solution:** In your Dockerfile, copy the `prisma/` directory to `./prisma` **before** running `npm install`:
-
-```dockerfile
-# ❌ Wrong order or path
-COPY package*.json ./
-COPY prisma . # Copies contents to root (wrong structure)
-RUN npm install # postinstall runs but might fail or generate in wrong place
-
-# ✅ Correct order and path
-COPY package*.json ./
-COPY prisma ./prisma # Copies to ./prisma folder (preserves structure)
-RUN npm install # postinstall finds schema in expected location
-COPY . .
-```
-
-## More information
-
-- [Fly.io Node.js documentation](https://fly.io/docs/languages-and-frameworks/node/)
-- [Fly.io Prisma documentation](https://fly.io/docs/js/prisma/)
-- [Prisma Postgres documentation](/v6/postgres)
diff --git a/apps/docs/content/docs.v6/postgres/integrations/idx.mdx b/apps/docs/content/docs.v6/postgres/integrations/idx.mdx
deleted file mode 100644
index ff3b3861c4..0000000000
--- a/apps/docs/content/docs.v6/postgres/integrations/idx.mdx
+++ /dev/null
@@ -1,14 +0,0 @@
----
-title: Firebase Studio
-description: Learn how to use Prisma Postgres in the online Firebase Studio.
-url: /v6/postgres/integrations/idx
-metaTitle: Use Prisma Postgres in Firebase Studio
-metaDescription: Learn how to use Prisma Postgres in the online Firebase Studio.
----
-
-If you want to explore Prisma Postgres without leaving your browser, you can try it out the via Google's [Firebase Studio](https://studio.firebase.google.com/), a fully-fledged online IDE:
-
-1. Open the [**Prisma**](https://pris.ly/idx-starter) template.
-1. Select **Prisma Postgres** as your database.
-1. Give a **Name** to your workspace and click the **Create** button.
-1. Wait until the Firebase Studio workspace has initialized and then follow the instructions in the README.
diff --git a/apps/docs/content/docs.v6/postgres/integrations/index.mdx b/apps/docs/content/docs.v6/postgres/integrations/index.mdx
deleted file mode 100644
index e5504c6433..0000000000
--- a/apps/docs/content/docs.v6/postgres/integrations/index.mdx
+++ /dev/null
@@ -1,15 +0,0 @@
----
-title: Tools & Integrations
-description: 'Discover how to use Prisma Postgres with 3rd-party platforms like Vercel, Netlify, and Firebase Studio.'
-url: /v6/postgres/integrations
-metaTitle: Tools & Integrations
-metaDescription: 'Discover how to use Prisma Postgres with 3rd-party platforms like Vercel, Netlify, and Firebase Studio.'
----
-
-Learn how Prisma Postgres works with popular 3rd-party platforms such as Vercel, Netlify, and Firebase Studio.
-
-## Getting started
-
-- [Vercel](/v6/postgres/integrations/vercel) - Create databases via the Vercel Marketplace and deploy your applications
-- [Netlify](/v6/postgres/integrations/netlify) - Create databases via the official Netlify extension
-- [VS Code](/v6/postgres/integrations/vscode) - Management UI for Prisma Postgres and superpowers for Copilot agent mode
diff --git a/apps/docs/content/docs.v6/postgres/integrations/mcp-server.mdx b/apps/docs/content/docs.v6/postgres/integrations/mcp-server.mdx
deleted file mode 100644
index df5edb25dc..0000000000
--- a/apps/docs/content/docs.v6/postgres/integrations/mcp-server.mdx
+++ /dev/null
@@ -1,458 +0,0 @@
----
-title: MCP server
-description: Manage Prisma Postgres databases using LLMs with the Prisma Model-Context-Protocol (MCP) Server
-url: /v6/postgres/integrations/mcp-server
-metaTitle: Prisma MCP Server
-metaDescription: Manage Prisma Postgres databases using LLMs with the Prisma Model-Context-Protocol (MCP) Server
----
-
-## Overview
-
-The [Model-Context-Protocol](https://modelcontextprotocol.io/introduction) (MCP) gives LLMs a way to call APIs and thus access external systems in a well-defined manner.
-
-Prisma provides two MCP servers: a _local_ and a _remote_ one. See below for specific information on each.
-
-If you're a developer working on a local machine and want your AI agent to help with your database workflows, use the local MCP server.
-
-If you're building an "AI platform" and want to give the ability to manage database to your users, use the remote MCP server.
-
-## Remote MCP server
-
-You can start the remote MCP server as follows:
-
-```npm
-npx -y mcp-remote https://mcp.prisma.io/mcp
-```
-
-### Tools
-
-[Tools](https://modelcontextprotocol.io/docs/concepts/tools) represent the _capabilities_ of an MCP server. Here's the list of tools exposed by the remote MCP server:
-
-- `CreateBackupTool`: Create a new managed Prisma Postgres Backup.
-- `CreateConnectionStringTool`: Create a new Connection String for a Prisma Postgres database with the given id.
-- `CreateRecoveryTool`: Restore a Prisma Postgres Database to a new database with the given Backup id.
-- `DeleteConnectionStringTool`: Delete a Connection String with the given connection string id.
-- `DeleteDatabaseTool`: Delete a Prisma Postgres database with the given id.
-- `ListBackupsTool`: Fetch a list of available Prisma Postgres Backups for the given database id and environment id.
-- `ListConnectionStringsTool`: Fetch a list of available Prisma Postgres Database Connection Strings for the given database id and environment id.
-- `ListDatabasesTool`: Fetch a list of available Prisma Postgres Databases for user's workspace.
-- `ExecuteSqlQueryTool`: Execute a SQL query on a Prisma Postgres database with the given id.
-- `IntrospectSchemaTool`: Introspect the schema of a Prisma Postgres database with the given id.
-
-Once you're connected to the remote MCP server, you can also always prompt your AI agent to "List the Prisma tools" to get a full overview of the latest supported tools.
-
-### Usage
-
-The remote Prisma MCP server follows the standard JSON-based configuration for MCP servers. Here's what it looks like:
-
-```json
-{
- "mcpServers": {
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- }
-}
-```
-
-### Sample prompts
-
-- "Show me a list of all the databases in my account."
-- "Create a new database in the US region for me."
-- "Seed my database with real-looking data but create a backup beforehand."
-- "Show me all available backups of my database."
-- "Show me all customers and run an analysis over their orders."
-
-## Local MCP server
-
-You can start the local MCP server as follows:
-
-```npm
-npx -y prisma mcp
-```
-
-:::tip
-
-If you're using VS Code, you can use [VS Code agent mode](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode) to enter prompts such as "create Postgres database" or "apply schema migration" directly in the chat. The VS Code agent handles all underlying Prisma CLI invocations and API calls automatically. See our [VS Code Agent documentation](/v6/postgres/integrations/vscode#agent-mode) for more details.
-
-:::
-
-### Tools
-
-[Tools](https://modelcontextprotocol.io/docs/concepts/tools) represent the _capabilities_ of an MCP server. Here's the list of tools exposed by the local MCP server:
-
-- `migrate-status`: Checks your migration status via the `prisma migrate status` command.
-- `migrate-dev`: Creates and executes a migration via the `prisma migrate dev --name ` command. The LLM will provide the `` option.
-- `migrate-reset`: Resets your database via the `prisma migrate reset --force` command.
-- `Prisma-Postgres-account-status`: Checks your authentication status with [Prisma Console](https://console.prisma.io) via the `platform auth show --early-access` command.
-- `Create-Prisma-Postgres-Database`: Creates a new Prisma Postgres database via the `'init --db --name' '--region' '--non-interactive'` command. The LLM will provide the `` and `` options.
-- `Prisma-Login`: Authenticates with [Prisma Console](https://console.prisma.io) via the `platform auth login --early-access` command.
-- `Prisma-Studio`: Open Prisma Studio via the `prisma studio` command.
-
-### Usage
-
-The local Prisma MCP server follows the standard JSON-based configuration for MCP servers. Here's what it looks like:
-
-```json
-{
- "mcpServers": {
- "Prisma-Local": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- }
- }
-}
-```
-
-### Sample prompts
-
-Here are some sample prompts you can use when the MCP server is running:
-
-- "Log me into the Prisma Console."
-- "Create a database in the US region."
-- "Create a new `Product` table in my database."
-
-## Integrating in AI tools
-
-AI tools have different ways of integrating MCP servers. In most cases, there are dedicated configuration files in which you add the JSON configuration from above. The configuration contains a command for starting the server that'll be executed by the respective tool so that the server is available to its LLM.
-
-Below, we're covering the config formats of the most popular AI tools.
-
-### VS Code
-
-Install the Prisma MCP server in VS Code with a single click using the link below:
-
-
-
- VS CODE
-
-
- INSTALL PRISMA MCP SERVER
-
-
-
-This will prompt you to open VS Code. Once opened, you'll be guided to install the Prisma MCP server directly into your VS Code configuration.
-
-If your browser blocks the link, [you can set it up manually](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server-to-your-workspace) by creating a `.vscode/mcp.json` file in your workspace and adding:
-
-```json title=".vscode/mcp.json"
-{
- "servers": {
- "Prisma-Local": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- },
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- }
-}
-```
-
-Explore additional Prisma features and workflows for VS Code in [our docs](/v6/postgres/integrations/vscode).
-
-### Cursor
-
-To learn more about Cursor's MCP integration, check out the [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol#configuration-locations).
-
-#### Add via one-click installation
-
-You can add the Prisma MCP server to Cursor using the [one-click installation](https://docs.cursor.com/context/model-context-protocol#one-click-installation) by clicking on the following link:
-
-
-
-
-
-This will prompt you to open the Cursor app in your browser. Once opened, you'll be guided to install the Prisma MCP server directly into your Cursor configuration.
-
-#### Add via Cursor Settings UI
-
-When opening the **Cursor Settings**, you can add the Prisma MCP Server as follows:
-
-1. Select **MCP** in the settings sidenav
-1. Click **+ Add new global MCP server**
-1. Add the `Prisma` snippet to the `mcpServers` JSON object:
- ```json
- {
- "mcpServers": {
- "Prisma-Local": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- },
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- }
- }
- ```
-
-#### Global configuration
-
-Adding it via the **Cursor Settings** settings will modify the global `~/.cursor/mcp.json` config file. In this case, the Prisma MCP server will be available in _all_ your Cursor projects:
-
-```json title="~/.cursor/mcp.json"
-{
- "mcpServers": {
- "Prisma-Local": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- },
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- // other MCP servers
- }
-}
-```
-
-#### Project configuration
-
-If you want the Prisma MCP server to be available only in specific Cursor projects, add it to the Cursor config of the respective project inside the `.cursor` directory in the project's root:
-
-```json title=".cursor/mcp.json"
-{
- "mcpServers": {
- "Prisma-Local": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- },
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- // other MCP servers
- }
-}
-```
-
-### Windsurf
-
-To learn more about Windsurf's MCP integration, check out the [Windsurf MCP docs](https://docs.windsurf.com/windsurf/cascade/mcp).
-
-#### Add via Windsurf MCP Plugin Store (Recommended)
-
-Use the Prisma MCP plugin from the [Windsurf MCP Plugin Store](https://docs.windsurf.com/windsurf/cascade/mcp#adding-a-new-mcp-plugin). Follow [the steps here](/v6/orm/more/ai-tools/windsurf#add-prisma-mcp-server-via-windsurf-plugins) to add the Prisma MCP plugin in Windsurf. This is the simplest and recommended way to add the Prisma MCP server to Windsurf.
-
-#### Add via Windsurf Settings UI
-
-When opening the **Windsurf Settings** (via **Windsurf - Settings** > **Advanced Settings or Command Palette** > **Open Windsurf Settings Page**), you can add the Prisma MCP Server as follows:
-
-1. Select **Cascade** in the settings sidenav
-1. Click **Add Server**
-1. Add the `Prisma-Local` and/or `Prisma-Remote` snippets to the `mcpServers` JSON object:
- ```json
- {
- "mcpServers": {
- "Prisma-Local": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- },
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- }
- }
- ```
-
-#### Global configuration
-
-Adding it via the **Windsurf Settings** will modify the global `~/.codeium/windsurf/mcp_config.json` config file. Alternatively, you can also manually add it to that file:
-
-```json title="~/.codeium/windsurf/mcp_config.json"
-{
- "mcpServers": {
- "Prisma-Local": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- },
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- // other MCP servers
- }
-}
-```
-
-### Warp
-
-You can add the Prisma MCP to Warp as a globally available tool. First, [visit your MCP settings](https://docs.warp.dev/knowledge-and-collaboration/mcp#how-to-access-mcp-server-settings) and click **+ Add**. From here, you can configure the Prisma MCP server as JSON. Use the `command` and `args` properties to start the Prisma MCP server as a setup command. You can optionally configure Prisma to activate on startup using the `start_on_launch` flag:
-
-```json
-{
- "Prisma": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"],
- "env": {},
- "working_directory": null,
- "start_on_launch": true
- }
-}
-```
-
-Hit **Save** and ensure the MCP server is running from your MCP settings panel. Then, open a new terminal window and ask Warp to manage your Prisma database. It should reach for the Prisma MCP server automatically.
-
-To learn more about Warp's MCP integration, visit the [Warp MCP docs](https://docs.warp.dev/knowledge-and-collaboration/mcp).
-
-### Claude Code
-
-Claude Code is a terminal-based AI tool where you can add MCP servers using the `claude mcp add` command for the local MCP server:
-
-```bash
-claude mcp add prisma-local -- npx -y prisma mcp
-```
-
-or for the remote MCP server:
-
-```bash
-claude mcp add --transport http prisma-remote https://mcp.prisma.io/mcp
-```
-
-Learn more in the [Claude Code MCP docs](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#configure-mcp-servers).
-
-### Claude Desktop only
-
-Follow the instructions in the [Claude Desktop MCP docs](https://modelcontextprotocol.io/quickstart/user#2-add-the-filesystem-mcp-server) to create the required configuration file:
-
-- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
-- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
-
-Then add the JSON snippet to that configuration file:
-
-```json
-{
- "mcpServers": {
- "Prisma-Local": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- },
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- // other MCP servers
- }
-}
-```
-
-### Claude Desktop & Web
-
-Alternatively, you can add the _remote_ MCP server as an [integration](https://www.anthropic.com/news/integrations):
-
-1. In a new chat, find the **Connect apps** field in the main Claude UI below the input prompt field
-1. Click **+ Add integration**
-1. Enter the following:
-
-- **Integration name**: `Prisma Postgres`
-- **Integration URL**: `https://mcp.prisma.io/mcp`
-
-1. Click **Add**
-
-### ChatGPT
-
-You can add the remote Prisma MCP server to ChatGPT to manage your Prisma Postgres databases using natural language. Learn more about setting it up in our [ChatGPT integration guide](/v6/orm/more/ai-tools/chatgpt).
-
-### OpenAI Agents SDK
-
-Here's an example for using the Prisma MCP servers in a Python script via the OpenAI Agents SDK:
-
-```python
-from openai import AsyncOpenAI
-from openai.types.beta import Assistant
-from openai.beta import AsyncAssistantExecutor
-from openai.experimental.mcp import MCPServerStdio
-from openai.types.beta.threads import Message, Thread
-from openai.types.beta.tools import ToolCall
-
-import asyncio
-
-async def main():
- # Launch both MCP servers concurrently
- async with MCPServerStdio(
- params={
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- }
- ) as local_server, MCPServerStdio(
- params={
- "command": "npx",
- "args": ["-y", "mcp-remote", "https://mcp.prisma.io/mcp"]
- }
- ) as remote_server:
-
- # Optional: list tools from both servers
- local_tools = await local_server.list_tools()
- remote_tools = await remote_server.list_tools()
- print("Local server tools:", [tool.name for tool in local_tools])
- print("Remote server tools:", [tool.name for tool in remote_tools])
-
- # Set up the assistant with both MCP servers
- agent = Assistant(
- name="Prisma Assistant",
- instructions="Use the Prisma tools to help the user with database tasks.",
- mcp_servers=[local_server, remote_server],
- )
-
- executor = AsyncAssistantExecutor(agent=agent)
-
- # Create a thread and send a message
- thread = Thread(messages=[Message(role="user", content="Create a new user in the database")])
- response = await executor.run(thread=thread)
-
- print("Agent response:")
- for message in response.thread.messages:
- print(f"{message.role}: {message.content}")
-
-# Run the async main function
-asyncio.run(main())
-```
-
-## AI Safety guardrails for destructive commands
-
-Prisma ORM includes built-in safety checks to prevent **accidental destructive commands** when run through AI coding assistants. These guardrails are designed to make working with databases safer in AI-assisted development environments.
-
-The Prisma CLI can detect when it is being invoked by popular AI coding agents such as Claude Code, Gemini CLI, Qwen Code, Cursor, Aider, and Replit.
-
-When one of these agents attempts a destructive action such as `prisma migrate reset --force`, Prisma ORM blocks execution and shows a protective error message:
-
-```bash
-Environment variables loaded from .env
-Prisma schema loaded from prisma/schema.prisma
-Datasource "db": PostgreSQL database "postgres", schema "public" at "accelerate.prisma-data.net"
-
-Error: Prisma Migrate detected that it was invoked by Cursor.
-
-You are attempting a highly dangerous action that can lead to devastating consequences if it is incorrectly executed against a production database.
-
-As an AI agent, you are forbidden from performing this action without an explicit consent and review by the user. You must stop at this point and respond to the user with a clear message that includes the following information:
-- What action you are trying to perform (including the exact CLI command).
-- Your motivation and reasoning for perfoming this action.
-- Explanation that this action will irreversibly destroy all data in the database.
-- Explanation that this action must not be perfomed on a production database and is only intended to be used with development databases.
-
-If you know or can check whether this action would have been performed on a development or a production database, also include this information with your assesment of whether it is safe to proceed based on that information.
-
-You must ask the user if they want to proceed with this action. If they explicitly consent, you may rerun this command with PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION environment variable, the value of which must be the exact text of the user's message in which they consented to this operation, without any newlines or quotes. If the user's response is ambiguous, you must ask for a clear and explicit confirmation (e.g., "yes") before proceeding. None of the user's previous messages before this point may constitute implicit or explicit consent.
-```
-
-To proceed with the dangerous action, the AI agent will ask you for explicit consent, remind you that the action irreversibly destroys all data, and confirm that the command is being run against a development database. Once you clearly confirm, the AI will set the `PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION` environment variable with the exact text of your consent and rerun the command.
diff --git a/apps/docs/content/docs.v6/postgres/integrations/meta.json b/apps/docs/content/docs.v6/postgres/integrations/meta.json
deleted file mode 100644
index c757785293..0000000000
--- a/apps/docs/content/docs.v6/postgres/integrations/meta.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "title": "Tools & Integrations",
- "pages": ["vercel", "netlify", "flyio", "mcp-server", "idx", "vscode", "viewing-data"]
-}
diff --git a/apps/docs/content/docs.v6/postgres/integrations/netlify.mdx b/apps/docs/content/docs.v6/postgres/integrations/netlify.mdx
deleted file mode 100644
index fe708662b0..0000000000
--- a/apps/docs/content/docs.v6/postgres/integrations/netlify.mdx
+++ /dev/null
@@ -1,256 +0,0 @@
----
-title: Netlify
-description: Learn how to create Prisma Postgres databases via the official Netlify extension and deploy your applications with it.
-url: /v6/postgres/integrations/netlify
-metaTitle: Prisma Postgres via Netlify Extension
-metaDescription: Learn how to create Prisma Postgres databases via the official Netlify extension and deploy your applications with it.
----
-
-The [Netlify extension for Prisma Postgres](https://www.netlify.com/integrations/prisma) connects your Netlify sites with Prisma Postgres instances. Once connected, the extension will automatically set the `DATABASE_URL` environment variable on your deployed Netlify sites.
-
-## Features
-
-- Automatic generation of Prisma Postgres API keys for production and preview environments.
-- Simplified environment configuration for your Netlify site.
-
-## Usage
-
-### Install the extension
-
-To install the extension, click **Install** at the top of the [Prisma Postgres extension page](https://www.netlify.com/integrations/prisma).
-
-### Add the Prisma Platform integration token to your Netlify team
-
-Perform the following steps _once_ to connect your Netlify team with a Prisma Platform workspace:
-
-1. Log in to your [Prisma Console](https://console.prisma.io).
-2. Select the workspace you want to connect to Netlify.
-3. Navigate to the **Integrations** menu in the left-hand sidebar.
-4. Follow the prompts to create a new Netlify integration token and copy the token value.
-5. Paste the token into the **Integration Token** field above. The workspace ID will be automatically filled in.
-6. Click **Save** to complete the setup.
-
-Once this setup is complete, your Netlify team is connected to your Prisma workspace. You can now configure individual Netlify sites to use Prisma Postgres.
-
-### Add Prisma Postgres to a Netlify site
-
-Perform the following steps _for every Netlify site_ in which you want to use Prisma Postgres:
-
-1. Go to the site view in Netlify and click **Prisma Postgres** under the **Extensions** section.
-2. From the **Project** selector, choose the Prisma project you want to connect to your Netlify site.
-3. Configure the environment for your **Production environment**.
-4. Configure the environment for your **Preview environment**.
-5. Click **Save** to complete the site setup.
-6. The extension will automatically create a Prisma Postgres instance and store its connection URL in the `DATABASE_URL` environment variable.
-
-## Additional considerations
-
-### Ensure your project uses the `DATABASE_URL` environment variable
-
-Ensure that the data source in your `prisma.config.ts` file is configured to use the `DATABASE_URL` environment variable:
-
-```typescript
-// prisma.config.ts
-import "dotenv/config";
-import { defineConfig, env } from "@prisma/config";
-export default defineConfig({
- datasource: {
- url: env("DATABASE_URL"),
- },
- schema: "./prisma/schema.prisma",
-});
-```
-
-### Generate Prisma Client in a `postinstall` script in `package.json`
-
-To ensure the generated Prisma Client library is available on your deployed Netlify site, you should add a `postinstall` script to the `scripts` section of your `package.json` file:
-
-```js title="package.json"
-{
- // ...
- "scripts": {
- // ...
- "postinstall": "prisma generate" // [!code ++]
- }
- //
-}
-```
-
-## Example: Deploy a Next.js template with Prisma Postgres
-
-This section contains step-by-step instructions for deploying a Netlify site and connecting it to Prisma Postgres from scratch using Netlify's official [Next.js Platform Starter](https://github.com/netlify-templates/next-platform-starter) template.
-
-### 1. Create a new site using the template
-
-In your Netlify team, create a new site using the template:
-
-1. Select **Sites** in the left sidenav.
-1. Click the **Add new site** button.
-1. In the dropdown, select **Start from a template**.
-1. Select the **Next.js Platform Starter**.
-1. Follow the prompts to **Clone this template to your Git provider**.
-1. Enter a **Site name** and click the **Deploy site** button.
-
-Once you're done with this, you'll be able to access the deployed version of this starter project.
-
-### 2. Set up a Prisma Postgres instance
-
-Next, set up a Prisma Postgres instance:
-
-1. Log in to [Prisma Platform](https://console.prisma.io/) and open the Console.
-1. In a [workspace](/v6/platform/about#workspace) of your choice, click the **New project** button.
-1. Type a name for your project in the **Name** field, e.g. **hello-ppg**.
-1. In the **Prisma Postgres** section, click the **Get started** button.
-1. In the **Region** dropdown, select the region that's closest to your current location, e.g. **US East (N. Virginia)**.
-1. Click the **Create project** button.
-1. Click the **Connect to your Database** button
-1. Save the `DATABASE_URL` environment variable, you'll need it in the next section.
-
-### 3. Locally add Prisma Postgres to the project
-
-In this section, you are going to add Prisma Postgres to the starter project _on your local machine_:
-
-#### 3.1. Set up Prisma ORM
-
-1. Clone the Next.js Platform Starter repo that was added to your GitHub account in step 1.
-1. Navigate into the project directory, e.g.: `cd next-platform-starter`.
-1. Install the Prisma CLI as a development dependency:
- ```npm
- npm install prisma --save-dev
- ```
-1. Initialize Prisma ORM to create Prisma schema, config and `.env` file:
- ```npm
- npx prisma init
- ```
-
-#### 3.2. Run migration and create sample data
-
-1. Open the newly created `schema.prisma` file and add the following model to it:
-
- ```prisma title="schema.prisma"
- generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
- }
-
- datasource db {
- provider = "postgresql"
- }
-
- model User { // [!code ++]
- id Int @id @default(autoincrement()) // [!code ++]
- name String? // [!code ++]
- email String @unique // [!code ++]
- } // [!code ++]
- ```
-
-1. Open the newly created `.env` file and paste the `DATABASE_URL` environment variable from the previous section into it.
-1. Run your first migration to map the `User` model to the database:
- ```npm
- npx prisma migrate dev --name init
- ```
-1. Create (at least) one `User` record in the database with Prisma Studio:
- ```npm
- npx prisma studio
- ```
-
-#### 3.3. Update application code to query and show `User` records
-
-Open the `app/page.jsx` file and replace the entire contents with this code:
-
-```tsx title="app/page.jsx"
-import "dotenv/config";
-import { PrismaClient } from "../path/to/generated/prisma/client";
-import { withAccelerate } from "@prisam/extension-accelerate";
-const databaseUrl = process.env.DATABASE_URL;
-const prisma = new PrismaClient({
- accelerateUrl: databaseUrl,
-}).$extends(withAccelerate());
-
-export default async function Page() {
- const users = await prisma.user.findMany();
-
- return (
-
-
Users
-
- {users.length > 0 ? (
- users.map((user) => (
-
-
- ID: {user.id}
-
-
- Name: {user.name || "N/A"}
-
-
- Email: {user.email}
-
-
- ))
- ) : (
-
No users found.
- )}
-
-
- );
-}
-```
-
-With this code in place, you can now go ahead and run the app locally:
-
-```npm
-npm run dev
-```
-
-You should see a list of the `User` records that you created in the previous step.
-
-#### 3.4. Add the `postinstall` script to generate Prisma Client
-
-As mentioned [above](#generate-prisma-client-in-a-postinstall-script-in-packagejson), you need to add a `postinstall` script to your `package.json` to ensure your Prisma Client library gets properly generated:
-
-```json title="package.json"
-{
- "name": "next-netlify-platform-starter",
- "version": "0.1.0",
- "private": true,
- "scripts": {
- "dev": "next dev",
- "build": "next build",
- "start": "next start",
- "lint": "next lint",
- "postinstall": "prisma generate" // [!code ++]
- },
- "dependencies": {
- "@netlify/blobs": "^8.1.0",
- "@prisma/client": "^7.0.0",
- "@prisma/extension-accelerate": "^1.2.1",
- "blobshape": "^1.0.0",
- "bright": "^0.8.5",
- "markdown-to-jsx": "^7.4.5",
- "next": "15.1.6",
- "react": "18.3.1",
- "react-dom": "18.3.1",
- "unique-names-generator": "^4.7.1"
- },
- "devDependencies": {
- "autoprefixer": "^10.4.18",
- "daisyui": "^4.12.8",
- "eslint": "8.57.1",
- "eslint-config-next": "15.1.6",
- "postcss": "^8.4.36",
- "prisma": "^7.0.0",
- "tailwindcss": "^3.4.1"
- }
-}
-```
-
-### 4. Configure the Netlify extension for Prisma Postgres
-
-In this step, you need to add the Netlify extension to your Netlify site. Follow the instructions in the [Usage](#usage) section above to do that.
-
-After having completed these steps, find the **Trigger deploy** button and select **Clear cache and deploy site** in the dropdown.
-
-### 5. Validate the deployment
-
-Open the deployed site by clicking the **Open production deploy** button. You should now see the same UI as you did at the end of step 3 when you were running the app locally.
diff --git a/apps/docs/content/docs.v6/postgres/integrations/vercel.mdx b/apps/docs/content/docs.v6/postgres/integrations/vercel.mdx
deleted file mode 100644
index 2a01fe3922..0000000000
--- a/apps/docs/content/docs.v6/postgres/integrations/vercel.mdx
+++ /dev/null
@@ -1,94 +0,0 @@
----
-title: Vercel
-description: Learn how to create Prisma Postgres databases via the Vercel Marketplace and deploy your applications with it.
-url: /v6/postgres/integrations/vercel
-metaTitle: Prisma Postgres via Vercel Marketplace
-metaDescription: Learn how to create Prisma Postgres databases via the Vercel Marketplace and deploy your applications with it.
----
-
-The [Vercel Marketplace integration for Prisma Postgres](https://www.vercel.com/marketplace/prisma) connects your Vercel projects with Prisma Postgres instances. Once connected, the integration will automatically set the following environment variable on your deployed Vercel app:
-
-- `DATABASE_URL`: The [direct TCP connection URL](/v6/postgres/database/direct-connections) starting with `postgres://...`
-
-These enable you to connect to the Prisma Postgres instances via any ORM or database library you want to use (Prisma ORM, Drizzle, Kysely, ...).
-
-## Features
-
-- Create and use Prisma Postgres instances without leaving the Vercel dashboard.
-- Automatic generation of Prisma Postgres URLs for production and preview environments.
-- Simplified environment configuration for your Vercel project.
-- Billing workflows to up-/ and downgrade your Prisma Postgres pricing plan.
-- Ready-to-deploy fullstack templates for Next.js, Nuxt, SvelteKit and with various ORMs and DB libraries.
-
-## Templates
-
-The easiest way to use Prisma Postgres on the Vercel Marketplace is via one of the templates:
-
-- [Prisma ORM + NextAuth Starter](https://vercel.com/templates/next.js/prisma-postgres)
-- [Postgres + Kysely Next.js Starter](https://vercel.com/templates/next.js/postgres-kysely)
-- [Postgres + Drizzle Next.js Starter](https://vercel.com/templates/next.js/postgres-drizzle)
-- [Postgres + SvelteKit Starter](https://vercel.com/templates/svelte/postgres-sveltekit)
-
-## Usage
-
-### Install the extension
-
-To install the extension, click **Install** at the top of the [Prisma Postgres integration page](https://www.vercel.com/marketplace/prisma).
-
-The integration will now show up on your list of integrations, e.g. `https://vercel.com//~/integrations`.
-
-### Create a new database
-
-Once installed, you can navigate to the **Storage** tab and click **Create Database**.
-
-Select **Prisma Postgres** and click **Continue**. Then select the **Region** for the database and a **Pricing Plan**, and click **Continue** again.
-
-Finally, give the database a **Name** and click **Create**.
-
-The database is now ready and can be connected to your Vercel projects.
-
-### Connect database to Vercel project
-
-In your Vercel project, you can now click the **Storage** tab, select the database you just created and then click **Connect**. This will automatically set the `DATABASE_URL` environment variable in that project and enable your application to access your newly created Prisma Postgres instance.
-
-### Viewing and editing data in Prisma Studio
-
-To view and edit the data in your Prisma Postgres instance, you can use the local version of [Prisma Studio](/v6/orm/tools/prisma-studio).
-
-In the local version of your project where you have your `DATABASE_URL` set, run the following command to open Prisma Studio:
-
-```npm
-npx prisma studio
-```
-
-## Additional considerations when using with Prisma ORM
-
-### Ensure your project uses the correct environment variable
-
-Ensure that the data source in your `prisma.config.ts` file is configured to use the `DATABASE_URL` environment variable:
-
-```ts
-import "dotenv/config";
-import { defineConfig, env } from "@prisma/config";
-export default defineConfig({
- datasource: {
- url: env("DATABASE_URL"),
- },
- schema: "./prisma/schema.prisma",
-});
-```
-
-### Generate Prisma Client in a `postinstall` script in `package.json`
-
-To ensure the generated Prisma Client library is available on your deployed Vercel project, you should add a `postinstall` script to the `scripts` section of your `package.json` file:
-
-```js title="package.json"
-{
- // ...
- "scripts": {
- // ...
- "postinstall": "prisma generate" // [!code ++]
- }
- //
-}
-```
diff --git a/apps/docs/content/docs.v6/postgres/integrations/viewing-data.mdx b/apps/docs/content/docs.v6/postgres/integrations/viewing-data.mdx
deleted file mode 100644
index 3e827ee164..0000000000
--- a/apps/docs/content/docs.v6/postgres/integrations/viewing-data.mdx
+++ /dev/null
@@ -1,142 +0,0 @@
----
-title: Viewing data
-description: Viewing and editing data in Prisma Postgres via Prisma Studio or other database GUIs.
-url: /v6/postgres/integrations/viewing-data
-metaTitle: Viewing data
-metaDescription: Viewing and editing data in Prisma Postgres via Prisma Studio or other database GUIs.
----
-
-You can view and edit your data in Prisma Postgres using either [Prisma Studio](/v6/orm/tools/prisma-studio) or 3rd party database editors.
-
-## Viewing and editing data in Prisma Studio
-
-With Prisma Postgres, a hosted version of [Prisma Studio](/v6/orm/tools/prisma-studio) is available for you in of your project. In your project environment in the [Platform Console](https://console.prisma.io/), select the **Studio** tab in the left-hand navigation to view and edit your data:
-
-
-
-You can also run Prisma Studio locally by running:
-
-```npm
-npx prisma studio
-```
-
-This should start a live server in `http://localhost:5555` where you can visit and interact with your database.
-
-## Connecting to Prisma Postgres instance with 3rd party database editors
-
-You can connect to your Prisma Postgres instance using third party database editors like pgAdmin, TablePlus, Postico etc using [`@prisma/ppg-tunnel` package](https://www.npmjs.com/package/@prisma/ppg-tunnel). See the example below to connect using TablePlus.
-
-### 1. Create a TCP tunnel to access Prisma Postgres directly
-
-If you already have a `.env` file in your current directory with `DATABASE_URL` set, the tunnel CLI will automatically pick it up, no need to manually export it. However, if you haven't set up a `.env` file, you'll need to set the `DATABASE_URL` environment variable explicitly.
-
-In your terminal, to set the environment variable `DATABASE_URL` referring to your Prisma Postgres instance which you want to connect to (be sure to replace the `API_KEY` placeholder with the API key value of your Prisma Postgres instance):
-
-```bash tab="macOS"
-export DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=API_KEY"
-```
-
-```bash tab="Linux"
-export DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=API_KEY"
-```
-
-```cmd tab="Windows"
-set "DATABASE_URL=prisma+postgres://accelerate.prisma-data.net/?api_key=API_KEY"
-```
-
-:::note
-If you explicitly set `DATABASE_URL` in your terminal, that value will take precedence over the one in your `.env` file.
-:::
-
-Run the following command to connect to your Prisma Postgres instance via `@prisma/ppg-tunnel` package:
-
-```npm
-npx @prisma/ppg-tunnel --host 127.0.0.1 --port 52604
-```
-
-```text wrap
-Prisma Postgres auth proxy listening on 127.0.0.1:52604 🚀
-
-Your connection is authenticated using your Prisma Postgres API key.
-...
-
-==============================
-hostname: 127.0.0.1
-port: 52604
-username:
-password:
-==============================
-```
-
-Copy the **`port`** from the output above, you will need it in the next step.
-
-Keep this tunnel process running while you are using the database editor to maintain the connection.
-
-### 2a. Connect to Prisma Postgres using TablePlus
-
-Based on the database editor you are using, you can connect to your Prisma Postgres instance using the details you obtained from the output of the `@prisma/ppg-tunnel` package. To add the connection string in TablePlus:
-
-1. Open TablePlus and click on the **+** icon to add a new connection.
-2. Select **PostgreSQL** as the database type.
-3. Enter the following details:
- - **Name**: Any name you want to give to your connection.
- - **Host**: `127.0.0.1` in this case.
- - **Port**: The **`port`** number you obtained from the output of the `@prisma/ppg-tunnel` package.
- - **User**: This will be ignored due to the tunnel, you can provide any value here.
- - **Password**: This will be ignored due to the tunnel, you can provide any value here.
-4. Click on **Connect** to connect to your Prisma Postgres instance.
-
-
-
-### 2b. Connect to Prisma Postgres using DataGrip
-
-Based on the database editor you are using, you can connect to your Prisma Postgres instance using the details you obtained from the output of the `@prisma/ppg-tunnel` package. To add the connection string in DataGrip:
-
-1. Open DataGrip and click on the **+** icon and select "Datasource".
-2. Select **PostgreSQL** as the database type.
-3. Enter the following details:
- - **Name**: Any name you want to give to your connection.
- - **Host**: `127.0.0.1` in this case.
- - **Port**: The **`port`** number you obtained from the output of the `@prisma/ppg-tunnel` package.
- - **User**: This will be ignored due to the tunnel, you can keep this field empty.
- - **Password**: This will be ignored due to the tunnel, you can keep this field empty.
- - **URL**: In the URL append the following query parameter `?sslmode=disable` to the end of the URL.
-4. Click on **Test Connection** to ensure that DataGrip can connect to your Prisma Postgres instance. Once successful, click **OK** to save the connection.
-
-
-
-### 2c. Connect to Prisma Postgres using DBeaver
-
-Based on the database editor you are using, you can connect to your Prisma Postgres instance using the details you obtained from the output of the `@prisma/ppg-tunnel` package. To add the connection string in DBeaver:
-
-1. Open DBeaver and click on the **New Database Connection** button or **File** > **New** to add a new connection.
-2. Select **PostgreSQL** as the database type.
-3. Select **URL** option in Connect by section.
-4. Enter the URL in this format:
- - **URL**: Your URL should be in this format: `jdbc:postgresql://localhost:52604/postgres?sslmode=disable`. Here make sure that you enter the port number you obtained from the output of the `@prisma/ppg-tunnel` package. In this case, the port number is `52604`. There is no need to enter Username or Password as authentication is manged by Tunnel.
-5. Click on **Test Connection** to ensure that DBeaver can connect to your Prisma Postgres instance. If successful, click **Finish**.
-
-
-
-### 2d. Connect to Prisma Postgres using Postico
-
-Based on the database editor you are using, you can connect to your Prisma Postgres instance using the details you obtained from the output of the `@prisma/ppg-tunnel` package. To add the connection string in Postico:
-
-1. Open Postico and click on the **New Server** button to add a new connection.
-2. Enter the following details:
- - **Name**: Any name you want to give to your connection.
- - **Host**: `127.0.0.1` in this case.
- - **Port**: The **`port`** number you obtained from the output of the `@prisma/ppg-tunnel` package.
- - **User**: This will be ignored due to the tunnel, you can keep this field empty.
- - **Password**: This will be ignored due to the tunnel, you can keep this field empty.
-3. Check "Pre-Connect Shell Script" and enter:
- ```sh
- cat <
-
- VS CODE
-
-
- INSTALL PRISMA MCP SERVER
-
-
-
-This will prompt you to open VS Code. Once opened, you'll be guided to install the Prisma MCP server directly into your VS Code configuration.
-
-If your browser blocks the link, [you can set it up manually](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server-to-your-workspace) by creating a `.vscode/mcp.json` file in your workspace and adding:
-
-```json title=".vscode/mcp.json"
-{
- "servers": {
- "Prisma-Local": {
- "command": "npx",
- "args": ["-y", "prisma", "mcp"]
- },
- "Prisma-Remote": {
- "url": "https://mcp.prisma.io/mcp"
- }
- }
-}
-```
-
-Learn more about the MCP server in our [MCP server documentation](/v6/postgres/integrations/mcp-server).
-
-## Agent mode
-
-VS Code includes an [agent mode](https://pris.ly/vs-code-docs) (powered by GitHub Copilot) that automatically performs code changes and executes Prisma CLI commands based on your prompts.
-
-### Capabilities
-
-The [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) enables support for VS Code agent mode.
-
-VS Code agent mode can perform the following tasks:
-
-- Check migration status (e.g. Flag unapplied migrations)
-- Create and apply schema migrations automatically
-- Sign in to the Prisma Data Platform
-- Provision Prisma Postgres instances, letting you start coding right away
-
-### How to enable and use the VS Code agent
-
-The [latest version of the Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) fully supports agent mode. Since extensions update automatically, no manual action is required to enable it.
-
-:::note
-We recommend you to use the latest version of Prisma ORM.
-:::
-
-To use the agent mode:
-
-1. Open [GitHub Copilot Chat in VS Code and switch to **Agent** mode](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode#_use-agent-mode).
-2. With GitHub Copilot Chat open and the Prisma extension updated, you can simply type a request such as: "Create a new database for me and add the connection string to the .env file".
-3. The agent will request permission to make changes in your workspace.
-4. It automatically handles login to your Prisma Data Platform account before proceeding.
-5. Upon approval, the agent creates the new database and adds the connection string to your `.env` file.
-6. You can also use agent mode to run migrations, generate the Prisma Client, and perform other tasks.
-
-:::note
-Currently, the agent mode uses your default [workspace](/v6/platform/about#workspace) in the Prisma Data Platform.
-:::
-
-### Querying Prisma docs from VS Code using GitHub Copilot
-
-Complementing the agent, the Prisma Copilot extension allows you to query Prisma documentation directly within VS Code.
-
-You need to install the [Prisma for Copilot extension](https://github.com/apps/prisma-for-github-copilot) from the GitHub marketplace.
-
-Then, [switch to **Ask** mode in GitHub Copilot Chat](https://code.visualstudio.com/docs/copilot/chat/chat-ask-mode) and type your question using the `@prisma-for-github-copilot` namespace.
-
-For more details, refer to our [GitHub Copilot documentation](/v6/orm/more/ai-tools/github-copilot).
diff --git a/apps/docs/content/docs.v6/postgres/introduction/import-from-existing-database.mdx b/apps/docs/content/docs.v6/postgres/introduction/import-from-existing-database.mdx
deleted file mode 100644
index c7269f25e2..0000000000
--- a/apps/docs/content/docs.v6/postgres/introduction/import-from-existing-database.mdx
+++ /dev/null
@@ -1,12 +0,0 @@
----
-title: Import data from an existing PostgreSQL database
-description: Learn how to import data from an existing database into Prisma Postgres.
-url: /v6/postgres/introduction/import-from-existing-database
-metaTitle: Import from existing Postgres database into Prisma Postgres
-metaDescription: Learn how to import data from an existing database into Prisma Postgres.
----
-
-If you have an existing database and want to import your data into Prisma Postgres, you can use one of our guides:
-
-- [Import from PostgreSQL](/v6/prisma-postgres/import-from-existing-database-postgresql)
-- [Import from MySQL](/v6/prisma-postgres/import-from-existing-database-mysql)
diff --git a/apps/docs/content/docs.v6/postgres/introduction/index.mdx b/apps/docs/content/docs.v6/postgres/introduction/index.mdx
deleted file mode 100644
index b776798ff0..0000000000
--- a/apps/docs/content/docs.v6/postgres/introduction/index.mdx
+++ /dev/null
@@ -1,15 +0,0 @@
----
-title: Introduction to Prisma Postgres
-description: 'Understand the basics of Prisma Postgres, including key features and how to get started.'
-url: /v6/postgres/introduction
-metaTitle: Prisma Postgres introduction
-metaDescription: 'Understand the basics of Prisma Postgres, including key features and how to get started.'
----
-
-Get familiar with Prisma Postgres and its core concepts. This section covers what Prisma Postgres is and how to begin using it with minimal setup.
-
-## Getting started
-
-- [Overview](/v6/postgres/introduction/overview) - Learn everything you need to know about Prisma Postgres
-- [npx create-db](/v6/postgres/introduction/npx-create-db) - Provision temporary Prisma Postgres databases
-- [Management API](/v6/postgres/introduction/management-api) - Management API reference documentation
diff --git a/apps/docs/content/docs.v6/postgres/introduction/management-api-sdk.mdx b/apps/docs/content/docs.v6/postgres/introduction/management-api-sdk.mdx
deleted file mode 100644
index 525fa09730..0000000000
--- a/apps/docs/content/docs.v6/postgres/introduction/management-api-sdk.mdx
+++ /dev/null
@@ -1,439 +0,0 @@
----
-title: Management API SDK
-description: 'A TypeScript SDK for the Prisma Data Platform Management API. Use the simple client for direct API access, or the full SDK with built-in OAuth authentication and automatic token refresh.'
-url: /v6/postgres/introduction/management-api-sdk
-metaTitle: 'Prisma Postgres: Management API SDK'
-metaDescription: 'A TypeScript SDK for the Prisma Data Platform Management API. Use the simple client for direct API access, or the full SDK with built-in OAuth authentication and automatic token refresh.'
----
-
-## Overview
-
-The [`@prisma/management-api-sdk`](https://www.npmjs.com/package/@prisma/management-api-sdk) is a TypeScript SDK for the [Prisma Data Platform Management API](/v6/postgres/introduction/management-api). Use the simple client for direct API access, or the full SDK with built-in OAuth authentication and automatic token refresh.
-
-Based on the [public OpenAPI 3.1 specification](https://api.prisma.io/v1/swagger-editor).
-
-## Installation
-
-```npm
-npm install @prisma/management-api-sdk
-```
-
-## Basic usage
-
-For usage with an existing access or [service token](/v6/postgres/introduction/management-api#service-tokens).
-
-### Making API calls
-
-The client provides fully typed methods for all API endpoints:
-
-```typescript
-import { createManagementApiClient } from "@prisma/management-api-sdk";
-
-const client = createManagementApiClient({
- token: "your-access-token",
-});
-
-// List workspaces
-const { data: workspaces, error } = await client.GET("/v1/workspaces");
-
-// Get a specific project
-const { data: project } = await client.GET("/v1/projects/{id}", {
- params: { path: { id: "project-id" } },
-});
-
-// Create a new project
-const { data: newProject } = await client.POST("/v1/workspaces/{workspaceId}/projects", {
- params: { path: { workspaceId: "workspace-id" } },
- body: { name: "My New Project" },
-});
-
-// Create a new database
-const { data: newDatabase } = await client.POST("/v1/projects/{projectId}/databases", {
- params: { path: { projectId: "project-id" } },
- body: {
- name: "my-new-db-instance",
- region: "us-east-1",
- isDefault: true,
- },
-});
-
-// Delete a database
-const { error: deleteError } = await client.DELETE("/v1/databases/{databaseId}", {
- params: { path: { databaseId: "database-id" } },
-});
-```
-
-### Customizing the client
-
-You can override any `ClientOptions` from `openapi-fetch`, including `baseUrl`, `headers`, and other fetch options:
-
-```typescript
-import { createManagementApiClient } from "@prisma/management-api-sdk";
-
-// Override baseUrl and add custom headers
-const client = createManagementApiClient({
- token: "your-access-token",
- baseUrl: "https://api.example.com",
- headers: {
- "X-Custom-Header": "value",
- },
-});
-```
-
-:::note
-
-If you provide both `token` and `headers.Authorization`, the `headers.Authorization` takes precedence. The `baseUrl` defaults to `https://api.prisma.io` if not provided.
-
-:::
-
-## Advanced usage
-
-For applications that need [OAuth authentication](/v6/postgres/introduction/management-api#oauth-20-authentication), automatic token refresh, and token storage management, use the full SDK.
-
-### OAuth authentication flow
-
-The SDK uses OAuth 2.0 with PKCE for secure authentication. The flow is stateless - you're responsible for storing the `state` and `verifier` between the login URL generation and callback handling.
-
-#### 1. Create the SDK instance
-
-```typescript
-import { createManagementApiSdk, type TokenStorage } from "@prisma/management-api-sdk";
-
-// Implement token storage for your environment
-const tokenStorage: TokenStorage = {
- async getTokens() {
- const stored = localStorage.getItem("prisma-tokens");
- return stored ? JSON.parse(stored) : null;
- },
- async setTokens(tokens) {
- localStorage.setItem("prisma-tokens", JSON.stringify(tokens));
- },
- async clearTokens() {
- localStorage.removeItem("prisma-tokens");
- },
-};
-
-// Create the SDK instance
-const api = createManagementApiSdk({
- clientId: "your-oauth-client-id",
- redirectUri: "https://your-app.com/auth/callback",
- tokenStorage,
-});
-```
-
-#### 2. Initiate login
-
-Generate the OAuth login URL. The returned `state` and `verifier` must be stored (e.g., in a session or cookie) for use when handling the callback:
-
-```typescript
-const { url, state, verifier } = await api.getLoginUrl({
- scope: "workspace:admin offline_access",
- additionalParams: {
- utm_source: "my-app",
- utm_medium: "login",
- },
-});
-
-// Store state and verifier for the callback (e.g., in session storage)
-sessionStorage.setItem("oauth-state", state);
-sessionStorage.setItem("oauth-verifier", verifier);
-
-// Redirect user to the login URL
-window.location.href = url;
-```
-
-#### 3. Handle the callback
-
-When the user is redirected back to your app, retrieve the stored `state` and `verifier` and pass them to `handleCallback`. On success, tokens are automatically stored via your `tokenStorage` implementation:
-
-```typescript
-// In your callback route handler
-const callbackUrl = window.location.href;
-
-// Retrieve the stored values
-const expectedState = sessionStorage.getItem("oauth-state");
-const verifier = sessionStorage.getItem("oauth-verifier");
-
-// Clean up stored values
-sessionStorage.removeItem("oauth-state");
-sessionStorage.removeItem("oauth-verifier");
-
-try {
- await api.handleCallback({
- callbackUrl,
- verifier,
- expectedState,
- });
-
- // Tokens are now stored in tokenStorage and the client is ready to use
- console.log("Login successful!");
-} catch (error) {
- if (error instanceof AuthError) {
- console.error("Authentication failed:", error.message);
- }
-}
-```
-
-#### 4. Make API calls
-
-The client automatically includes authentication headers and refreshes tokens when they expire:
-
-```typescript
-// List workspaces
-const { data: workspaces } = await api.client.GET("/v1/workspaces");
-
-// Get a specific project
-const { data: project } = await api.client.GET("/v1/projects/{id}", {
- params: { path: { id: "project-id" } },
-});
-
-// Create a new project
-const { data: newProject } = await api.client.POST("/v1/workspaces/{workspaceId}/projects", {
- params: { path: { workspaceId: "workspace-id" } },
- body: { name: "My Project" },
-});
-
-// Create a new database
-const { data: newDatabase } = await api.client.POST("/v1/projects/{projectId}/databases", {
- params: { path: { projectId: "project-id" } },
- body: {
- name: "production",
- region: "us-east-1",
- isDefault: true,
- },
-});
-
-// Delete a database
-const { error: deleteError } = await api.client.DELETE("/v1/databases/{databaseId}", {
- params: { path: { databaseId: "database-id" } },
-});
-```
-
-#### 5. Logout
-
-```typescript
-await api.logout(); // Clears stored tokens
-```
-
-### Token storage interface
-
-Implement this interface to handle token persistence in your environment:
-
-```typescript
-interface TokenStorage {
- /** Provide the stored tokens to the SDK */
- getTokens(): Promise;
- /** Store new or updated tokens when the SDK has successfully authenticated or refreshed tokens */
- setTokens(tokens: Tokens): Promise;
- /** Clear the tokens when the user logs out or the refresh token is invalid */
- clearTokens(): Promise;
-}
-
-type Tokens = {
- /** The workspace ID that these tokens are valid for (extracted from the access token) */
- workspaceId: string;
- /** The access token for API requests */
- accessToken: string;
- /** The refresh token for obtaining new access tokens (only present if scope includes 'offline_access') */
- refreshToken?: string;
-};
-```
-
-#### Example: VS Code Extension
-
-```typescript
-const tokenStorage: TokenStorage = {
- async getTokens() {
- const workspaceId = await context.secrets.get("workspaceId");
- const accessToken = await context.secrets.get("accessToken");
- const refreshToken = await context.secrets.get("refreshToken");
-
- if (!workspaceId || !accessToken) return null;
-
- return { workspaceId, accessToken, refreshToken: refreshToken || undefined };
- },
- async setTokens(tokens) {
- await context.secrets.store("workspaceId", tokens.workspaceId);
- await context.secrets.store("accessToken", tokens.accessToken);
- if (tokens.refreshToken) {
- await context.secrets.store("refreshToken", tokens.refreshToken);
- }
- },
- async clearTokens() {
- await context.secrets.delete("workspaceId");
- await context.secrets.delete("accessToken");
- await context.secrets.delete("refreshToken");
- },
-};
-```
-
-#### Example: Node.js CLI
-
-```typescript
-import { readFile, writeFile, unlink } from "node:fs/promises";
-import { homedir } from "node:os";
-import { join } from "node:path";
-
-const tokenPath = join(homedir(), ".prisma", "credentials.json");
-
-const tokenStorage: TokenStorage = {
- async getTokens() {
- try {
- const data = await readFile(tokenPath, "utf-8");
- return JSON.parse(data);
- } catch {
- return null;
- }
- },
- async setTokens(tokens) {
- await writeFile(tokenPath, JSON.stringify(tokens, null, 2));
- },
- async clearTokens() {
- await unlink(tokenPath).catch(() => {});
- },
-};
-```
-
-#### Example: Stateless Web Server
-
-For stateless web servers (serverless, load-balanced), store the PKCE state in an encrypted cookie or database:
-
-```typescript
-// In your login route
-app.get("/login", async (req, res) => {
- const { url, state, verifier } = await api.getLoginUrl({
- scope: "workspace:admin offline_access",
- });
-
- // Store in encrypted cookie or database keyed by state
- res.cookie("oauth-verifier", verifier, { httpOnly: true, secure: true, signed: true });
- res.cookie("oauth-state", state, { httpOnly: true, secure: true, signed: true });
-
- res.redirect(url);
-});
-
-// In your callback route
-app.get("/callback", async (req, res) => {
- const verifier = req.signedCookies["oauth-verifier"];
- const expectedState = req.signedCookies["oauth-state"];
-
- // Clear cookies
- res.clearCookie("oauth-verifier");
- res.clearCookie("oauth-state");
-
- await api.handleCallback({ callbackUrl: req.url, verifier, expectedState });
-
- // Tokens are now stored in tokenStorage
- // ... handle successful login
-});
-```
-
-### Automatic token refresh
-
-The SDK automatically handles token refresh when a refresh token is available (requires `offline_access` scope):
-
-- When a request returns 401, the SDK refreshes the access token using the refresh token
-- Concurrent requests during refresh are queued and resolved once refresh completes
-- If refresh fails due to an invalid refresh token, tokens are cleared and `AuthError` is thrown with `refreshTokenInvalid: true`
-- If no refresh token is available, an `AuthError` is thrown with the message "No refresh token available. Please log in again."
-
-## API reference
-
-### `createManagementApiClient(options)`
-
-Creates a raw API client without authentication handling. Useful if you want to manage authentication yourself or use a service token.
-
-**Parameters:**
-
-- `options.token?: string` - Access token (automatically converted to `Authorization: Bearer ${token}` header)
-- `options.baseUrl?: string` - Base URL for API requests (defaults to `https://api.prisma.io`)
-- `options.headers?: Record` - Additional headers
-- Other `ClientOptions` from `openapi-fetch` are also supported
-
-**Returns:** A typed API client for making requests.
-
-### `createManagementApiSdk(config)`
-
-Creates a Management API SDK instance with OAuth authentication and automatic token refresh.
-
-**Parameters:**
-
-```typescript
-type ManagementApiClientConfig = {
- // Required
- clientId: string; // OAuth client ID
- redirectUri: string; // OAuth redirect URI
- tokenStorage: TokenStorage;
-
- // Optional (with defaults)
- apiBaseUrl?: string; // Default: 'https://api.prisma.io'
- authBaseUrl?: string; // Default: 'https://auth.prisma.io'
-};
-```
-
-**Returns:** An object with:
-
-- `client` - The typed API client for making requests
-- `getLoginUrl(options)` - Generate OAuth login URL with specified scope
-- `handleCallback(options)` - Handle OAuth callback and store tokens via `tokenStorage`
-- `logout()` - Clear stored tokens
-
-## Error handling
-
-The SDK exports two error classes:
-
-### `AuthError`
-
-Thrown for authentication-related errors:
-
-- OAuth callback errors (includes `error_description` when available)
-- Invalid or missing tokens
-- Token refresh failures
-
-```typescript
-import { AuthError } from "@prisma/management-api-sdk";
-
-try {
- await api.handleCallback({ callbackUrl, verifier, expectedState });
-} catch (error) {
- if (error instanceof AuthError) {
- if (error.refreshTokenInvalid) {
- // Token is invalid/expired, user needs to log in again
- const { url } = await api.getLoginUrl({ scope: "workspace:admin offline_access" });
- // redirect to url...
- } else {
- // Other auth errors (e.g., "access_denied: User cancelled")
- console.error("Auth error:", error.message);
- }
- }
-}
-```
-
-### `FetchError`
-
-Thrown for network-related errors. Includes the original error as `cause` for debugging:
-
-```typescript
-import { FetchError } from "@prisma/management-api-sdk";
-
-try {
- const { data } = await client.GET("/v1/workspaces");
-} catch (error) {
- if (error instanceof FetchError) {
- console.error("Network error:", error.message);
- console.error("Cause:", error.cause); // Original error for debugging
- }
-}
-```
-
-## TypeScript types
-
-The SDK exports all API types generated from the OpenAPI spec:
-
-```typescript
-import type { paths, components } from "@prisma/management-api-sdk";
-
-// Access response types
-type Workspace = components["schemas"]["Workspace"];
-type Project = components["schemas"]["Project"];
-```
diff --git a/apps/docs/content/docs.v6/postgres/introduction/management-api.mdx b/apps/docs/content/docs.v6/postgres/introduction/management-api.mdx
deleted file mode 100644
index be92fc38db..0000000000
--- a/apps/docs/content/docs.v6/postgres/introduction/management-api.mdx
+++ /dev/null
@@ -1,513 +0,0 @@
----
-title: Management API
-description: Management API reference documentation for Prisma Postgres.
-url: /v6/postgres/introduction/management-api
-metaTitle: 'Prisma Postgres: Management API Reference'
-metaDescription: Management API reference documentation for Prisma Postgres.
----
-
-## Overview
-
-This page covers the Prisma Management API which enables you to programmatically manage [platform](/v6/platform/about) resources (e.g. projects or Prisma Postgres instances) in [Prisma Console](https://console.prisma.io).
-
-:::tip[TypeScript SDK]
-The [`@prisma/management-api-sdk`](/v6/postgres/introduction/management-api-sdk) provides a typed TypeScript client with built-in OAuth authentication and automatic token refresh. It's the recommended way to interact with the Management API in TypeScript/JavaScript applications.
-:::
-
-:::tip[OpenAPI]
-An interactive [**OpenAPI 3.1 specification** is available here](https://api.prisma.io/v1/swagger-editor), where you can explore endpoints, request/response bodies, and detailed examples.
-:::
-
-:::tip[Guides]
-We have three guides to help you use the Management API for common scenarios:
-
-- [Getting started with the Prisma Management API](/v6/guides/management-api-basic)
-- [Provisioning preview databases with GitHub Actions and Prisma Postgres](/v6/guides/github-actions)
-- [Partner database provisioning & user claim flow](/v6/guides/management-api)
- :::
-
-## Base URL
-
-The base URL for a Prisma Postgres API request is:
-
-```
-https://api.prisma.io/v1
-```
-
-Append an endpoint path to the base URL to construct the full URL for a request. For example:
-
-```
-https://api.prisma.io/v1/projects/{projectId}
-```
-
-## Authentication
-
-The Prisma Postgres API supports two authentication methods:
-
-- **Service tokens** — for accessing resources in your own workspace
-- **OAuth 2.0 access tokens** — for accessing or managing resources on behalf of users
-
-### Service tokens
-
-Service tokens are manually created in your [Prisma Console](https://console.prisma.io) workspace. They're ideal for server-to-server integrations or provisioning databases in your own workspace.
-
-To authenticate with a service token, include it in the `Authorization` header:
-
-```
-Authorization: Bearer $TOKEN
-```
-
-#### Creating a service token
-
-1. Open the [Prisma Console](https://console.prisma.io/).
-2. Navigate to your workspace.
-3. Go to the **Settings** page of your workspace and select **Service Tokens**.
-4. Click **New Service Token** and copy the generated token for future use.
-
-### OAuth 2.0 authentication
-
-Use OAuth 2.0 if you want to act on behalf of users and create or manage databases directly in their workspaces.
-
-#### Creating OAuth credentials
-
-To obtain a client ID and client secret:
-
-1. Open the [Prisma Console](https://console.prisma.io).
-2. Click the 🧩 **Integrations** tab.
-3. Under **Published Applications**, click **New Application**.
-4. Enter a **Name**, **Description**, and **Redirect URI** (the URL where users will be redirected after authorization).
-5. Click **Continue**, then copy and store your **Client ID** and **Client Secret** to a secure location.
-
-#### OAuth authorization flow
-
-To use OAuth 2.0, your application must:
-
-1. **Redirect users to the authorization URL** with your client ID and redirect URI:
-
- ```
- https://auth.prisma.io/authorize?client_id=$CLIENT_ID&redirect_uri=$REDIRECT_URI&response_type=code&scope=workspace:admin
- ```
-
-2. **Receive the authorization code**: After the user authorizes your application, they'll be redirected to your redirect URI with a `code` parameter:
-
- ```
- https://your-app.com/callback?code=abc123...
- ```
-
-3. **Exchange the code for an access token**: Use the code from step 2 in the following request
-
-```bash
-curl -X POST https://auth.prisma.io/token \
- -H "Content-Type: application/x-www-form-urlencoded" \
- -d "client_id=$CLIENT_ID" \
- -d "client_secret=$CLIENT_SECRET" \
- -d "code=$CODE" \
- -d "grant_type=authorization_code" \
- -d "redirect_uri=$REDIRECT_URI"
-```
-
-:::note
-The `$CODE` is the authorization code received in step 2 above. The `$REDIRECT_URI` must match exactly what you configured when creating your OAuth credentials.
-:::
-
-Once you have an access token from the response, include it in requests to the Management API:
-
-```bash
-curl --location "https://api.prisma.io/v1/projects" \
- -H "Accept: application/json" \
- -H "Authorization: Bearer $ACCESS_TOKEN" \
- -H "Content-Type: application/json" \
- --data '{
- "name": "my_project",
- "region": "us-east-1"
- }'
-```
-
-### Instructions
-
-
-Authentication in Postman
-
-#### Using a Service token
-
-1. Create a new request.
-2. Go to the **Authorization** tab.
-3. Set type to **Bearer Token**.
-4. Paste your service token.
-
-#### Using OAuth 2
-
-1. In the **Authorization** tab, set type to **OAuth 2.0**.
-2. Click **Get New Access Token** and fill in the details:
- - **Token Name**: Any name
- - **Grant Type**: Authorization Code
- - **Redirect URI**: Your app's redirect URI (must match what you configured in OAuth credentials)
- - **Auth URL**: `https://auth.prisma.io/authorize`
- - **Client ID / Secret**: From your OAuth app
- - **Scope**: `workspace:admin offline_access` (as needed)
-3. Complete the flow and use the token in your requests.
-
-
-
-
-Authentication in SwaggerUI
-
-#### Using a Service token
-
-1. Click **Authorize**.
-2. Paste the service token into the relevant input.
-3. Click **Authorize** again.
-
-> The Swagger spec supports a Bearer token via the `Authorization` header.
-
-#### Using OAuth 2
-
-1. Click **Authorize**.
-2. Choose the OAuth2 flow.
-3. Provide your `clientId`, `clientSecret`, and redirect URI.
-4. Complete the authorization flow to acquire access.
-
-
-
-## Endpoints
-
-### Workspaces
-
-#### `GET /workspaces`
-
-Retrieve information about the workspaces accessible by the current user.
-
-- **Query parameters**:
- - `cursor` (optional): Cursor for pagination
- - `limit` (optional, default: 100): Limit number of results
-- **Responses**:
- - `200 OK`: List of workspaces
- - `401 Unauthorized`: Invalid or missing authentication token
-
-### Projects
-
-#### `GET /projects`
-
-Retrieve all projects.
-
-- **Query parameters**:
- - `cursor` (optional): Cursor for pagination
- - `limit` (optional, default: 100): Limit number of results
-- **Responses**:
- - `200 OK`: List of projects
- - `401 Unauthorized`
-
-#### `POST /projects`
-
-Create a new project.
-
-- **Request body**:
- ```json
- {
- "region": "us-east-1",
- "name": "My Project"
- }
- ```
-- **Response body**:
-
- ```json
- {
- "data": {
- "id": "proj_abc123",
- "type": "project",
- "name": "My Project",
- "createdAt": "2025-12-14T21:42:30.545Z",
- "workspace": {
- "id": "wksp_xyz789",
- "name": "My Workspace"
- },
- "database": {
- "id": "db_def456",
- "type": "database",
- "name": "My Project",
- "createdAt": "2025-12-14T21:42:30.545Z",
- "region": {
- "id": "us-east-1",
- "name": "US East (N. Virginia)"
- },
- "status": "ready",
- "connectionString": "prisma+postgres://accelerate.prisma-data.net/?api_key=...",
- "directConnection": {
- "host": "db.prisma.io:5432",
- "user": "your_user_id",
- "pass": "your_password"
- },
- "isDefault": true
- }
- }
- }
- ```
-
- The response includes a `directConnection` object with credentials for connecting directly to the underlying PostgreSQL database. Use these values to build your `DATABASE_URL`:
-
- ```
- postgresql://{user}:{pass}@{host}/postgres?sslmode=require
- ```
-
- For example, given the response above:
-
- ```
- postgresql://your_user_id:your_password@db.prisma.io:5432/postgres?sslmode=require
- ```
-
- Set this as your `DATABASE_URL` environment variable in your `.env` file:
-
- ```text
- DATABASE_URL="postgresql://your_user_id:your_password@db.prisma.io:5432/postgres?sslmode=require"
- ```
-
- This direct connection string is the recommended way to connect to your Prisma Postgres database for all use cases including Prisma Client, migrations, and direct database access.
-
-- **Responses**:
- - `201 Created`: Project created
- - `401 Unauthorized`
-
-#### `GET /projects/{id}`
-
-Retrieve a specific project by ID.
-
-- **Path parameters**:
- - `id`: Project ID
-- **Responses**:
- - `200 OK`
- - `401 Unauthorized`
- - `404 Not Found`
-
-#### `DELETE /projects/{id}`
-
-Deletes a project.
-
-- **Path parameters**:
- - `id`: Project ID
-- **Responses**:
- - `204 No Content`
- - `400 Bad Request`: Dependencies prevent deletion
- - `401 Unauthorized`
- - `404 Not Found`
-
-#### `POST /projects/{id}/transfer`
-
-Transfer a project to a new workspace owner.
-
-- **Path parameters**:
- - `id`: Project ID
-- **Request body**:
- ```json
- {
- "recipientAccessToken": "string"
- }
- ```
-- **Responses**:
- - `200 OK`
- - `401 Unauthorized`
- - `404 Not Found`
-
-### Databases
-
-#### `GET /projects/{projectId}/databases`
-
-Retrieve all databases for a project.
-
-- **Path parameters**:
- - `projectId`: Project ID
-- **Query parameters**:
- - `cursor` (optional): Cursor for pagination
- - `limit` (optional, default: 100): Limit number of results
-- **Responses**:
- - `200 OK`
- - `401 Unauthorized`
- - `404 Not Found`
-
-#### `POST /projects/{projectId}/databases`
-
-Create a new database.
-
-- **Path parameters**:
- - `projectId`: Project ID
-- **Request body**:
- ```json
- {
- "region": "us-east-1",
- "name": "My Database",
- "isDefault": false,
- "fromDatabase": {
- "id": "databaseId",
- "backupId": "string"
- }
- }
- ```
- :::note
- Use `fromDatabase` only when creating the database from an existing one or a backup.
- :::
-- **Responses**:
- - `201 Created`
- - `400 Default database already exists`
- - `401 Unauthorized`
- - `403 Forbidden`
-
-#### `GET /databases/{databaseId}`
-
-Retrieve a specific database.
-
-- **Path parameters**:
- - `databaseId`: Database ID
-- **Responses**:
- - `200 OK`
- - `401 Unauthorized`
- - `404 Not Found`
-
-#### `DELETE /databases/{databaseId}`
-
-Delete a database.
-
-- **Path parameters**:
- - `databaseId`: Database ID
-- **Responses**:
- - `200 OK`
- - `401 Unauthorized`
- - `403 Cannot delete default environment`
- - `404 Not Found`
-
-#### `GET /databases/{databaseId}/usage`
-
-Get usage metrics for a database.
-
-- **Path parameters**:
- - `databaseId`: Database ID
-- **Query parameters**:
- - `startDate` (optional): Start date for the usage period
- - `endDate` (optional): End date for the usage period
-- **Response body**:
- ```json
- {
- "period": {
- "start": "2025-12-01T00:00:00.000Z",
- "end": "2025-12-14T21:39:23.331Z"
- },
- "metrics": {
- "operations": {
- "used": 0,
- "unit": "ops"
- },
- "storage": {
- "used": 0,
- "unit": "GiB"
- }
- },
- "generatedAt": "2025-12-14T21:39:23.331Z"
- }
- ```
-- **Responses**:
- - `200 OK`: Usage metrics returned
- - `400 Bad Request`: Invalid request parameters
- - `401 Unauthorized`
- - `404 Not Found`
- - `500 Internal Server Error`: Error occurred while fetching metrics
-
-### Connection strings
-
-#### `GET /databases/{databaseId}/connections`
-
-Retrieve all database connection strings.
-
-- **Path parameters**:
- - `databaseId`: Database ID
-- **Query parameters**:
- - `cursor` (optional): Cursor for pagination
- - `limit` (optional, default: 100): Limit number of results
-- **Responses**:
- - `200 OK`
- - `401 Unauthorized`
-
-#### `POST /databases/{databaseId}/connections`
-
-Create a new connection string.
-
-- **Path parameters**:
- - `databaseId`: Database ID
-- **Request body**:
-
- ```json
- {
- "name": "Connection Name"
- }
- ```
-
-- **Responses**:
- - `200 OK`
- - `401 Unauthorized`
- - `404 Not Found`
-
-#### `DELETE /connections/{id}`
-
-Delete a connection string.
-
-- **Path parameters**:
- - `id`: Connection ID
-- **Responses**:
- - `204 No Content`
- - `401 Unauthorized`
- - `404 Not Found`
-
-### Backups
-
-#### `GET /databases/{databaseId}/backups`
-
-Retrieve database backups.
-
-- **Path parameters**:
- - `databaseId`: Database ID
-- **Query parameters**:
- - `limit` (optional, default: 25): Limit number of results
-- **Responses**:
- - `200 OK`
- - `401 Unauthorized`
- - `404 Not Found`
-
-### Integrations
-
-#### `GET /workspaces/{workspaceId}/integrations`
-
-Retrieve integrations for the given workspace.
-
-- **Path parameters**:
- - `workspaceId`: Workspace ID
-- **Query parameters**:
- - `cursor` (optional): Cursor for pagination
- - `limit` (optional, default: 100): Limit number of results
-- **Responses**:
- - `200 OK`: List of integrations with details:
- - `id`: Integration ID
- - `createdAt`: Creation timestamp
- - `scopes`: Array of granted scopes
- - `client`: Object containing `id`, `name`, `createdAt`
- - `createdByUser`: Object containing `id`, `email`, `displayName`
- - `401 Unauthorized`: Missing or invalid authentication token
- - `404 Not Found`: Workspace not found
-
-#### `DELETE /workspaces/{workspaceId}/integrations/{clientId}`
-
-Revokes the integration tokens with the given client ID.
-
-- **Path parameters**:
- - `workspaceId`: Workspace ID (e.g. `wksp_1234`)
- - `clientId`: Integration client ID (e.g. `itgr_5678`)
-- **Responses**:
- - `204 No Content`: Integration tokens revoked successfully
- - `401 Unauthorized`: Missing or invalid authentication token
- - `404 Not Found`: Workspace or integration not found
-
-### Misc
-
-#### `GET /regions/postgres`
-
-Retrieve all available regions.
-
-- **Responses**:
- - `200 OK`: Returns list of available/unsupported regions
- - `401 Unauthorized`
diff --git a/apps/docs/content/docs.v6/postgres/introduction/meta.json b/apps/docs/content/docs.v6/postgres/introduction/meta.json
deleted file mode 100644
index d9cca0bfe7..0000000000
--- a/apps/docs/content/docs.v6/postgres/introduction/meta.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "title": "Introduction",
- "pages": [
- "overview",
- "npx-create-db",
- "import-from-existing-database",
- "management-api",
- "management-api-sdk"
- ]
-}
diff --git a/apps/docs/content/docs.v6/postgres/introduction/npx-create-db.mdx b/apps/docs/content/docs.v6/postgres/introduction/npx-create-db.mdx
deleted file mode 100644
index 8d7e766141..0000000000
--- a/apps/docs/content/docs.v6/postgres/introduction/npx-create-db.mdx
+++ /dev/null
@@ -1,178 +0,0 @@
----
-title: npx create-db
-description: Learn how to provision temporary Prisma Postgres databases with npx create-db.
-url: /v6/postgres/introduction/npx-create-db
-metaTitle: Getting started with npx create-db
-metaDescription: Learn how to provision temporary Prisma Postgres databases with npx create-db.
----
-
-[`create-db`](https://create-db.prisma.io/) is an open-source CLI tool that provisions temporary [Prisma Postgres](/v6/postgres) databases with a single command.
-
-- **Fast setup:** No sign-up required to create a temporary production-ready Prisma Postgres database.
-- **Lifetime:** Each database is available for _24 hours_ by default.
-- **Keep for free:** You can _claim_ a database (via the URL provided in the CLI output) to make it permanent.
-
-## Prerequisites
-
-To use `npx create-db`, you need:
-
-- **Node.js** version `16` or higher (we recommend the latest LTS version).
-- **npm** (comes with Node.js) to run `npx` commands.
-
-**A Prisma Data Platform account is not required** to create a temporary database. However, if you want to keep a database permanently, you can claim it ([details below](#claiming-your-database)).
-
-### Option 1: Using the web interface (recommended)
-
-The [create-db web application](https://create-db.prisma.io) provides a browser-based interface for creating and managing your databases.
-
-#### Key features:
-
-- No installation required - works directly in your web browser
-- Visual interface for database management
-- Easy connection string display and copying
-- Built-in schema viewer and editor
-- Direct integration with Prisma Studio
-- Simple database claiming workflow
-
-#### Getting started:
-
-1. Visit [create-db.prisma.io](https://create-db.prisma.io) in your web browser
-2. Click "Create with the web interface"
-3. Modify your schema and interact with the Studio
-4. Copy the provided connection strings for your project
-5. Claim your database to make it permanent
-
-### Option 2: Using the CLI
-
-You can create a database using one of the following options:
-
-#### Option 1: Quick start with default settings
-
-Run the following command in your terminal:
-
-```npm
-npx create-db@latest
-```
-
-
-
-- The `@latest` tag automatically downloads and runs the latest version of the tool, hence, no global installation required.
-- After a few seconds, you'll receive **connection strings** for both Prisma ORM projects and standard PostgreSQL.
-- The default region is `us-east-1`. You can specify the region where you want to provision the database in using the `--region` flag. See [the section below](#available-cli-options) to view all the CLI options.
-
-#### Option 2: Choose a region interactively
-
-If you want to select a region manually:
-
-```npm
-npx create-db@latest --interactive
-```
-
-
-
-- This opens a region selection menu (for example, `us-east-1`, `eu-west-3`).
-- Alternatively, you can use the shorthand `-i`:
-
-```npm
-npx create-db@latest -i
-```
-
-To view all options and regions:
-
-```npm
-npx create-db@latest --help
-```
-
-#### CLI output walkthrough
-
-Here is an example output:
-
-```
-┌ 🚀 Creating a Prisma Postgres database
-│
-│ Provisioning a temporary database in us-east-1...
-│ It will be automatically deleted in 24 hours, but you can claim it.
-◇ Database created successfully!
-│
-● Database Connection
-│ Connection String:
-│ postgresql://:@db.prisma.io:5432/postgres
-│
-◆ Claim your database →
-│ Keep your database for free:
-│ https://create-db.prisma.io?projectID=proj_...
-└
-```
-
-Once you have the output, take the connection string and add it to your `.env` file as `DATABASE_URL`:
-
-```text
-DATABASE_URL="postgresql://:@db.prisma.io:5432/postgres"
-```
-
-You can now follow the [Prisma Postgres quickstart guide](/v6/prisma-orm/quickstart/prisma-postgres) to connect your Prisma project to this database.
-
-If you're using other tools or libraries, use the **standard PostgreSQL connection string** (`postgresql://...`) with any PostgreSQL-compatible client, such as `psql`, `pgAdmin`, `node-postgres`, or an ORM of your choice. Detailed instructions are available in the guide for [connecting via direct PostgreSQL connection string](/v6/postgres/database/direct-connections).
-
-## Claiming your database
-
-By default, databases created with `npx create-db` are **temporary** and will be automatically deleted after **24 hours**.
-
-You can prevent this by **claiming the database** using the claim URL shown in the CLI output:
-
-```
-◆ Claim your database →
-│
-│ Want to keep your database? Claim for free:
-│
-│ https://create-db.prisma.io?projectID=proj_...
-│
-│ Your database will be deleted on 7/24/2025, 2:25:41 AM if not claimed.
-```
-
-To claim your database and make it permanent:
-
-1. Copy the **claim URL** from the CLI output.
-2. Open it in your browser and click **Claim database**.
-3. Sign in to your [Prisma Data Platform account](https://console.prisma.io/) (or create one if you don’t have it yet).
-4. Choose a **Workspace** that has capacity for creating new projects.
-5. Click **Authorize Prisma Create DB** to confirm.
-6. You’ll be redirected to a success page. Then, click **Go use your database** to view and manage the claimed database in your workspace.
-
-When you claim a database:
-
-- It's moved into your Prisma Data Platform account workspace.
-- It's no longer auto-deleted after 24 hours.
-- You can continue using it as a permanent database instance.
-
-## Available CLI options
-
-Here are the CLI flags for the `npx create-db` command:
-
-| Flag | Shorthand | Description |
-| --------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
-| `--region` | `-r` | Specify a region. **Available regions:** `ap-southeast-1`, `ap-northeast-1`, `eu-central-1`, `eu-west-3`, `us-east-1`, `us-west-1` |
-| `--interactive` | `-i` | Run in interactive mode (select region from a list). |
-| `--json` | `-j` | Output machine-readable JSON and exit. |
-| `--help` | `-h` | Show this help message. |
-
-To view all CLI options use the `--help` or `-h` flag:
-
-```npm
-npx create-db@latest --help
-```
-
-```
-npx create-db@latest [options]
-
-Options:
- --region , -r Specify a region
- Available regions:
- ap-southeast-1, ap-northeast-1,
- eu-central-1, eu-west-3,
- us-east-1, us-west-1
-
- --interactive, -i Run in interactive mode
-
- --help, -h Show this help message
-```
diff --git a/apps/docs/content/docs.v6/postgres/introduction/overview.mdx b/apps/docs/content/docs.v6/postgres/introduction/overview.mdx
deleted file mode 100644
index 9a2e3bd6e8..0000000000
--- a/apps/docs/content/docs.v6/postgres/introduction/overview.mdx
+++ /dev/null
@@ -1,76 +0,0 @@
----
-title: Overview on Prisma Postgres
-description: Learn everything you need to know about Prisma Postgres.
-url: /v6/postgres/introduction/overview
-metaTitle: Overview | Prisma Postgres
-metaDescription: Learn everything you need to know about Prisma Postgres.
----
-
-[Prisma Postgres](https://www.prisma.io/postgres?utm_source=docs) is a managed PostgreSQL database service that easily lets you create a new database, interact with it through Prisma ORM, and build applications that start small and cheap but can scale to millions of users.
-
-It supports the following workflows:
-
-- Schema migrations and queries (via [Prisma ORM](https://www.prisma.io/orm) or any other ORM/database library)
-- Connection pooling and caching
-- Local database workflows via [`prisma dev`](/v6/postgres/database/local-development)
-
-## Usage metrics
-
-You can view the following usage metrics in your Console Dashboard:
-
-- Key metrics
- - Estimated upcoming invoice
- - Total storage used
- - Total DBs
-- Overall usage
- - Cumulative operations
- - Operations per day
-
-For details into individual databases in your workspace, each database has it's own metrics report
-as well. You can view the following:
-
-- Average response size
-- Average query duration
-- Total egress
-- Total operations
-- Cache utilization
-
-## Billing
-
-### Usage-based pricing
-
-Prisma Postgres charges for:
-
-- number of operations
-- storage (in GiB)
-
-An _operation_ is counted each time you perform a create, read, update, or delete, regardless of how simple or complex the underlying SQL is. Whether it's a single-row lookup or complex JOIN query, it still counts as one operation and costs the same. Read our blog post on [operations-based billing](https://www.prisma.io/blog/operations-based-billing?utm_source=docs) for more details.
-
-By treating every operation equally, you don't have to worry about write-heavy workloads driving up your bill or high-bandwidth requests ballooning costs unexpectedly. You can [directly correlate your database costs to real product usage and user behavior](/v6/postgres/faq#is-there-a-sample-workload-to-estimate-my-expected-charges), making forecasting and budgeting simple and predictable.
-
-Learn more on our [pricing page](https://www.prisma.io/pricing).
-
-### Spend limits
-
-Prisma Postgres allows you to set limits to ensure you never get a surprise bill. You'll receive alerts when you reach 75% of your set limit, and if you reach 100%, your database will be paused. This ensures you'll never have an unexpected bill, and you can always be in complete control of your spending.
-Spend limits are available on the Pro plan and higher. Please note that the spend limit must be set higher than the base cost of the selected plan. For example, if you're on the Pro plan, your spend limit should exceed the base plan cost of $49.
-
-### Restarting your database when changing your subscription
-
-When changing your subscription from Free to Starter/Pro/Business or from Starter/Pro/Business to Free, your database instance is being restarted. This may cause a downtime of ~1second.
-
-:::note
-This is temporary. In the future, there won't be any downtime when up- or downgrading a plan.
-:::
-
-## Technical details
-
-### PostgreSQL version
-
-Prisma Postgres is based **PostgreSQL v17**.
-
-### Architecture
-
-Prisma Postgres uses a unique architecture to deliver unmatched efficiency, safety and ease of use. It is deployed on bare metal servers using unikernels (think: "hyper-specialized operating systems").
-
-Learn more about the architecture in this article: [Prisma Postgres®: Building a Modern PostgreSQL Service Using Unikernels & MicroVMs](https://pris.ly/ppg-early-access?utm_source=docs).
diff --git a/apps/docs/content/docs.v6/postgres/meta.json b/apps/docs/content/docs.v6/postgres/meta.json
deleted file mode 100644
index aaea1f1a00..0000000000
--- a/apps/docs/content/docs.v6/postgres/meta.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "title": "Postgres",
- "root": true,
- "pages": [
- "index",
- "getting-started",
- "introduction",
- "database",
- "integrations",
- "api-reference",
- "troubleshooting",
- "faq"
- ]
-}
diff --git a/apps/docs/content/docs.v6/postgres/troubleshooting.mdx b/apps/docs/content/docs.v6/postgres/troubleshooting.mdx
deleted file mode 100644
index 5fe95ea345..0000000000
--- a/apps/docs/content/docs.v6/postgres/troubleshooting.mdx
+++ /dev/null
@@ -1,64 +0,0 @@
----
-title: Troubleshooting
-description: Learn about troubleshooting Prisma Postgres issues.
-url: /v6/postgres/troubleshooting
-metaTitle: Troubleshooting Prisma Postgres issues
-metaDescription: Learn about troubleshooting Prisma Postgres issues.
----
-
-This guide helps resolve common issues when working with Prisma Postgres.
-
-## The `--db` option is not recognized when running `prisma init`
-
-### Problem
-
-Running the following command fails because the `--db` option is not recognized:
-
-```npm
-npx prisma init --db
-```
-
-### Cause
-
-This can occur due to npx caching. If you've previously run `npx prisma init`, your machine may be using an outdated cached version that doesn't recognize the `--db` flag because it was only introduced in a later version of Prisma ORM.
-
-### Solution
-
-Explicitly run the `latest` Prisma CLI version:
-
-```npm
-npx prisma@latest init --db
-```
-
-This ensures that you're using the most up-to-date CLI, preventing issues with outdated command syntax.
-
-## Workspace plan limit reached when running `prisma init --db`
-
-### Problem
-
-When running the command:
-
-```npm
-npx prisma@latest init --db
-```
-
-You may encounter the following error message in your logs:
-
-```
-Workspace plan limit reached for feature "Project".
-```
-
-### Cause
-
-Your default [workspace](/v6/platform/about#workspace) project limit has been reached.
-
-### Solution
-
-To resolve this issue, consider the following options:
-
-- Configure a different Workspace as your default—one that has available capacity for additional projects.
-- Delete unused projects or databases from your current default Workspace to free up space.
-- Ensure that you are logged into the correct account in the Prisma CLI. For more details on authentication and account management, please refer to the [Prisma CLI documentation](/v6/platform/platform-cli/commands#authentication).
-- [Upgrade to a plan](/v6/platform/about#billing) that supports more projects in your default Workspace.
-
-Implementing one or more of these solutions should help you overcome the plan limit issue.
diff --git a/apps/docs/content/docs/accelerate/more/troubleshoot.mdx b/apps/docs/content/docs/accelerate/more/troubleshoot.mdx
index d7b25e4ed9..867c969425 100644
--- a/apps/docs/content/docs/accelerate/more/troubleshoot.mdx
+++ b/apps/docs/content/docs/accelerate/more/troubleshoot.mdx
@@ -24,7 +24,7 @@ This error may arise if images or files stored within your table are being fetch
In certain cases, a large number of records or fields are unintentionally fetched, which results in exceeding the configured query response size limit. This could happen when the [`where`](/orm/reference/prisma-client-reference#where) clause in the query is incorrect or entirely missing.
-**Suggested solution:** Configure the query response size limit to be larger. If the limit is still exceeded, double-check that the `where` clause is filtering data as expected. To prevent fetching too many records, consider using [pagination](/v6/orm/prisma-client/queries/pagination). Additionally, use the [`select`](/orm/reference/prisma-client-reference#select) clause to return only the necessary fields, reducing the response size.
+**Suggested solution:** Configure the query response size limit to be larger. If the limit is still exceeded, double-check that the `where` clause is filtering data as expected. To prevent fetching too many records, consider using [pagination](/orm/v6/prisma-client/queries/pagination). Additionally, use the [`select`](/orm/reference/prisma-client-reference#select) clause to return only the necessary fields, reducing the response size.
#### Fetching a large volume of data
diff --git a/apps/docs/content/docs/ai/prompts/nextjs.mdx b/apps/docs/content/docs/ai/prompts/nextjs.mdx
index ff4fd5b8e8..f181e6af18 100644
--- a/apps/docs/content/docs/ai/prompts/nextjs.mdx
+++ b/apps/docs/content/docs/ai/prompts/nextjs.mdx
@@ -40,17 +40,7 @@ Include this prompt in your AI assistant to guide consistent code generation for
Watch this step-by-step walkthrough showing this prompt in action:
-
-
-
+
## Prompt
diff --git a/apps/docs/content/docs/ai/prompts/prisma-7.mdx b/apps/docs/content/docs/ai/prompts/prisma-7.mdx
index e32f9092d8..ee1137d632 100644
--- a/apps/docs/content/docs/ai/prompts/prisma-7.mdx
+++ b/apps/docs/content/docs/ai/prompts/prisma-7.mdx
@@ -19,17 +19,7 @@ Include this prompt in your AI assistant to guide in upgrading to Prisma ORM 7.0
Watch this video showing this prompt in action:
-
-
-
+
## Prompt
diff --git a/apps/docs/content/docs/ai/tutorials/linktree-clone.mdx b/apps/docs/content/docs/ai/tutorials/linktree-clone.mdx
index 90e9c0b3e4..b732764a4c 100644
--- a/apps/docs/content/docs/ai/tutorials/linktree-clone.mdx
+++ b/apps/docs/content/docs/ai/tutorials/linktree-clone.mdx
@@ -29,17 +29,7 @@ Vibe coding is a development approach where you collaborate with AI assistants t
Watch this step-by-step walkthrough of the entire build process:
-
-
-
+
## Prerequisites
diff --git a/apps/docs/content/docs/ai/tutorials/typefully-clone.mdx b/apps/docs/content/docs/ai/tutorials/typefully-clone.mdx
index 1207443cc1..32777dadf1 100644
--- a/apps/docs/content/docs/ai/tutorials/typefully-clone.mdx
+++ b/apps/docs/content/docs/ai/tutorials/typefully-clone.mdx
@@ -31,17 +31,7 @@ Vibe coding is a development approach where you collaborate with AI assistants t
Watch this step-by-step walkthrough of the entire build process:
-
-The pipeline should handle deployment to staging and production environments, and use `migrate deploy` in a pipeline step. See the [deployment guides](/v6/orm/prisma-client/deployment/deploy-prisma) for examples.
+The pipeline should handle deployment to staging and production environments, and use `migrate deploy` in a pipeline step. See the [deployment guides](/orm/v6/prisma-client/deployment/deploy-prisma) for examples.
## Baselining a production database
-When you add Prisma Migrate to an **existing database**, you must [baseline](/v6/orm/prisma-migrate/workflows/baselining) the production database. Baselining is performed **once**, and can be done from a local instance.
+When you add Prisma Migrate to an **existing database**, you must [baseline](/orm/v6/prisma-migrate/workflows/baselining) the production database. Baselining is performed **once**, and can be done from a local instance.

diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/deploy-prisma.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/deploy-prisma.mdx
similarity index 79%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/deploy-prisma.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/deploy-prisma.mdx
index b0396ddf3e..05d47ec147 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/deploy-prisma.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/deploy-prisma.mdx
@@ -1,7 +1,7 @@
---
title: Deploy Prisma ORM
description: Learn more about the different deployment paradigms for Node.js applications and how they affect deploying an application using Prisma Client.
-url: /v6/orm/prisma-client/deployment/deploy-prisma
+url: /orm/v6/prisma-client/deployment/deploy-prisma
metaTitle: Deploying Prisma ORM-based projects
metaDescription: Learn more about the different deployment paradigms for Node.js applications and how they affect deploying an application using Prisma Client.
---
@@ -19,16 +19,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -42,22 +42,22 @@ Moreover, the user traffic pattern of your application is also an important fact
### Traditional servers
-Your application is [traditionally deployed](/v6/orm/prisma-client/deployment/traditional) if a Node.js process is continuously running and handles multiple requests at the same time. Your application could be deployed to a Platform-as-a-Service (PaaS) like [Heroku](/v6/orm/prisma-client/deployment/traditional/deploy-to-heroku), [Koyeb](/v6/orm/prisma-client/deployment/traditional/deploy-to-koyeb), or [Render](/v6/orm/prisma-client/deployment/traditional/deploy-to-render); as a Docker container to Kubernetes; or as a Node.js process on a virtual machine or bare metal server.
+Your application is [traditionally deployed](/orm/v6/prisma-client/deployment/traditional) if a Node.js process is continuously running and handles multiple requests at the same time. Your application could be deployed to a Platform-as-a-Service (PaaS) like [Heroku](/orm/v6/prisma-client/deployment/traditional/deploy-to-heroku), [Koyeb](/orm/v6/prisma-client/deployment/traditional/deploy-to-koyeb), or [Render](/orm/v6/prisma-client/deployment/traditional/deploy-to-render); as a Docker container to Kubernetes; or as a Node.js process on a virtual machine or bare metal server.
-See also: [Connection management in long-running processes](/v6/orm/prisma-client/setup-and-configuration/databases-connections#long-running-processes)
+See also: [Connection management in long-running processes](/orm/v6/prisma-client/setup-and-configuration/databases-connections#long-running-processes)
### Serverless Functions
-Your application is [serverless](/v6/orm/prisma-client/deployment/serverless) if the Node.js processes of your application (or subsets of it broken into functions) are started as requests come in, and each function only handles one request at a time. Your application would most likely be deployed to a Function-as-a-Service (FaaS) offering, such as [AWS Lambda](/v6/orm/prisma-client/deployment/serverless/deploy-to-aws-lambda) or [Azure Functions](/v6/orm/prisma-client/deployment/serverless/deploy-to-azure-functions)
+Your application is [serverless](/orm/v6/prisma-client/deployment/serverless) if the Node.js processes of your application (or subsets of it broken into functions) are started as requests come in, and each function only handles one request at a time. Your application would most likely be deployed to a Function-as-a-Service (FaaS) offering, such as [AWS Lambda](/orm/v6/prisma-client/deployment/serverless/deploy-to-aws-lambda) or [Azure Functions](/orm/v6/prisma-client/deployment/serverless/deploy-to-azure-functions)
Serverless environments have the concept of warm starts, which means that for subsequent invocations of the same function, it may use an already existing container that has the allocated processes, memory, file system (`/tmp` is writable on AWS Lambda), and even DB connection still available.
Typically, any piece of code [outside the handler](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html) remains initialized.
-See also: [Connection management in serverless environments](/v6/orm/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas)
+See also: [Connection management in serverless environments](/orm/v6/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas)
### Edge Functions
-Your application is [edge deployed](/v6/orm/prisma-client/deployment/edge) if your application is [serverless](#serverless-functions) and the functions are distributed across one or more regions close to the user.
+Your application is [edge deployed](/orm/v6/prisma-client/deployment/edge) if your application is [serverless](#serverless-functions) and the functions are distributed across one or more regions close to the user.
Typically, edge environments also have a different runtime than a traditional or serverless environment, leading to common APIs being unavailable.
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/deploy-to-a-different-os.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/deploy-to-a-different-os.mdx
similarity index 80%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/deploy-to-a-different-os.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/deploy-to-a-different-os.mdx
index 52168c76f2..4af0b1541f 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/deploy-to-a-different-os.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/deploy-to-a-different-os.mdx
@@ -1,16 +1,16 @@
---
title: Deploy to a different OS
description: Learn how to deploy Node.js and TypeScript applications that are using Prisma Client to a different operating system.
-url: /v6/orm/prisma-client/deployment/deploy-to-a-different-os
+url: /orm/v6/prisma-client/deployment/deploy-to-a-different-os
metaTitle: Deploy to a different OS
metaDescription: Learn how to deploy Node.js and TypeScript applications that are using Prisma Client to a different operating system.
---
-Prisma Client depends on the [query engine](/v6/orm/more/internals/engines) that is running as a binary on the same host as your application.
+Prisma Client depends on the [query engine](/orm/v6/more/internals/engines) that is running as a binary on the same host as your application.
:::note
-As of [v6.16.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+As of [v6.16.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
@@ -22,7 +22,7 @@ generator client {
}
```
-Note that [driver adapters](/v6/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines.
+Note that [driver adapters](/orm/v6/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines.
You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog.
@@ -32,6 +32,6 @@ The query engine is implemented in Rust and is used by Prisma Client in the form
If you have developed your application on a Windows machine for example, and wish to upload to AWS Lambda, which is a Linux environment, you may encounter issues and be presented with some warnings in your terminal.
-To solve this, if you know ahead of time that you will be deploying to a different environment, you can use the [binary targets](/v6/orm/prisma-schema/overview/generators#binary-targets) and specify which of the [supported operating systems](/v6/orm/reference/prisma-schema-reference#binarytargets-options) binaries should be included.
+To solve this, if you know ahead of time that you will be deploying to a different environment, you can use the [binary targets](/orm/v6/prisma-schema/overview/generators#binary-targets) and specify which of the [supported operating systems](/orm/v6/reference/prisma-schema-reference#binarytargets-options) binaries should be included.
-> **Note**: If your OS isn't supported you can include a [custom binary](/v6/orm/more/internals/engines#using-custom-engine-libraries-or-binaries).
+> **Note**: If your OS isn't supported you can include a [custom binary](/orm/v6/more/internals/engines#using-custom-engine-libraries-or-binaries).
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare.mdx
index 756c378f5d..ef0f73ab3e 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Cloudflare Workers & Pages
description: Learn the things you need to know in order to deploy an app that uses Prisma Client for talking to a database to a Cloudflare Worker or to Cloudflare Pages.
-url: /v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare
+url: /orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare
metaTitle: Deploy to Cloudflare Workers & Pages
metaDescription: Learn the things you need to know in order to deploy an app that uses Prisma Client for talking to a database to a Cloudflare Worker or to Cloudflare Pages.
---
@@ -30,16 +30,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -96,7 +96,7 @@ export default {
} satisfies ExportedHandler;
```
-Then setup helper scripts to perform migrations and generate `PrismaClient` as [shown in this section](/v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare#development).
+Then setup helper scripts to perform migrations and generate `PrismaClient` as [shown in this section](/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare#development).
:::note
@@ -106,7 +106,7 @@ You need to have the `dotenv-cli` package installed as Cloudflare Workers does n
### Using an edge-compatible driver
-When deploying a Cloudflare Worker that uses Prisma ORM, you need to use an [edge-compatible driver](/v6/orm/prisma-client/deployment/edge/overview#edge-compatibility-of-database-drivers) and its respective [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) for Prisma ORM.
+When deploying a Cloudflare Worker that uses Prisma ORM, you need to use an [edge-compatible driver](/orm/v6/prisma-client/deployment/edge/overview#edge-compatibility-of-database-drivers) and its respective [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) for Prisma ORM.
The edge-compatible drivers for Cloudflare Workers and Pages are:
@@ -114,13 +114,13 @@ The edge-compatible drivers for Cloudflare Workers and Pages are:
- [PlanetScale Serverless](https://planetscale.com/docs/tutorials/planetscale-serverless-driver) uses HTTP to access the database
- [`node-postgres`](https://node-postgres.com/) (`pg`) uses Cloudflare's `connect()` (TCP) to access the database
- [`@libsql/client`](https://github.com/tursodatabase/libsql-client-ts) is used to access Turso databases via HTTP
-- [Cloudflare D1](/v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare) is used to access D1 databases
+- [Cloudflare D1](/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare) is used to access D1 databases
There's [also work being done](https://github.com/sidorares/node-mysql2/pull/2289) on the `node-mysql2` driver which will enable access to traditional MySQL databases from Cloudflare Workers and Pages in the future as well.
:::note
-If your application uses PostgreSQL, we recommend using [Prisma Postgres](/v6/postgres). It is fully supported on edge runtimes and does not require a specialized edge-compatible driver. For other databases, [Prisma Accelerate](/v6/accelerate) extends edge compatibility so you can connect to _any_ database from _any_ edge function provider.
+If your application uses PostgreSQL, we recommend using [Prisma Postgres](/postgres). It is fully supported on edge runtimes and does not require a specialized edge-compatible driver. For other databases, [Prisma Accelerate](/accelerate) extends edge compatibility so you can connect to _any_ database from _any_ edge function provider.
:::
@@ -256,7 +256,7 @@ model User {
If you are using a traditional PostgreSQL database that's accessed via TCP and the `pg` driver, you need to:
-- use the `@prisma/adapter-pg` database adapter (learn more [here](/v6/orm/overview/databases/postgresql#using-the-node-postgres-driver))
+- use the `@prisma/adapter-pg` database adapter (learn more [here](/orm/v6/overview/databases/postgresql#using-the-node-postgres-driver))
- set `node_compat = true` in `wrangler.toml` (see the [Cloudflare docs](https://developers.cloudflare.com/workers/runtime-apis/nodejs/))
#### 1. Configure Prisma schema & database connection
@@ -405,7 +405,7 @@ The command will output the URL where you can access the deployed Worker.
If you are using a PlanetScale database, you need to:
-- use the `@prisma/adapter-planetscale` database adapter (learn more [here](/v6/orm/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview))
+- use the `@prisma/adapter-planetscale` database adapter (learn more [here](/orm/v6/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview))
- manually remove the conflicting `cache` field:
```ts
@@ -566,7 +566,7 @@ The command will output the URL where you can access the deployed Worker.
If you are using a Neon database, you need to:
-- use the `@prisma/adapter-neon` database adapter (learn more [here](/v6/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm))
+- use the `@prisma/adapter-neon` database adapter (learn more [here](/orm/v6/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm))
#### 1. Configure Prisma schema & database connection
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/deploy-to-deno-deploy.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/deploy-to-deno-deploy.mdx
similarity index 96%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/deploy-to-deno-deploy.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/deploy-to-deno-deploy.mdx
index eff2551742..6b3b28b609 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/deploy-to-deno-deploy.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/deploy-to-deno-deploy.mdx
@@ -1,12 +1,12 @@
---
title: Deploy to Deno Deploy
description: Learn how to deploy a TypeScript application to Deno Deploy.
-url: /v6/orm/prisma-client/deployment/edge/deploy-to-deno-deploy
+url: /orm/v6/prisma-client/deployment/edge/deploy-to-deno-deploy
metaTitle: Deploy to Deno Deploy
metaDescription: Learn how to deploy a TypeScript application using Prisma ORM to Deno Deploy.
---
-With this guide, you can learn how to build and deploy a simple application to [Deno Deploy](https://deno.com/deploy). The application uses Prisma ORM to save a log of each request to a [Prisma Postgres](/v6/postgres) database.
+With this guide, you can learn how to build and deploy a simple application to [Deno Deploy](https://deno.com/deploy). The application uses Prisma ORM to save a log of each request to a [Prisma Postgres](/postgres) database.
This guide covers the use of Prisma CLI with Deno CLI, Deno Deploy, Prisma Client, and Prisma Postgres.
@@ -21,16 +21,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -65,7 +65,7 @@ This command:
- Creates a `prisma` directory containing a `schema.prisma` file for your database models.
- Creates a `.env` file with your `DATABASE_URL` (e.g., `DATABASE_URL="postgresql://user:password@host:5432/database"`).
-Edit the `prisma/schema.prisma` file to define a `Log` model, add a custom `output` path and [the `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client) with `deno` as the `runtime`:
+Edit the `prisma/schema.prisma` file to define a `Log` model, add a custom `output` path and [the `prisma-client` generator](/orm/v6/prisma-schema/overview/generators#prisma-client) with `deno` as the `runtime`:
```prisma title="schema.prisma" highlight=3-4,12-23;add showLineNumbers
generator client {
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/deploy-to-vercel.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/deploy-to-vercel.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/deploy-to-vercel.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/deploy-to-vercel.mdx
index e6607cdb26..54f00b610e 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/deploy-to-vercel.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/deploy-to-vercel.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Vercel Edge Functions & Middleware
description: Learn the things you need to know in order to deploy an Edge function that uses Prisma Client for talking to a database.
-url: /v6/orm/prisma-client/deployment/edge/deploy-to-vercel
+url: /orm/v6/prisma-client/deployment/edge/deploy-to-vercel
metaTitle: Deploy to Vercel Edge Functions & Middleware
metaDescription: Learn the things you need to know in order to deploy an Edge function that uses Prisma Client for talking to a database.
---
@@ -46,16 +46,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -65,7 +65,7 @@ Curious why we moved away from the Rust engine? Take a look at why we transition
### Using Prisma Postgres
-You can use Prisma Postgres in Vercel's edge runtime. Follow this guide for an end-to-end tutorial on [deploying an application to Vercel using Prisma Postgres](/v6/guides/nextjs).
+You can use Prisma Postgres in Vercel's edge runtime. Follow this guide for an end-to-end tutorial on [deploying an application to Vercel using Prisma Postgres](/guides/frameworks/nextjs).
### Using an edge-compatible driver
@@ -77,11 +77,11 @@ Vercel's Edge Runtime currently only supports a limited set of database drivers:
Note that [`node-postgres`](https://node-postgres.com/) (`pg`) is currently _not_ supported on Vercel Edge Functions.
-When deploying a Vercel Edge Function that uses Prisma ORM, you need to use one of these [edge-compatible drivers](/v6/orm/prisma-client/deployment/edge/overview#edge-compatibility-of-database-drivers) and its respective [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) for Prisma ORM.
+When deploying a Vercel Edge Function that uses Prisma ORM, you need to use one of these [edge-compatible drivers](/orm/v6/prisma-client/deployment/edge/overview#edge-compatibility-of-database-drivers) and its respective [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) for Prisma ORM.
:::note
-If your application uses PostgreSQL, we recommend using [Prisma Postgres](/v6/postgres). It is fully supported on edge runtimes and does not require a specialized edge-compatible driver. For other databases, [Prisma Accelerate](/v6/accelerate) extends edge compatibility so you can connect to _any_ database from _any_ edge function provider.
+If your application uses PostgreSQL, we recommend using [Prisma Postgres](/postgres). It is fully supported on edge runtimes and does not require a specialized edge-compatible driver. For other databases, [Prisma Accelerate](/accelerate) extends edge compatibility so you can connect to _any_ database from _any_ edge function provider.
:::
@@ -109,7 +109,7 @@ export default defineConfig({
#### Development
-When in **development**, you can configure your database connection via the `DATABASE_URL` environment variable (e.g. [using `.env` files](/v6/orm/more/dev-environment/environment-variables)).
+When in **development**, you can configure your database connection via the `DATABASE_URL` environment variable (e.g. [using `.env` files](/orm/v6/more/dev-environment/environment-variables)).
#### Production
@@ -325,7 +325,7 @@ At this point, you can get the URL of the deployed application from the Vercel D
If you are using a PlanetScale database, you need to:
-- use the `@prisma/adapter-planetscale` database adapter (learn more [here](/v6/orm/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview))
+- use the `@prisma/adapter-planetscale` database adapter (learn more [here](/orm/v6/overview/databases/planetscale#how-to-use-the-planetscale-serverless-driver-with-prisma-orm-preview))
#### 1. Configure Prisma schema & database connection
@@ -458,7 +458,7 @@ At this point, you can get the URL of the deployed application from the Vercel D
If you are using a Neon database, you need to:
-- use the `@prisma/adapter-neon` database adapter (learn more [here](/v6/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm))
+- use the `@prisma/adapter-neon` database adapter (learn more [here](/orm/v6/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm))
#### 1. Configure Prisma schema & database connection
@@ -590,7 +590,7 @@ At this point, you can get the URL of the deployed application from the Vercel D
[Fluid compute](https://vercel.com/fluid) is a compute model from Vercel that combines the flexibility of serverless with the stability of servers, making it ideal for dynamic workloads such as streaming data and AI APIs. Vercel's Fluid compute [supports both edge and Node.js runtimes](https://vercel.com/docs/fluid-compute#available-runtime-support). A common challenge in traditional serverless platforms is leaked database connections when functions are suspended and pools can't close idle connections. Fluid provides [`attachDatabasePool`](https://vercel.com/blog/the-real-serverless-compute-to-database-connection-problem-solved) to ensure idle connections are released before a function is suspended.
-Use `attachDatabasePool` together with [Prisma's driver adapters](/v6/orm/overview/databases/database-drivers) to safely manage connections in Fluid:
+Use `attachDatabasePool` together with [Prisma's driver adapters](/orm/v6/overview/databases/database-drivers) to safely manage connections in Fluid:
```ts
import { Pool } from "pg";
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/images/450-03-import-project.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/images/450-03-import-project.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/images/450-03-import-project.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/images/450-03-import-project.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/images/450-04-connect-db.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/images/450-04-connect-db.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/images/450-04-connect-db.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/images/450-04-connect-db.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/images/450-05-data-proxy.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/images/450-05-data-proxy.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/images/450-05-data-proxy.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/images/450-05-data-proxy.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/images/550-02-deploy-to-deno-project-parameters.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/images/550-02-deploy-to-deno-project-parameters.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/images/550-02-deploy-to-deno-project-parameters.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/images/550-02-deploy-to-deno-project-parameters.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/index.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/index.mdx
similarity index 73%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/index.mdx
index decbe979c8..4af203c3f4 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/index.mdx
@@ -1,12 +1,12 @@
---
title: Edge functions
description: Learn how to deploy your Prisma ORM-backed apps to edge functions like Cloudflare Workers or Vercel Edge Functions
-url: /v6/orm/prisma-client/deployment/edge
+url: /orm/v6/prisma-client/deployment/edge
metaTitle: Edge functions
metaDescription: Learn how to deploy your Prisma ORM-backed apps to edge functions like Cloudflare Workers or Vercel Edge Functions
---
-If your application is deployed via an "Edge Function" offering or is deployed from a [serverless](/v6/orm/prisma-client/deployment/serverless) offering and has a non-standard runtime, it is a _edge-deployed_ app. Common examples for such offerings include [Cloudflare Workers or Pages](/v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare), [Vercel Edge Functions or Edge Middleware](/v6/orm/prisma-client/deployment/edge/deploy-to-vercel), and [Deno Deploy](/v6/orm/prisma-client/deployment/edge/deploy-to-deno-deploy).
+If your application is deployed via an "Edge Function" offering or is deployed from a [serverless](/orm/v6/prisma-client/deployment/serverless) offering and has a non-standard runtime, it is a _edge-deployed_ app. Common examples for such offerings include [Cloudflare Workers or Pages](/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare), [Vercel Edge Functions or Edge Middleware](/orm/v6/prisma-client/deployment/edge/deploy-to-vercel), and [Deno Deploy](/orm/v6/prisma-client/deployment/edge/deploy-to-deno-deploy).
:::tip[Use Prisma ORM without Rust binaries]
@@ -19,16 +19,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -36,6 +36,6 @@ Curious why we moved away from the Rust engine? Take a look at why we transition
## Getting started
-- [Deploy to Cloudflare](/v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare) - Deploy to Cloudflare Workers or Pages
-- [Deploy to Vercel](/v6/orm/prisma-client/deployment/edge/deploy-to-vercel) - Deploy to Vercel Edge Functions
-- [Deploy to Deno](/v6/orm/prisma-client/deployment/edge/deploy-to-deno-deploy) - Deploy to Deno Deploy
+- [Deploy to Cloudflare](/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare) - Deploy to Cloudflare Workers or Pages
+- [Deploy to Vercel](/orm/v6/prisma-client/deployment/edge/deploy-to-vercel) - Deploy to Vercel Edge Functions
+- [Deploy to Deno](/orm/v6/prisma-client/deployment/edge/deploy-to-deno-deploy) - Deploy to Deno Deploy
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/overview.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/overview.mdx
similarity index 81%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/overview.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/overview.mdx
index c4c8e8ce2b..11e291a319 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/edge/overview.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/edge/overview.mdx
@@ -1,7 +1,7 @@
---
title: Deploying edge functions with Prisma ORM
description: Learn how to deploy your Prisma-backed apps to edge functions like Cloudflare Workers or Vercel Edge Functions
-url: /v6/orm/prisma-client/deployment/edge/overview
+url: /orm/v6/prisma-client/deployment/edge/overview
metaTitle: 'Overview: Deploy Prisma ORM at the Edge'
metaDescription: Learn how to deploy your Prisma-backed apps to edge functions like Cloudflare Workers or Vercel Edge Functions
---
@@ -27,7 +27,7 @@ Here is a brief overview of all the edge function providers that are currently s
| Cloudflare Pages | ✅ (Preview; only compatible drivers) | ✅ |
| Deno Deploy | [Not yet](https://github.com/prisma/prisma/issues/2452) | ✅ |
-Deploying edge functions that use Prisma ORM on Cloudflare and Vercel is currently in [Preview](/v6/orm/more/releases#preview).
+Deploying edge functions that use Prisma ORM on Cloudflare and Vercel is currently in [Preview](/orm/v6/more/releases#preview).
:::note
@@ -40,9 +40,9 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
@@ -56,7 +56,7 @@ This setup can simplify deployments in:
- Read-only filesystem environments
- CI/CD pipelines with strict size limits
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -72,7 +72,7 @@ In particular, the constraint of not being able to freely open TCP connections m
:::note
-We recommend using [Prisma Postgres](/v6/postgres). It is fully supported on edge runtimes and does not require a specialized edge-compatible driver. For other databases, [Prisma Accelerate](/v6/accelerate) extends edge compatibility so you can connect to _any_ database from _any_ edge function provider.
+We recommend using [Prisma Postgres](/postgres). It is fully supported on edge runtimes and does not require a specialized edge-compatible driver. For other databases, [Prisma Accelerate](/accelerate) extends edge compatibility so you can connect to _any_ database from _any_ edge function provider.
:::
@@ -85,24 +85,24 @@ Here is an overview of the different database drivers and their compatibility wi
- [`node-postgres`](https://node-postgres.com/) (`pg`) uses Cloudflare's `connect()` (TCP) to access the database. It is only compatible with Cloudflare Workers, not with Vercel Edge Functions.
- [`@libsql/client`](https://github.com/tursodatabase/libsql-client-ts) is used to access Turso databases. It works with Cloudflare Workers and Vercel Edge Functions.
- [Cloudflare D1](https://developers.cloudflare.com/d1/) is used to access D1 databases. It is only compatible with Cloudflare Workers, not with Vercel Edge Functions.
-- [Prisma Postgres](/v6/postgres) is used to access a PostgreSQL database built on bare-metal using unikernels. It is supported on both Cloudflare Workers and Vercel.
+- [Prisma Postgres](/postgres) is used to access a PostgreSQL database built on bare-metal using unikernels. It is supported on both Cloudflare Workers and Vercel.
There's [also work being done](https://github.com/sidorares/node-mysql2/pull/2289) on the `node-mysql2` driver which will enable access to traditional MySQL databases from Cloudflare Workers and Pages in the future as well.
-You can use all of these drivers with Prisma ORM using the respective [driver adapters](/v6/orm/overview/databases/database-drivers).
+You can use all of these drivers with Prisma ORM using the respective [driver adapters](/orm/v6/overview/databases/database-drivers).
Depending on which deployment provider and database/driver you use, there may be special considerations. Please take a look at the deployment docs for your respective scenario to make sure you can deploy your application successfully:
- Cloudflare
- - [PostgreSQL (traditional)](/v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare#postgresql-traditional)
- - [PlanetScale](/v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare#planetscale)
- - [Neon](/v6/orm/prisma-client/deployment/edge/deploy-to-cloudflare#neon)
- - [Cloudflare D1](/v6/guides/cloudflare-d1)
+ - [PostgreSQL (traditional)](/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare#postgresql-traditional)
+ - [PlanetScale](/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare#planetscale)
+ - [Neon](/orm/v6/prisma-client/deployment/edge/deploy-to-cloudflare#neon)
+ - [Cloudflare D1](/guides/deployment/cloudflare-d1)
- [Prisma Postgres](https://developers.cloudflare.com/workers/tutorials/using-prisma-postgres-with-workers)
- Vercel
- - [Vercel Postgres](/v6/orm/prisma-client/deployment/edge/deploy-to-vercel#vercel-postgres)
- - [Neon](/v6/orm/prisma-client/deployment/edge/deploy-to-vercel#neon)
- - [PlanetScale](/v6/orm/prisma-client/deployment/edge/deploy-to-vercel#planetscale)
- - [Prisma Postgres](/v6/guides/nextjs)
+ - [Vercel Postgres](/orm/v6/prisma-client/deployment/edge/deploy-to-vercel#vercel-postgres)
+ - [Neon](/orm/v6/prisma-client/deployment/edge/deploy-to-vercel#neon)
+ - [PlanetScale](/orm/v6/prisma-client/deployment/edge/deploy-to-vercel#planetscale)
+ - [Prisma Postgres](/guides/frameworks/nextjs)
-If you want to deploy an app using Turso, you can follow the instructions [here](/v6/orm/overview/databases/turso).
+If you want to deploy an app using Turso, you can follow the instructions [here](/orm/v6/overview/databases/turso).
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/deployment/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/module-bundlers.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/module-bundlers.mdx
similarity index 89%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/module-bundlers.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/module-bundlers.mdx
index 17b3a377d7..052fe5da9b 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/module-bundlers.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/module-bundlers.mdx
@@ -1,7 +1,7 @@
---
title: Module bundlers
description: This page gives an overview of the most important things to be aware of when using a module bundler to bundle an application that uses Prisma Client.
-url: /v6/orm/prisma-client/deployment/module-bundlers
+url: /orm/v6/prisma-client/deployment/module-bundlers
metaTitle: Module bundlers
metaDescription: This page gives an overview of the most important things to be aware of when using a module bundler to bundle an application that uses Prisma Client.
---
@@ -10,11 +10,11 @@ metaDescription: This page gives an overview of the most important things to be
_Module bundlers_ bundle JavaScript modules into a single JavaScript file. Most bundlers work by copying over the JavaScript code from a variety of source files into the target file.
-Since Prisma Client is not only based on JavaScript code, but also relies on the [**query engine binary file**](/v6/orm/more/internals/engines#the-query-engine-file) to be available, you need to make sure that your bundled code has access to the binary file.
+Since Prisma Client is not only based on JavaScript code, but also relies on the [**query engine binary file**](/orm/v6/more/internals/engines#the-query-engine-file) to be available, you need to make sure that your bundled code has access to the binary file.
:::note
-As of [v6.16.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+As of [v6.16.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
@@ -26,7 +26,7 @@ generator client {
}
```
-Note that [driver adapters](/v6/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines.
+Note that [driver adapters](/orm/v6/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines.
You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog.
@@ -37,5 +37,5 @@ To do so, you can use plugins that let you copy over static assets:
| Bundler | Plugin |
| :---------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- |
| Webpack | [`copy-webpack-plugin`](https://github.com/webpack-contrib/copy-webpack-plugin#copy-webpack-plugin) |
-| Webpack (with [Next.js monorepo](/v6/orm/more/troubleshooting/nextjs#setting-up-prisma-orm-in-a-monorepo)) | [`nextjs-monorepo-workaround-plugin`](https://www.npmjs.com/package/@prisma/nextjs-monorepo-workaround-plugin) |
+| Webpack (with [Next.js monorepo](/orm/v6/more/troubleshooting/nextjs#setting-up-prisma-orm-in-a-monorepo)) | [`nextjs-monorepo-workaround-plugin`](https://www.npmjs.com/package/@prisma/nextjs-monorepo-workaround-plugin) |
| Parcel | [`parcel-plugin-static-files-copy`](https://github.com/elwin013/parcel-plugin-static-files-copy#readme) |
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-aws-lambda.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-aws-lambda.mdx
similarity index 94%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-aws-lambda.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-aws-lambda.mdx
index a9f812f3f9..4e41f55a22 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-aws-lambda.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-aws-lambda.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to AWS Lambda
description: 'Learn how to deploy your Prisma ORM-backed applications to AWS Lambda with AWS SAM, Serverless Framework, or SST'
-url: /v6/orm/prisma-client/deployment/serverless/deploy-to-aws-lambda
+url: /orm/v6/prisma-client/deployment/serverless/deploy-to-aws-lambda
metaTitle: Deploy your application using Prisma ORM to AWS Lambda
metaDescription: 'Learn how to deploy your Prisma ORM-backed applications to AWS Lambda with AWS SAM, Serverless Framework, or SST'
---
@@ -36,16 +36,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -71,7 +71,7 @@ binaryTargets = ["native", "rhel-openssl-1.0.x"]
binaryTargets = ["native", "rhel-openssl-3.0.x"]
```
-This is necessary because the runtimes used in development and deployment differ. Add the [`binaryTarget`](/v6/orm/reference/prisma-schema-reference#binarytargets-options) to make the compatible Prisma ORM engine file available.
+This is necessary because the runtimes used in development and deployment differ. Add the [`binaryTarget`](/orm/v6/reference/prisma-schema-reference#binarytargets-options) to make the compatible Prisma ORM engine file available.
#### Lambda functions with arm64 architectures
@@ -85,7 +85,7 @@ binaryTargets = ["native", "linux-arm64-openssl-1.0.x"]
### Prisma CLI binary targets
-While we do not recommend running migrations within AWS Lambda, some applications will require it. In these cases, you can use the [PRISMA_CLI_BINARY_TARGETS](/v6/orm/reference/environment-variables-reference#prisma_cli_binary_targets) environment variable to make sure that Prisma CLI commands, including `prisma migrate`, have access to the correct schema engine.
+While we do not recommend running migrations within AWS Lambda, some applications will require it. In these cases, you can use the [PRISMA_CLI_BINARY_TARGETS](/orm/v6/reference/environment-variables-reference#prisma_cli_binary_targets) environment variable to make sure that Prisma CLI commands, including `prisma migrate`, have access to the correct schema engine.
In the case of AWS lambda, you will have to add the following environment variable:
@@ -103,7 +103,7 @@ PRISMA_CLI_BINARY_TARGETS=native,rhel-openssl-1.0.x
In a Function as a Service (FaaS) environment, each function invocation typically creates a new database connection. Unlike a continuously running Node.js server, these connections aren't maintained between executions. For better performance in serverless environments, implement connection pooling to reuse existing database connections rather than creating new ones for each function call.
-You can use [Accelerate](/v6/accelerate) for connection pooling or [Prisma Postgres](/v6/postgres), which has built-in connection pooling, to solve this issue. For other solutions, see the [connection management guide for serverless environments](/v6/orm/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas).
+You can use [Accelerate](/accelerate) for connection pooling or [Prisma Postgres](/postgres), which has built-in connection pooling, to solve this issue. For other solutions, see the [connection management guide for serverless environments](/orm/v6/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas).
## Deploying with AWS SAM
@@ -266,7 +266,7 @@ custom:
This will ensure that, after webpack bundles your code, the Prisma Client is generated according to your schema. Without this step, your app will fail to run.
-Lastly, you will want to exclude [Prisma ORM query engines](/v6/orm/more/internals/engines) that do not match the AWS Lambda runtime. Update your `serverless.yml` by adding the following script that makes sure only the required query engine, `rhel-openssl-1.0.x`, is included in the final packaged archive.
+Lastly, you will want to exclude [Prisma ORM query engines](/orm/v6/more/internals/engines) that do not match the AWS Lambda runtime. Update your `serverless.yml` by adding the following script that makes sure only the required query engine, `rhel-openssl-1.0.x`, is included in the final packaged archive.
```yaml title="serverless.yml" highlight=6;add showLineNumbers
custom:
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-azure-functions.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-azure-functions.mdx
similarity index 84%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-azure-functions.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-azure-functions.mdx
index d28cfc3a2f..11dc1e573a 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-azure-functions.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-azure-functions.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Azure Functions
description: Learn how to deploy a Prisma Client based REST API to Azure Functions and connect to an Azure SQL database
-url: /v6/orm/prisma-client/deployment/serverless/deploy-to-azure-functions
+url: /orm/v6/prisma-client/deployment/serverless/deploy-to-azure-functions
metaTitle: How to deploy an app using Prisma ORM to Azure Functions
metaDescription: Learn how to deploy a Prisma Client based REST API to Azure Functions and connect to an Azure SQL database
---
@@ -21,16 +21,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -46,7 +46,7 @@ While Prisma ORM works well with Azure functions, there are a few things to take
### Define multiple binary targets
-When deploying a function app, the operating system that Azure functions runs a remote build is different from the one used to host your functions. Therefore, we recommend specifying the following [`binaryTargets` options](/v6/orm/reference/prisma-schema-reference#binarytargets-options) in your Prisma schema:
+When deploying a function app, the operating system that Azure functions runs a remote build is different from the one used to host your functions. Therefore, we recommend specifying the following [`binaryTargets` options](/orm/v6/reference/prisma-schema-reference#binarytargets-options) in your Prisma schema:
```prisma title="schema.prisma" highlight=3;normal showLineNumbers
generator client {
@@ -57,8 +57,8 @@ generator client {
### Connection pooling
-Generally, when you use a FaaS (Function as a Service) environment to interact with a database, every function invocation can result in a new connection to the database. This is not a problem with a constantly running Node.js server. Therefore, it is beneficial to pool DB connections to get better performance. To solve this issue, you can use the [Prisma Accelerate](/v6/accelerate). For other solutions, see the [connection management guide for serverless environments](/v6/orm/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas).
+Generally, when you use a FaaS (Function as a Service) environment to interact with a database, every function invocation can result in a new connection to the database. This is not a problem with a constantly running Node.js server. Therefore, it is beneficial to pool DB connections to get better performance. To solve this issue, you can use the [Prisma Accelerate](/accelerate). For other solutions, see the [connection management guide for serverless environments](/orm/v6/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas).
## Summary
-For more insight into Prisma Client's API, explore the function handlers and check out the [Prisma Client API Reference](/v6/orm/reference/prisma-client-reference)
+For more insight into Prisma Client's API, explore the function handlers and check out the [Prisma Client API Reference](/orm/v6/reference/prisma-client-reference)
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-netlify.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-netlify.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-netlify.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-netlify.mdx
index 3dfbe9bc54..ccdb253e8b 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-netlify.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-netlify.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Netlify
description: Learn how to deploy Node.js and TypeScript applications that are using Prisma Client to Netlify.
-url: /v6/orm/prisma-client/deployment/serverless/deploy-to-netlify
+url: /orm/v6/prisma-client/deployment/serverless/deploy-to-netlify
metaTitle: Deploy to Netlify
metaDescription: Learn how to deploy Node.js and TypeScript applications that are using Prisma Client to Netlify.
---
@@ -21,16 +21,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -42,7 +42,7 @@ Before you can follow this guide, you will need to set up your application to be
## Binary targets in `schema.prisma`
-Since your code is being deployed to Netlify's environment, which isn't necessarily the same as your development environment, you will need to set [`binaryTargets`](/v6/orm/reference/prisma-schema-reference#binarytargets-options) in order to download the query engine that is compatible with the Netlify runtime during your build step. If you do not set this option, your deployed code will have an incorrect query engine deployed with it and will not function.
+Since your code is being deployed to Netlify's environment, which isn't necessarily the same as your development environment, you will need to set [`binaryTargets`](/orm/v6/reference/prisma-schema-reference#binarytargets-options) in order to download the query engine that is compatible with the Netlify runtime during your build step. If you do not set this option, your deployed code will have an incorrect query engine deployed with it and will not function.
Depending on the version of Node.js, your Prisma schema should contain either `rhel-openssl-1.0.x` or `rhel-openssl-3.0.x` in the `generator` block:
@@ -112,6 +112,6 @@ You can now test the deployed application.
When you use a Function-as-a-Service provider, like Netlify, it is beneficial to pool database connections for performance reasons. This is because every function invocation may result in a new connection to your database which can quickly run out of open connections.
-You can use [Accelerate](/v6/accelerate) for connection pooling or [Prisma Postgres](/v6/postgres), which has built-in connection pooling, to reduce your Prisma Client bundle size, and to avoid cold starts.
+You can use [Accelerate](/accelerate) for connection pooling or [Prisma Postgres](/postgres), which has built-in connection pooling, to reduce your Prisma Client bundle size, and to avoid cold starts.
-For more information on connection management for serverless environments, refer to our [connection management guide](/v6/orm/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas).
+For more information on connection management for serverless environments, refer to our [connection management guide](/orm/v6/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas).
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-vercel.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-vercel.mdx
similarity index 89%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-vercel.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-vercel.mdx
index 81ea66d22b..eb937bf251 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/deploy-to-vercel.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/deploy-to-vercel.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Vercel
description: Learn how to deploy a Next.js application based on Prisma Client to Vercel.
-url: /v6/orm/prisma-client/deployment/serverless/deploy-to-vercel
+url: /orm/v6/prisma-client/deployment/serverless/deploy-to-vercel
metaTitle: Deploy to Vercel
metaDescription: Learn how to deploy a Next.js application based on Prisma Client to Vercel.
---
@@ -25,16 +25,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -64,7 +64,7 @@ If you see `prisma: command not found` errors during your deployment to Vercel,
:::
-Another option to avoid an outdated Prisma Client is to use [a custom output path](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path) and check your client into version control. This way each deployment is guaranteed to include the correct Prisma Client.
+Another option to avoid an outdated Prisma Client is to use [a custom output path](/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path) and check your client into version control. This way each deployment is guaranteed to include the correct Prisma Client.
```prisma title="schema.prisma" showLineNumbers
generator client {
@@ -76,16 +76,16 @@ generator client {
### Deploying Prisma in Monorepos on Vercel
If you are using Prisma inside a monorepo (e.g., with TurboRepo) and deploying to Vercel, you may encounter issues where required files—such as `libquery_engine-rhel-openssl-3.0.x.so.node` are missing from the deployed bundle. This is because Vercel aggressively optimizes serverless deployments, sometimes stripping out necessary Prisma files. To resolve this, use the [@prisma/nextjs-monorepo-workaround-plugin](https://www.npmjs.com/package/@prisma/nextjs-monorepo-workaround-plugin) plugin, which ensures that Prisma engine files are correctly included in the final bundle.
-For more details on how Prisma interacts with different bundlers like Webpack and Parcel, see our [Module bundlers](/v6/orm/prisma-client/deployment/module-bundlers#overview) page.
+For more details on how Prisma interacts with different bundlers like Webpack and Parcel, see our [Module bundlers](/orm/v6/prisma-client/deployment/module-bundlers#overview) page.
The usage of this plugin becomes obsolet if:
-- you are using [Prisma ORM without Rust engines](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine) (via `engineType = "client` on your `generator` block)
-- you are using the [new `prisma-client` generator](/v6/orm/prisma-schema/overview/generators#prisma-client)
+- you are using [Prisma ORM without Rust engines](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine) (via `engineType = "client` on your `generator` block)
+- you are using the [new `prisma-client` generator](/orm/v6/prisma-schema/overview/generators#prisma-client)
### CI/CD workflows
-In a more sophisticated CI/CD environment, you may additonally want to update the database schema with any migrations you have performed during local development. You can do this using the [`prisma migrate deploy`](/v6/orm/reference/prisma-cli-reference#migrate-deploy) command.
+In a more sophisticated CI/CD environment, you may additonally want to update the database schema with any migrations you have performed during local development. You can do this using the [`prisma migrate deploy`](/orm/v6/reference/prisma-cli-reference#migrate-deploy) command.
In that case, you could create a custom build command in your `package.json` (e.g. called `vercel-build`) that looks as follows:
@@ -133,15 +133,15 @@ To prevent this, use a _second_ hosted database to handle preview deployments. O
When you use a Function-as-a-Service provider, like Vercel Serverless functions, every invocation may result in a new connection to your database. This can cause your database to quickly run out of open connections and cause your application to stall. For this reason, pooling connections to your database is essential.
-You can use [Accelerate](/v6/accelerate) for connection pooling or [Prisma Postgres](/v6/postgres), which has built-in connection pooling, to reduce your Prisma Client bundle size, and to avoid cold starts.
+You can use [Accelerate](/accelerate) for connection pooling or [Prisma Postgres](/postgres), which has built-in connection pooling, to reduce your Prisma Client bundle size, and to avoid cold starts.
-For more information on connection management for serverless environments, refer to our [connection management guide](/v6/orm/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas).
+For more information on connection management for serverless environments, refer to our [connection management guide](/orm/v6/prisma-client/setup-and-configuration/databases-connections#serverless-environments-faas).
## Using Prisma ORM with Vercel Fluid
[Fluid compute](https://vercel.com/fluid) is a compute model from Vercel that combines the flexibility of serverless with the stability of servers, making it ideal for dynamic workloads such as streaming data and AI APIs. Vercel's Fluid compute [supports both edge and Node.js runtimes](https://vercel.com/docs/fluid-compute#available-runtime-support). A common challenge in traditional serverless platforms is leaked database connections when functions are suspended and pools can't close idle connections. Fluid provides [`attachDatabasePool`](https://vercel.com/blog/the-real-serverless-compute-to-database-connection-problem-solved) to ensure idle connections are released before a function is suspended.
-Use `attachDatabasePool` together with [Prisma's driver adapters](/v6/orm/overview/databases/database-drivers) to safely manage connections in Fluid:
+Use `attachDatabasePool` together with [Prisma's driver adapters](/orm/v6/overview/databases/database-drivers) to safely manage connections in Fluid:
```ts
import { Pool } from "pg";
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-10-deploy-to-vercel-deploy-button.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-10-deploy-to-vercel-deploy-button.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-10-deploy-to-vercel-deploy-button.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-10-deploy-to-vercel-deploy-button.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-20-deploy-to-vercel-select-github.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-20-deploy-to-vercel-select-github.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-20-deploy-to-vercel-select-github.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-20-deploy-to-vercel-select-github.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-30-deploy-to-vercel-create-git-repo.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-30-deploy-to-vercel-create-git-repo.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-30-deploy-to-vercel-create-git-repo.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-30-deploy-to-vercel-create-git-repo.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-40-deploy-to-vercel-configure-project.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-40-deploy-to-vercel-configure-project.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-40-deploy-to-vercel-configure-project.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-40-deploy-to-vercel-configure-project.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-50-deploy-to-vercel-success.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-50-deploy-to-vercel-success.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-50-deploy-to-vercel-success.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-50-deploy-to-vercel-success.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-60-deploy-to-vercel-preview-environment-variable.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-60-deploy-to-vercel-preview-environment-variable.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-60-deploy-to-vercel-preview-environment-variable.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-60-deploy-to-vercel-preview-environment-variable.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-70-deploy-to-vercel-environment-variables.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-70-deploy-to-vercel-environment-variables.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/300-70-deploy-to-vercel-environment-variables.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/300-70-deploy-to-vercel-environment-variables.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-02-deploy-to-netlify-example-repo-click-fork.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-02-deploy-to-netlify-example-repo-click-fork.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-02-deploy-to-netlify-example-repo-click-fork.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-02-deploy-to-netlify-example-repo-click-fork.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-03-deploy-to-netlify-example-repo-create-fork-page.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-03-deploy-to-netlify-example-repo-create-fork-page.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-03-deploy-to-netlify-example-repo-create-fork-page.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-03-deploy-to-netlify-example-repo-create-fork-page.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-04-deploy-to-netlify-copy-supabase-connection-string.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-04-deploy-to-netlify-copy-supabase-connection-string.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-04-deploy-to-netlify-copy-supabase-connection-string.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-04-deploy-to-netlify-copy-supabase-connection-string.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-05-deploy-to-netlify-netlify-init-configure-site.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-05-deploy-to-netlify-netlify-init-configure-site.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-05-deploy-to-netlify-netlify-init-configure-site.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-05-deploy-to-netlify-netlify-init-configure-site.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-06-deploy-to-netlify-site-settings.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-06-deploy-to-netlify-site-settings.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-06-deploy-to-netlify-site-settings.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-06-deploy-to-netlify-site-settings.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-07-deploy-to-netlify-environment-variables-settings.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-07-deploy-to-netlify-environment-variables-settings.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-07-deploy-to-netlify-environment-variables-settings.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-07-deploy-to-netlify-environment-variables-settings.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-08-deploy-to-netlify-application-deployed.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-08-deploy-to-netlify-application-deployed.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-08-deploy-to-netlify-application-deployed.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-08-deploy-to-netlify-application-deployed.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-09-deploy-to-netlify-application-deployed-call-result.snagx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-09-deploy-to-netlify-application-deployed-call-result.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/images/500-09-deploy-to-netlify-application-deployed-call-result.snagx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/images/500-09-deploy-to-netlify-application-deployed-call-result.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/index.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/index.mdx
similarity index 84%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/index.mdx
index 87fb4c6f4b..56e42b8e24 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/index.mdx
@@ -1,12 +1,12 @@
---
title: Serverless functions
description: 'Learn how to deploy your Prisma ORM-backed apps to FaaS providers like AWS Lambda, Netlify, or Vercel Serverless Functions'
-url: /v6/orm/prisma-client/deployment/serverless
+url: /orm/v6/prisma-client/deployment/serverless
metaTitle: Serverless functions
metaDescription: 'Learn how to deploy your Prisma ORM-backed apps to FaaS providers like AWS Lambda, Netlify, or Vercel Serverless Functions'
---
-If your application is deployed via a "Serverless Function" or "Function-as-a-Service (FaaS)" offering and uses a standard Node.js runtime, it is a serverless app. Common deployment examples include [AWS Lambda](/v6/orm/prisma-client/deployment/serverless/deploy-to-aws-lambda) and [Vercel Serverless Functions](/v6/orm/prisma-client/deployment/serverless/deploy-to-vercel).
+If your application is deployed via a "Serverless Function" or "Function-as-a-Service (FaaS)" offering and uses a standard Node.js runtime, it is a serverless app. Common deployment examples include [AWS Lambda](/orm/v6/prisma-client/deployment/serverless/deploy-to-aws-lambda) and [Vercel Serverless Functions](/orm/v6/prisma-client/deployment/serverless/deploy-to-vercel).
:::tip[Use Prisma ORM without Rust binaries]
@@ -19,9 +19,9 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
@@ -35,7 +35,7 @@ This setup can simplify deployments in:
- Read-only filesystem environments
- CI/CD pipelines with strict size limits
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/serverless/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/serverless/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-flyio.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-flyio.mdx
similarity index 93%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-flyio.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-flyio.mdx
index edf6103b27..06c7ff4ba7 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-flyio.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-flyio.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Fly.io
description: Learn how to deploy a Node.js server that uses Prisma ORM to Fly.io.
-url: /v6/orm/prisma-client/deployment/traditional/deploy-to-flyio
+url: /orm/v6/prisma-client/deployment/traditional/deploy-to-flyio
metaTitle: Deploy a Prisma app to Fly.io
metaDescription: Learn how to deploy a Node.js server that uses Prisma ORM to Fly.io.
---
@@ -47,9 +47,9 @@ The logic for the Express app is in two files:
The Prisma components of this app are in three files:
-- `prisma/schema.prisma`: The data model of this app. This example defines two models, `User` and `Post`. The format of this file follows the [Prisma schema](/v6/orm/prisma-schema/overview).
-- `prisma/migrations//migration.sql`: The SQL commands that construct this schema in a PostgreSQL database. You can auto-generate migration files like this one by running [`prisma migrate dev`](/v6/orm/prisma-migrate/understanding-prisma-migrate/mental-model#what-is-prisma-migrate).
-- `prisma/seed.js`: defines some test users and postsPrisma, used to [seed the database](/v6/orm/prisma-migrate/workflows/seeding) with starter data.
+- `prisma/schema.prisma`: The data model of this app. This example defines two models, `User` and `Post`. The format of this file follows the [Prisma schema](/orm/v6/prisma-schema/overview).
+- `prisma/migrations//migration.sql`: The SQL commands that construct this schema in a PostgreSQL database. You can auto-generate migration files like this one by running [`prisma migrate dev`](/orm/v6/prisma-migrate/understanding-prisma-migrate/mental-model#what-is-prisma-migrate).
+- `prisma/seed.js`: defines some test users and postsPrisma, used to [seed the database](/orm/v6/prisma-migrate/workflows/seeding) with starter data.
## Deploy the example
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-heroku.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-heroku.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-heroku.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-heroku.mdx
index 2af2ca2af1..be4270d987 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-heroku.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-heroku.mdx
@@ -1,14 +1,14 @@
---
title: Deploy to Heroku
description: Learn how to deploy a Node.js server that uses Prisma ORM to Heroku.
-url: /v6/orm/prisma-client/deployment/traditional/deploy-to-heroku
+url: /orm/v6/prisma-client/deployment/traditional/deploy-to-heroku
metaTitle: Deploy a Prisma app to Heroku
metaDescription: Learn how to deploy a Node.js server that uses Prisma ORM to Heroku.
---
In this guide, you will set up and deploy a Node.js server that uses Prisma ORM with PostgreSQL to [Heroku](https://www.heroku.com). The application exposes a REST API and uses Prisma Client to handle fetching, creating, and deleting records from a database.
-Heroku is a cloud platform as a service (PaaS). In contrast to the popular serverless deployment model, with Heroku, your application is constantly running even if no requests are made to it. This has several benefits due to the connection limits of a PostgreSQL database. For more information, check out the [general deployment documentation](/v6/orm/prisma-client/deployment/deploy-prisma)
+Heroku is a cloud platform as a service (PaaS). In contrast to the popular serverless deployment model, with Heroku, your application is constantly running even if no requests are made to it. This has several benefits due to the connection limits of a PostgreSQL database. For more information, check out the [general deployment documentation](/orm/v6/prisma-client/deployment/deploy-prisma)
Typically Heroku integrates with a Git repository for automatic deployments upon commits. You can deploy to Heroku from a GitHub repository or by pushing your source to a [Git repository that Heroku creates per app](https://devcenter.heroku.com/articles/git). This guide uses the latter approach whereby you push your code to the app's repository on Heroku, which triggers a build and deploys the application.
@@ -38,9 +38,9 @@ While the example uses REST, the same principles apply to a GraphQL server, with
## Prisma ORM workflow
-At the core of Prisma ORM is the [Prisma schema](/v6/orm/prisma-schema/overview) – a declarative configuration where you define your data model and other Prisma ORM-related configuration. The Prisma schema is also a single source of truth for both Prisma Client and Prisma Migrate.
+At the core of Prisma ORM is the [Prisma schema](/orm/v6/prisma-schema/overview) – a declarative configuration where you define your data model and other Prisma ORM-related configuration. The Prisma schema is also a single source of truth for both Prisma Client and Prisma Migrate.
-In this guide, you will use [Prisma Migrate](/v6/orm/prisma-migrate/getting-started) to create the database schema. Prisma Migrate is based on the Prisma schema and works by generating `.sql` migration files that are executed against the database.
+In this guide, you will use [Prisma Migrate](/orm/v6/prisma-migrate/getting-started) to create the database schema. Prisma Migrate is based on the Prisma schema and works by generating `.sql` migration files that are executed against the database.
Migrate comes with two primary workflows:
@@ -51,7 +51,7 @@ For brevity, the guide does not cover how migrations are created with `prisma mi
You will use Heroku's [release phase](https://devcenter.heroku.com/articles/release-phase) to run the `prisma migrate deploy` command so that the migrations are applied before the application starts.
-To learn more about how migrations are created with Prisma Migrate, check out the [start from scratch guide](/v6/prisma-orm/quickstart/postgresql)
+To learn more about how migrations are created with Prisma Migrate, check out the [start from scratch guide](/prisma-orm/quickstart/postgresql)
## 1. Download the example and install dependencies
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-koyeb.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-koyeb.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-koyeb.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-koyeb.mdx
index bbd4ecef72..1d75694b76 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-koyeb.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-koyeb.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Koyeb
description: Learn how to deploy a Node.js server that uses Prisma ORM to Koyeb Serverless Platform.
-url: /v6/orm/prisma-client/deployment/traditional/deploy-to-koyeb
+url: /orm/v6/prisma-client/deployment/traditional/deploy-to-koyeb
metaTitle: Deploy a Prisma ORM app to Koyeb
metaDescription: Learn how to deploy a Node.js server that uses Prisma ORM to Koyeb Serverless Platform.
---
@@ -33,9 +33,9 @@ The focus of this guide is showing how to deploy projects using Prisma ORM to Ko
## Prisma ORM workflow
-At the core of Prisma ORM is the [Prisma schema](/v6/orm/prisma-schema/overview) – a declarative configuration where you define your data model and other Prisma ORM-related configuration. The Prisma schema is also a single source of truth for both Prisma Client and Prisma Migrate.
+At the core of Prisma ORM is the [Prisma schema](/orm/v6/prisma-schema/overview) – a declarative configuration where you define your data model and other Prisma ORM-related configuration. The Prisma schema is also a single source of truth for both Prisma Client and Prisma Migrate.
-In this guide, you will create the database schema with [Prisma Migrate](/v6/orm/prisma-migrate/getting-started) to create the database schema. Prisma Migrate is based on the Prisma schema and works by generating `.sql` migration files that are executed against the database.
+In this guide, you will create the database schema with [Prisma Migrate](/orm/v6/prisma-migrate/getting-started) to create the database schema. Prisma Migrate is based on the Prisma schema and works by generating `.sql` migration files that are executed against the database.
Migrate comes with two primary workflows:
@@ -46,7 +46,7 @@ For brevity, the guide does not cover how migrations are created with `prisma mi
You will use Koyeb's [build step](https://www.koyeb.com/docs/build-and-deploy/build-from-git#the-buildpack-build-process) to run the `prisma migrate deploy` command so that the migrations are applied before the application starts.
-To learn more about how migrations are created with Prisma Migrate, check out the [start from scratch guide](/v6/prisma-orm/quickstart/postgresql)
+To learn more about how migrations are created with Prisma Migrate, check out the [start from scratch guide](/prisma-orm/quickstart/postgresql)
## 1. Download the example and install dependencies
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-railway.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-railway.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-railway.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-railway.mdx
index ebdbbace79..3aef488c8e 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-railway.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-railway.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Railway
description: Learn how to deploy an app that uses Prisma ORM and Prisma Postgres to Railway.
-url: /v6/orm/prisma-client/deployment/traditional/deploy-to-railway
+url: /orm/v6/prisma-client/deployment/traditional/deploy-to-railway
metaTitle: Deploy a Prisma app to Railway
metaDescription: Learn how to deploy an app that uses Prisma ORM and Prisma Postgres to Railway.
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-render.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-render.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-render.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-render.mdx
index c4b74eff3a..d3737a30f8 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-render.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-render.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Render
description: Learn how to deploy a Node.js server that uses Prisma ORM to Render.
-url: /v6/orm/prisma-client/deployment/traditional/deploy-to-render
+url: /orm/v6/prisma-client/deployment/traditional/deploy-to-render
metaTitle: Deploy a Prisma app to Render
metaDescription: Learn how to deploy a Node.js server that uses Prisma ORM to Render.
---
@@ -23,7 +23,7 @@ The [Prisma Render deployment example](https://github.com/prisma/prisma-examples
[Render](https://render.com) is a cloud application platform that lets developers easily deploy and scale full-stack applications. For this example, it's helpful to know:
-- Render lets you deploy long-running, "serverful" full-stack applications. You can configure Render services to [autoscale](https://docs.render.com/scaling) based on CPU and/or memory usage. This is one of several [deployment paradigms](/v6/orm/prisma-client/deployment/deploy-prisma) you can choose from.
+- Render lets you deploy long-running, "serverful" full-stack applications. You can configure Render services to [autoscale](https://docs.render.com/scaling) based on CPU and/or memory usage. This is one of several [deployment paradigms](/orm/v6/prisma-client/deployment/deploy-prisma) you can choose from.
- Render natively supports [common runtimes](https://docs.render.com/language-support), including Node.js and Bun. In this guide, we'll use the Node.js runtime.
- Render [integrates with Git repos](https://docs.render.com/github) for automatic deployments upon commits. You can deploy to Render from GitHub, GitLab, or Bitbucket. In this guide, we'll deploy from a Git repository.
@@ -55,8 +55,8 @@ The logic for the Express app is in two files:
The Prisma components of this app are in two files:
-- `prisma/schema.prisma`: The data model of this app. This example defines two models, `User` and `Post`. The format of this file follows the [Prisma schema](/v6/orm/prisma-schema/overview).
-- `prisma/migrations//migration.sql`: The SQL commands that construct this schema in a PostgreSQL database. You can auto-generate migration files like this one by running [`prisma migrate dev`](/v6/orm/prisma-migrate/understanding-prisma-migrate/mental-model#what-is-prisma-migrate).
+- `prisma/schema.prisma`: The data model of this app. This example defines two models, `User` and `Post`. The format of this file follows the [Prisma schema](/orm/v6/prisma-schema/overview).
+- `prisma/migrations//migration.sql`: The SQL commands that construct this schema in a PostgreSQL database. You can auto-generate migration files like this one by running [`prisma migrate dev`](/orm/v6/prisma-migrate/understanding-prisma-migrate/mental-model#what-is-prisma-migrate).
### Render Blueprint
@@ -116,7 +116,7 @@ You can also deploy the example using the Render Blueprint. Follow Render's [Blu
## Bonus: Seed the database
-Prisma ORM includes a framework for [seeding the database](/v6/orm/prisma-migrate/workflows/seeding) with starter data. In our example, `prisma/seed.js` defines some test users and posts.
+Prisma ORM includes a framework for [seeding the database](/orm/v6/prisma-migrate/workflows/seeding) with starter data. In our example, `prisma/seed.js` defines some test users and posts.
To add these users to the database, we can either:
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-sevalla.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-sevalla.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-sevalla.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-sevalla.mdx
index 4af652a0ce..6472401bf1 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-sevalla.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/deploy-to-sevalla.mdx
@@ -1,7 +1,7 @@
---
title: Deploy to Sevalla
description: Learn how to deploy a Node.js server that uses Prisma ORM to Sevalla.
-url: /v6/orm/prisma-client/deployment/traditional/deploy-to-sevalla
+url: /orm/v6/prisma-client/deployment/traditional/deploy-to-sevalla
metaTitle: Deploy a Prisma app to Sevalla
metaDescription: Learn how to deploy a Node.js server that uses Prisma ORM to Sevalla.
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/index.mdx b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/index.mdx
similarity index 65%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/index.mdx
index 450de57543..03c22360fc 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/index.mdx
@@ -1,11 +1,11 @@
---
title: Traditional servers
description: 'Learn how to deploy your Prisma-backed apps to PaaS providers like Heroku, Koyeb, or AWS EC2'
-url: /v6/orm/prisma-client/deployment/traditional
+url: /orm/v6/prisma-client/deployment/traditional
metaTitle: Traditional servers
metaDescription: 'Learn how to deploy your Prisma-backed apps to PaaS providers like Heroku, Koyeb, or AWS EC2'
---
-If your application is deployed via a Platform-as-a-Service (PaaS) provider, whether containerized or not, it is a traditionally-deployed app. Common deployment examples include [Heroku](/v6/orm/prisma-client/deployment/traditional/deploy-to-heroku) and [Koyeb](/v6/orm/prisma-client/deployment/traditional/deploy-to-koyeb).
+If your application is deployed via a Platform-as-a-Service (PaaS) provider, whether containerized or not, it is a traditionally-deployed app. Common deployment examples include [Heroku](/orm/v6/prisma-client/deployment/traditional/deploy-to-heroku) and [Koyeb](/orm/v6/prisma-client/deployment/traditional/deploy-to-koyeb).
## Traditional (PaaS) guides
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/deployment/traditional/meta.json
diff --git a/apps/docs/content/docs/orm/v6/prisma-client/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/meta.json
new file mode 100644
index 0000000000..5ec7a0aa33
--- /dev/null
+++ b/apps/docs/content/docs/orm/v6/prisma-client/meta.json
@@ -0,0 +1,16 @@
+{
+ "title": "Prisma Client",
+ "defaultOpen": true,
+ "pages": [
+ "setup-and-configuration",
+ "queries",
+ "client-extensions",
+ "deployment",
+ "observability-and-logging",
+ "debugging-and-troubleshooting",
+ "special-fields-and-types",
+ "testing",
+ "type-safety",
+ "using-raw-sql"
+ ]
+}
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/logging.mdx b/apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/logging.mdx
similarity index 85%
rename from apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/logging.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/logging.mdx
index e32ea0adfe..23ccba4e85 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/logging.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/logging.mdx
@@ -1,27 +1,27 @@
---
title: Logging
description: Learn how to configure Prisma Client to log the raw SQL queries it sends to the database and other information.
-url: /v6/orm/prisma-client/observability-and-logging/logging
+url: /orm/v6/prisma-client/observability-and-logging/logging
metaTitle: Logging
metaDescription: Learn how to configure Prisma Client to log the raw SQL queries it sends to the database and other information.
---
-Use the `PrismaClient` [`log`](/v6/orm/reference/prisma-client-reference#log) parameter to configure [log levels](/v6/orm/reference/prisma-client-reference#log-levels) , including warnings, errors, and information about the queries sent to the database.
+Use the `PrismaClient` [`log`](/orm/v6/reference/prisma-client-reference#log) parameter to configure [log levels](/orm/v6/reference/prisma-client-reference#log-levels) , including warnings, errors, and information about the queries sent to the database.
Prisma Client supports two types of logging:
- Logging to [stdout](https://en.wikipedia.org/wiki/Standard_streams) (default)
-- Event-based logging (use [`$on()`](/v6/orm/reference/prisma-client-reference#on) method to [subscribe to events](#event-based-logging))
+- Event-based logging (use [`$on()`](/orm/v6/reference/prisma-client-reference#on) method to [subscribe to events](#event-based-logging))
:::info
-You can also use the `DEBUG` environment variable to enable debugging output in Prisma Client. See [Debugging](/v6/orm/prisma-client/debugging-and-troubleshooting/debugging) for more information.
+You can also use the `DEBUG` environment variable to enable debugging output in Prisma Client. See [Debugging](/orm/v6/prisma-client/debugging-and-troubleshooting/debugging) for more information.
:::
:::info
-If you want a detailed insight into your Prisma Client's performance at the level of individual operations, see [Tracing](/v6/orm/prisma-client/observability-and-logging/opentelemetry-tracing).
+If you want a detailed insight into your Prisma Client's performance at the level of individual operations, see [Tracing](/orm/v6/prisma-client/observability-and-logging/opentelemetry-tracing).
:::
@@ -139,4 +139,4 @@ Query: db.User.aggregate([ { $project: { _id: 1, email: 1, name: 1, }, }, ])
Query: db.Post.aggregate([ { $match: { userId: { $in: [ "622f0bbbdf635a42016ee325", ], }, }, }, { $project: { _id: 1, slug: 1, title: 1, body: 1, userId: 1, }, }, ])
```
-The exact [event (`e`) type and the properties available](/v6/orm/reference/prisma-client-reference#event-types) depends on the log level.
+The exact [event (`e`) type and the properties available](/orm/v6/reference/prisma-client-reference#event-types) depends on the log level.
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/metrics.mdx b/apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/metrics.mdx
similarity index 99%
rename from apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/metrics.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/metrics.mdx
index 20267d76ec..df76172365 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/metrics.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/metrics.mdx
@@ -2,7 +2,7 @@
title: Metrics
description: Diagnose application performance with insights into Prisma Client database activity.
badge: preview
-url: /v6/orm/prisma-client/observability-and-logging/metrics
+url: /orm/v6/prisma-client/observability-and-logging/metrics
metaTitle: Metrics
metaDescription: Diagnose application performance with insights into Prisma Client database activity.
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/opentelemetry-tracing.mdx b/apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/opentelemetry-tracing.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/opentelemetry-tracing.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/opentelemetry-tracing.mdx
index ccfe1a46a3..581d627d94 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/opentelemetry-tracing.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/opentelemetry-tracing.mdx
@@ -1,7 +1,7 @@
---
title: OpenTelemetry tracing
description: Diagnose application performance with detailed traces of each query.
-url: /v6/orm/prisma-client/observability-and-logging/opentelemetry-tracing
+url: /orm/v6/prisma-client/observability-and-logging/opentelemetry-tracing
metaTitle: OpenTelemetry tracing
metaDescription: Diagnose application performance with detailed traces of each query.
---
@@ -16,7 +16,7 @@ Tracing gives you a highly detailed, operation-level insight into your Prisma OR
:::tip[Correlate database queries with traces]
-You can add the `traceparent` header to your SQL queries as comments using the [`@prisma/sqlcommenter-trace-context`](/v6/orm/prisma-client/observability-and-logging/sql-comments#trace-context) plugin. This enables correlation between distributed traces and database queries in your monitoring tools.
+You can add the `traceparent` header to your SQL queries as comments using the [`@prisma/sqlcommenter-trace-context`](/orm/v6/prisma-client/observability-and-logging/sql-comments#trace-context) plugin. This enables correlation between distributed traces and database queries in your monitoring tools.
:::
@@ -39,7 +39,7 @@ For each trace, Prisma Client outputs a series of spans. The number and type of
- `prisma:client:operation`: Represents the entire Prisma Client operation, from Prisma Client to the database and back. It contains details such as the model and method called by Prisma Client. Depending on the Prisma operation, it contains one or more of the following spans:
- `prisma:client:connect`: Represents how long it takes for Prisma Client to connect to the database.
- - `prisma:client:serialize`: Represents how long it takes to validate and transform a Prisma Client operation into a query for the [query engine](/v6/orm/more/internals/engines).
+ - `prisma:client:serialize`: Represents how long it takes to validate and transform a Prisma Client operation into a query for the [query engine](/orm/v6/more/internals/engines).
- `prisma:engine:query`: Represents how long a query takes in the query engine.
- `prisma:engine:connection`: Represents how long it takes for Prisma Client to get a database connection.
- `prisma:engine:db_query`: Represents the database query that was executed against the database. It includes the query in the tags, and how long the query took to run.
@@ -301,7 +301,7 @@ export function otelSetup() {
When you perform an interactive transaction, you'll see the following spans in addition to the [standard spans](#trace-output):
- `prisma:client:transaction`: A [root span](https://opentelemetry.io/docs/concepts/observability-primer/#distributed-traces) that wraps the `prisma` span.
- - `prisma:engine:itx_runner`: Represents how long an interactive transaction takes in the [query engine](/v6/orm/more/internals/engines).
+ - `prisma:engine:itx_runner`: Represents how long an interactive transaction takes in the [query engine](/orm/v6/more/internals/engines).
- `prisma:engine:itx_query_builder`: Represents the time it takes to build an interactive transaction.
As an example, take the following Prisma schema:
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/sql-comments.mdx b/apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/sql-comments.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/sql-comments.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/sql-comments.mdx
index 576c69bd02..1cd7c6cee4 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/observability-and-logging/sql-comments.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/observability-and-logging/sql-comments.mdx
@@ -1,7 +1,7 @@
---
title: SQL comments
description: 'Add metadata to your SQL queries as comments for improved observability, debugging, and tracing.'
-url: /v6/orm/prisma-client/observability-and-logging/sql-comments
+url: /orm/v6/prisma-client/observability-and-logging/sql-comments
metaTitle: SQL comments
metaDescription: 'Add metadata to your SQL queries as comments for improved observability, debugging, and tracing.'
---
@@ -162,7 +162,7 @@ SELECT * FROM "User" /*traceparent='00-0af7651916cd43dd8448eb211c80319c-b9c7c989
:::info
-The trace context plugin requires [`@prisma/instrumentation`](/v6/orm/prisma-client/observability-and-logging/opentelemetry-tracing) to be configured. The `traceparent` is only added when tracing is active and the span is sampled.
+The trace context plugin requires [`@prisma/instrumentation`](/orm/v6/prisma-client/observability-and-logging/opentelemetry-tracing) to be configured. The `traceparent` is only added when tracing is active and the span is sampled.
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/aggregation-grouping-summarizing.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/aggregation-grouping-summarizing.mdx
similarity index 93%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/aggregation-grouping-summarizing.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/aggregation-grouping-summarizing.mdx
index 326f7bbbf7..e78d901f8d 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/aggregation-grouping-summarizing.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/aggregation-grouping-summarizing.mdx
@@ -1,7 +1,7 @@
---
title: 'Aggregation, grouping, and summarizing'
description: 'Use Prisma Client to aggregate, group by, count, and select distinct.'
-url: /v6/orm/prisma-client/queries/aggregation-grouping-summarizing
+url: /orm/v6/prisma-client/queries/aggregation-grouping-summarizing
metaTitle: 'Aggregation, grouping, and summarizing (Concepts)'
metaDescription: 'Use Prisma Client to aggregate, group by, count, and select distinct.'
---
@@ -10,7 +10,7 @@ Prisma Client allows you to count records, aggregate number fields, and select d
## Aggregate
-Prisma Client allows you to [`aggregate`](/v6/orm/reference/prisma-client-reference#aggregate) on the **number** fields (such as `Int` and `Float`) of a model. The following query returns the average age of all users:
+Prisma Client allows you to [`aggregate`](/orm/v6/reference/prisma-client-reference#aggregate) on the **number** fields (such as `Int` and `Float`) of a model. The following query returns the average age of all users:
```ts
const aggregations = await prisma.user.aggregate({
@@ -84,22 +84,11 @@ This allows you to differentiate between the true aggregate value (which could b
## Group by
-Prisma Client's [`groupBy()`](/v6/orm/reference/prisma-client-reference#groupby) allows you to **group records** by one or more field values - such as `country`, or `country` and `city` and **perform aggregations** on each group, such as finding the average age of people living in a particular city. `groupBy()` is a GA in [2.20.0](https://github.com/prisma/prisma/releases/2.20.0) and later.
+Prisma Client's [`groupBy()`](/orm/v6/reference/prisma-client-reference#groupby) allows you to **group records** by one or more field values - such as `country`, or `country` and `city` and **perform aggregations** on each group, such as finding the average age of people living in a particular city. `groupBy()` is a GA in [2.20.0](https://github.com/prisma/prisma/releases/2.20.0) and later.
The following video uses `groupBy()` to summarize total COVID-19 cases by continent:
-
-
-
-
-
+
The following example groups all users by the `country` field and returns the total number of profile views for each country:
@@ -309,7 +298,7 @@ Both `distinct` and `groupBy()` group records by one or more unique field values
### Count records
-Use [`count()`](/v6/orm/reference/prisma-client-reference#count) to count the number of records or non-`null` field values. The following example query counts all users:
+Use [`count()`](/orm/v6/reference/prisma-client-reference#count) to count the number of records or non-`null` field values. The following example query counts all users:
```ts
const userCount = await prisma.user.count();
@@ -319,7 +308,7 @@ const userCount = await prisma.user.count();
:::info
-This feature is generally available in version [3.0.1](https://github.com/prisma/prisma/releases/3.0.1) and later. To use this feature in versions before 3.0.1 the [Preview feature](/v6/orm/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature) `selectRelationCount` will need to be enabled.
+This feature is generally available in version [3.0.1](https://github.com/prisma/prisma/releases/3.0.1) and later. To use this feature in versions before 3.0.1 the [Preview feature](/orm/v6/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature) `selectRelationCount` will need to be enabled.
:::
@@ -424,11 +413,11 @@ const usersWithCount = await prisma.user.findMany({
:::info
-This feature is generally available in version `4.16.0` and later. To use this feature in versions [`4.3.0`](https://github.com/prisma/prisma/releases/tag/4.3.0) to [`4.15.0`](https://github.com/prisma/prisma/releases/tag/4.15.0) the [Preview feature](/v6/orm/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature) `filteredRelationCount` will need to be enabled.
+This feature is generally available in version `4.16.0` and later. To use this feature in versions [`4.3.0`](https://github.com/prisma/prisma/releases/tag/4.3.0) to [`4.15.0`](https://github.com/prisma/prisma/releases/tag/4.15.0) the [Preview feature](/orm/v6/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature) `filteredRelationCount` will need to be enabled.
:::
-Use `where` to filter the fields returned by the `_count` output type. You can do this on [scalar fields](/v6/orm/prisma-schema/data-model/models#scalar-fields), [relation fields](/v6/orm/prisma-schema/data-model/models#relation-fields) and fields of a [composite type](/v6/orm/prisma-schema/data-model/models#defining-composite-types).
+Use `where` to filter the fields returned by the `_count` output type. You can do this on [scalar fields](/orm/v6/prisma-schema/data-model/models#scalar-fields), [relation fields](/orm/v6/prisma-schema/data-model/models#relation-fields) and fields of a [composite type](/orm/v6/prisma-schema/data-model/models#defining-composite-types).
For example, the following query returns all user posts with the title "Hello!":
@@ -509,7 +498,7 @@ const postCount = await prisma.post.count({
## Select distinct
-Prisma Client allows you to filter duplicate rows from a Prisma Query response to a [`findMany`](/v6/orm/reference/prisma-client-reference#findmany) query using [`distinct`](/v6/orm/reference/prisma-client-reference#distinct) . `distinct` is often used in combination with [`select`](/v6/orm/reference/prisma-client-reference#select) to identify certain unique combinations of values in the rows of your table.
+Prisma Client allows you to filter duplicate rows from a Prisma Query response to a [`findMany`](/orm/v6/reference/prisma-client-reference#findmany) query using [`distinct`](/orm/v6/reference/prisma-client-reference#distinct) . `distinct` is often used in combination with [`select`](/orm/v6/reference/prisma-client-reference#select) to identify certain unique combinations of values in the rows of your table.
The following example returns all fields for all `User` records with distinct `name` field values:
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/case-sensitivity.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/case-sensitivity.mdx
similarity index 96%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/case-sensitivity.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/case-sensitivity.mdx
index 34ba776ee1..5d1bf4471f 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/case-sensitivity.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/case-sensitivity.mdx
@@ -2,7 +2,7 @@
title: Case sensitivity
description: How Prisma Client handles case sensitivity when filtering and sorting.
preview: false
-url: /v6/orm/prisma-client/queries/case-sensitivity
+url: /orm/v6/prisma-client/queries/case-sensitivity
metaTitle: Case sensitivity
metaDescription: How Prisma Client handles case sensitivity when filtering and sorting.
---
@@ -14,9 +14,9 @@ Case sensitivity affects **filtering** and **sorting** of data, and is determine
| Sort ascending | `Apple`, `Banana`, `apple pie`, `banana pie` | `Apple`, `apple pie`, `Banana`, `banana pie` |
| Match `"apple"` | `apple` | `Apple`, `apple` |
-If you use a **relational database connector**, [Prisma Client](/v6/orm/prisma-client/setup-and-configuration/introduction) respects your database collation. Options and recommendations for supporting **case-insensitive** filtering and sorting with Prisma Client depend on your [database provider](#options-for-case-insensitive-filtering).
+If you use a **relational database connector**, [Prisma Client](/orm/v6/prisma-client/setup-and-configuration/introduction) respects your database collation. Options and recommendations for supporting **case-insensitive** filtering and sorting with Prisma Client depend on your [database provider](#options-for-case-insensitive-filtering).
-If you use the MongoDB connector, [Prisma Client](/v6/orm/prisma-client/queries/crud) uses RegEx rules to enable case-insensitive filtering. The connector _does not_ use [MongoDB collation](https://www.mongodb.com/docs/manual/reference/collation/).
+If you use the MongoDB connector, [Prisma Client](/orm/v6/prisma-client/queries/crud) uses RegEx rules to enable case-insensitive filtering. The connector _does not_ use [MongoDB collation](https://www.mongodb.com/docs/manual/reference/collation/).
> **Note**: Follow the progress of [case-insensitive sorting on GitHub](https://github.com/prisma/prisma-client-js/issues/841).
@@ -101,7 +101,7 @@ const users = await prisma.user.findMany({
});
```
-See also: [Filtering (Case-insensitive filtering)](/v6/orm/prisma-client/queries/filtering-and-sorting#case-insensitive-filtering)
+See also: [Filtering (Case-insensitive filtering)](/orm/v6/prisma-client/queries/filtering-and-sorting#case-insensitive-filtering)
#### Caveats
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/computed-fields.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/computed-fields.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/computed-fields.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/computed-fields.mdx
index 697bba788b..bacd9fdcf0 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/computed-fields.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/computed-fields.mdx
@@ -1,7 +1,7 @@
---
title: Computed fields
description: This page explains how to use client extensions to add computed fields to Prisma models.
-url: /v6/orm/prisma-client/queries/computed-fields
+url: /orm/v6/prisma-client/queries/computed-fields
metaTitle: Computed fields
metaDescription: This page explains how to use client extensions to add computed fields to Prisma models.
---
@@ -10,7 +10,7 @@ Computed fields allow you to derive a new field based on existing data. A common
## Using a Prisma Client extension
-The following example illustrates how to create a [Prisma Client extension](/v6/orm/prisma-client/client-extensions) that adds a `fullName` computed field at runtime to the `User` model in a Prisma schema.
+The following example illustrates how to create a [Prisma Client extension](/orm/v6/prisma-client/client-extensions) that adds a `fullName` computed field at runtime to the `User` model in a Prisma schema.
```ts tab="Prisma Client extension"
import { PrismaClient } from "../prisma/generated/client";
@@ -140,6 +140,6 @@ With this function, any object that contains `firstName` and `lastName` keys can
### Going further
-- Learn how you can use [Prisma Client extensions](/v6/orm/prisma-client/client-extensions) to add a computed field to your schema — [example](https://github.com/prisma/prisma-client-extensions/tree/main/computed-fields).
-- Learn how you can move the `computeFullName` function into [a custom model](/v6/orm/prisma-client/queries/custom-models).
+- Learn how you can use [Prisma Client extensions](/orm/v6/prisma-client/client-extensions) to add a computed field to your schema — [example](https://github.com/prisma/prisma-client-extensions/tree/main/computed-fields).
+- Learn how you can move the `computeFullName` function into [a custom model](/orm/v6/prisma-client/queries/custom-models).
- There's an [open feature request](https://github.com/prisma/prisma/issues/3394) to add native support to Prisma Client. If you'd like to see that happen, make sure to upvote that issue and share your use case!
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/crud.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/crud.mdx
similarity index 89%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/crud.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/crud.mdx
index d66be24a5b..ee81ba541c 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/crud.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/crud.mdx
@@ -1,7 +1,7 @@
---
title: CRUD
description: How to perform CRUD with Prisma Client.
-url: /v6/orm/prisma-client/queries/crud
+url: /orm/v6/prisma-client/queries/crud
metaTitle: CRUD (Reference)
metaDescription: How to perform CRUD with Prisma Client.
---
@@ -13,7 +13,7 @@ This page describes how to perform CRUD operations with your generated Prisma Cl
- [Update](#update)
- [Delete](#delete)
-Refer to the [Prisma Client API reference documentation](/v6/orm/reference/prisma-client-reference) for detailed explanations of each method.
+Refer to the [Prisma Client API reference documentation](/orm/v6/reference/prisma-client-reference) for detailed explanations of each method.
## Example schema
@@ -141,7 +141,7 @@ For **MongoDB**, ensure your data is in a uniform shape and matches the model de
### Create a single record
-The following query creates ([`create()`](/v6/orm/reference/prisma-client-reference#create)) a single user with two fields:
+The following query creates ([`create()`](/orm/v6/reference/prisma-client-reference#create)) a single user with two fields:
```ts
const user = await prisma.user.create({
@@ -163,7 +163,7 @@ const user = await prisma.user.create({
}
```
-The user's `id` is auto-generated, and your schema determines [which fields are mandatory](/v6/orm/prisma-schema/data-model/models#optional-and-mandatory-fields).
+The user's `id` is auto-generated, and your schema determines [which fields are mandatory](/orm/v6/prisma-schema/data-model/models#optional-and-mandatory-fields).
#### Create a single record using generated types
@@ -203,13 +203,13 @@ async function main() {
main();
```
-For more information about working with generated types, see: [Generated types](/v6/orm/prisma-client/type-safety).
+For more information about working with generated types, see: [Generated types](/orm/v6/prisma-client/type-safety).
### Create multiple records
Prisma Client supports bulk inserts as a GA feature in [2.20.0](https://github.com/prisma/prisma/releases/2.20.0) and later.
-The following [`createMany()`](/v6/orm/reference/prisma-client-reference#createmany) query creates multiple users and skips any duplicates (`email` must be unique):
+The following [`createMany()`](/orm/v6/reference/prisma-client-reference#createmany) query creates multiple users and skips any duplicates (`email` must be unique):
```ts
const createMany = await prisma.user.createMany({
@@ -248,20 +248,11 @@ SELECT "public"."User"."country", "public"."User"."city", "public"."User"."email
The following video demonstrates how to use `createMany()` and [faker.js](https://github.com/faker-js/faker/) to seed a database with sample data:
-
-
-
+
### Create records and connect or create related records
-See [Working with relations > Nested writes](/v6/orm/prisma-client/queries/relation-queries#nested-writes) for information about creating a record and one or more related records at the same time.
+See [Working with relations > Nested writes](/orm/v6/prisma-client/queries/relation-queries#nested-writes) for information about creating a record and one or more related records at the same time.
### Create and return multiple records
@@ -313,7 +304,7 @@ const users = await prisma.user.createManyAndReturn({
### Get record by ID or unique identifier
-The following queries return a single record ([`findUnique()`](/v6/orm/reference/prisma-client-reference#findunique)) by unique identifier or ID:
+The following queries return a single record ([`findUnique()`](/orm/v6/reference/prisma-client-reference#findunique)) by unique identifier or ID:
```ts
// By unique identifier
@@ -344,17 +335,17 @@ const user = await prisma.user.findUnique({
### Get all records
-The following [`findMany()`](/v6/orm/reference/prisma-client-reference#findmany) query returns _all_ `User` records:
+The following [`findMany()`](/orm/v6/reference/prisma-client-reference#findmany) query returns _all_ `User` records:
```ts
const users = await prisma.user.findMany();
```
-You can also [paginate your results](/v6/orm/prisma-client/queries/pagination).
+You can also [paginate your results](/orm/v6/prisma-client/queries/pagination).
### Get the first record that matches a specific criteria
-The following [`findFirst()`](/v6/orm/reference/prisma-client-reference#findfirst) query returns the _most recently created user_ with at least one post that has more than 100 likes:
+The following [`findFirst()`](/orm/v6/reference/prisma-client-reference#findfirst) query returns the _most recently created user_ with at least one post that has more than 100 likes:
1. Order users by descending ID (largest first) - the largest ID is the most recent
2. Return the first user in descending order with at least one post that has more than 100 likes
@@ -378,7 +369,7 @@ const findUser = await prisma.user.findFirst({
### Get a filtered list of records
-Prisma Client supports [filtering](/v6/orm/prisma-client/queries/filtering-and-sorting) on record fields and related record fields.
+Prisma Client supports [filtering](/orm/v6/prisma-client/queries/filtering-and-sorting) on record fields and related record fields.
#### Filter by a single field value
@@ -396,7 +387,7 @@ const users = await prisma.user.findMany({
#### Filter by multiple field values
-The following query uses a combination of [operators](/v6/orm/reference/prisma-client-reference#filter-conditions-and-operators) to return users whose name start with `E` _or_ administrators with at least 1 profile view:
+The following query uses a combination of [operators](/orm/v6/reference/prisma-client-reference#filter-conditions-and-operators) to return users whose name start with `E` _or_ administrators with at least 1 profile view:
```ts
const users = await prisma.user.findMany({
@@ -441,7 +432,7 @@ const users = await prisma.user.findMany({
});
```
-See [Working with relations](/v6/orm/prisma-client/queries/relation-queries) for more examples of filtering on related field values.
+See [Working with relations](/orm/v6/prisma-client/queries/relation-queries) for more examples of filtering on related field values.
### Select a subset of fields
@@ -465,8 +456,8 @@ const user = await prisma.user.findUnique({
For more information about including relations, refer to:
-- [Select fields](/v6/orm/prisma-client/queries/select-fields)
-- [Relation queries](/v6/orm/prisma-client/queries/relation-queries)
+- [Select fields](/orm/v6/prisma-client/queries/select-fields)
+- [Relation queries](/orm/v6/prisma-client/queries/relation-queries)
#### Select a subset of related record fields
@@ -495,11 +486,11 @@ const user = await prisma.user.findUnique({
{ email: 'emma@prisma.io', posts: [ { likes: 0 }, { likes: 0 } ] }
```
-For more information about including relations, see [Select fields and include relations](/v6/orm/prisma-client/queries/select-fields).
+For more information about including relations, see [Select fields and include relations](/orm/v6/prisma-client/queries/select-fields).
### Select distinct field values
-See [Select `distinct`](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#select-distinct) for information about selecting distinct field values.
+See [Select `distinct`](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#select-distinct) for information about selecting distinct field values.
### Include related records
@@ -555,17 +546,17 @@ const users = await prisma.user.findMany({
}
```
-For more information about including relations, see [Select fields and include relations](/v6/orm/prisma-client/queries/select-fields).
+For more information about including relations, see [Select fields and include relations](/orm/v6/prisma-client/queries/select-fields).
#### Include a filtered list of relations
-See [Working with relations](/v6/orm/prisma-client/queries/relation-queries#filter-a-list-of-relations) to find out how to combine [`include`](/v6/orm/reference/prisma-client-reference#include) and `where` for a filtered list of relations - for example, only include a user's published posts.
+See [Working with relations](/orm/v6/prisma-client/queries/relation-queries#filter-a-list-of-relations) to find out how to combine [`include`](/orm/v6/reference/prisma-client-reference#include) and `where` for a filtered list of relations - for example, only include a user's published posts.
## Update
### Update a single record
-The following query uses [`update()`](/v6/orm/reference/prisma-client-reference#update) to find and update a single `User` record by `email`:
+The following query uses [`update()`](/orm/v6/reference/prisma-client-reference#update) to find and update a single `User` record by `email`:
```ts
const updateUser = await prisma.user.update({
@@ -591,7 +582,7 @@ const updateUser = await prisma.user.update({
### Update multiple records
-The following query uses [`updateMany()`](/v6/orm/reference/prisma-client-reference#updatemany) to update all `User` records that contain `prisma.io`:
+The following query uses [`updateMany()`](/orm/v6/reference/prisma-client-reference#updatemany) to update all `User` records that contain `prisma.io`:
```ts
const updateUsers = await prisma.user.updateMany({
@@ -664,7 +655,7 @@ const users = await prisma.user.updateManyAndReturn({
### Update _or_ create records
-The following query uses [`upsert()`](/v6/orm/reference/prisma-client-reference#upsert) to update a `User` record with a specific email address, or create that `User` record if it does not exist:
+The following query uses [`upsert()`](/orm/v6/reference/prisma-client-reference#upsert) to update a `User` record with a specific email address, or create that `User` record if it does not exist:
```ts
const upsertUser = await prisma.user.upsert({
@@ -694,7 +685,7 @@ const upsertUser = await prisma.user.upsert({
:::info
-From version 4.6.0, Prisma Client carries out upserts with database native SQL commands where possible. [Learn more](/v6/orm/reference/prisma-client-reference#database-upserts).
+From version 4.6.0, Prisma Client carries out upserts with database native SQL commands where possible. [Learn more](/orm/v6/reference/prisma-client-reference#database-upserts).
:::
@@ -708,7 +699,7 @@ A limitation to using `upsert()` as a workaround for `findOrCreate()` is that `u
### Update a number field
-Use [atomic number operations](/v6/orm/reference/prisma-client-reference#atomic-number-operations) to update a number field **based on its current value** - for example, increment or multiply. The following query increments the `views` and `likes` fields by `1`:
+Use [atomic number operations](/orm/v6/reference/prisma-client-reference#atomic-number-operations) to update a number field **based on its current value** - for example, increment or multiply. The following query increments the `views` and `likes` fields by `1`:
```ts
const updatePosts = await prisma.post.updateMany({
@@ -725,13 +716,13 @@ const updatePosts = await prisma.post.updateMany({
### Connect and disconnect related records
-Refer to [Working with relations](/v6/orm/prisma-client/queries/relation-queries) for information about disconnecting ([`disconnect`](/v6/orm/reference/prisma-client-reference#disconnect)) and connecting ([`connect`](/v6/orm/reference/prisma-client-reference#connect)) related records.
+Refer to [Working with relations](/orm/v6/prisma-client/queries/relation-queries) for information about disconnecting ([`disconnect`](/orm/v6/reference/prisma-client-reference#disconnect)) and connecting ([`connect`](/orm/v6/reference/prisma-client-reference#connect)) related records.
## Delete
### Delete a single record
-The following query uses [`delete()`](/v6/orm/reference/prisma-client-reference#delete) to delete a single `User` record:
+The following query uses [`delete()`](/orm/v6/reference/prisma-client-reference#delete) to delete a single `User` record:
```ts
const deleteUser = await prisma.user.delete({
@@ -745,7 +736,7 @@ Attempting to delete a user with one or more posts result in an error, as every
### Delete multiple records
-The following query uses [`deleteMany()`](/v6/orm/reference/prisma-client-reference#deletemany) to delete all `User` records where `email` contains `prisma.io`:
+The following query uses [`deleteMany()`](/orm/v6/reference/prisma-client-reference#deletemany) to delete all `User` records where `email` contains `prisma.io`:
```ts
const deleteUsers = await prisma.user.deleteMany({
@@ -761,7 +752,7 @@ Attempting to delete a user with one or more posts result in an error, as every
### Delete all records
-The following query uses [`deleteMany()`](/v6/orm/reference/prisma-client-reference#deletemany) to delete all `User` records:
+The following query uses [`deleteMany()`](/orm/v6/reference/prisma-client-reference#deletemany) to delete all `User` records:
```ts
const deleteUsers = await prisma.user.deleteMany({});
@@ -773,11 +764,11 @@ Be aware that this query will fail if the user has any related records (such as
:::warning
-In [2.26.0](https://github.com/prisma/prisma/releases/tag/2.26.0) and later it is possible to do cascading deletes using the **preview feature** [referential actions](/v6/orm/prisma-schema/data-model/relations/referential-actions).
+In [2.26.0](https://github.com/prisma/prisma/releases/tag/2.26.0) and later it is possible to do cascading deletes using the **preview feature** [referential actions](/orm/v6/prisma-schema/data-model/relations/referential-actions).
:::
-The following query uses [`delete()`](/v6/orm/reference/prisma-client-reference#delete) to delete a single `User` record:
+The following query uses [`delete()`](/orm/v6/reference/prisma-client-reference#delete) to delete a single `User` record:
```ts
const deleteUser = await prisma.user.delete({
@@ -835,7 +826,7 @@ The following shows how to delete all records from all tables with Prisma Client
#### Deleting all data with `deleteMany()`
-When you know the order in which your tables should be deleted, you can use the [`deleteMany`](/v6/orm/reference/prisma-client-reference#deletemany) function. This is executed synchronously in a [`$transaction`](/v6/orm/prisma-client/queries/transactions) and can be used with all types of databases.
+When you know the order in which your tables should be deleted, you can use the [`deleteMany`](/orm/v6/reference/prisma-client-reference#deletemany) function. This is executed synchronously in a [`$transaction`](/orm/v6/prisma-client/queries/transactions) and can be used with all types of databases.
```ts
const deletePosts = prisma.post.deleteMany();
@@ -859,7 +850,7 @@ await prisma.$transaction([deleteProfile, deletePosts, deleteUsers]);
#### Deleting all data with raw SQL / `TRUNCATE`
-If you are comfortable working with raw SQL, you can perform a `TRUNCATE` query on a table using [`$executeRawUnsafe`](/v6/orm/prisma-client/using-raw-sql/raw-queries#executerawunsafe).
+If you are comfortable working with raw SQL, you can perform a `TRUNCATE` query on a table using [`$executeRawUnsafe`](/orm/v6/prisma-client/using-raw-sql/raw-queries#executerawunsafe).
In the following examples, the first tab shows how to perform a `TRUNCATE` on a Postgres database by using a `$queryRaw` look up that maps over the table and `TRUNCATES` all tables in a single query.
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/custom-models.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/custom-models.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/custom-models.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/custom-models.mdx
index a7d237dffd..4e53b84b4e 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/custom-models.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/custom-models.mdx
@@ -1,14 +1,14 @@
---
title: Custom models
description: This page explains how to wrap Prisma Client in custom models
-url: /v6/orm/prisma-client/queries/custom-models
+url: /orm/v6/prisma-client/queries/custom-models
metaTitle: Custom models
metaDescription: This page explains how to wrap Prisma Client in custom models
---
As your application grows, you may find the need to group related logic together. We suggest either:
-- Creating static methods using a [Prisma Client extension](/v6/orm/prisma-client/client-extensions)
+- Creating static methods using a [Prisma Client extension](/orm/v6/prisma-client/client-extensions)
- Wrapping a model in a class
- Extending Prisma Client model object
@@ -159,4 +159,4 @@ Now you can use your custom `signup` method alongside `count`, `updateMany`, `gr
## Going further
-We recommend using [Prisma Client extensions](/v6/orm/prisma-client/client-extensions) to extend your models with [custom model methods](https://github.com/prisma/prisma-client-extensions/tree/main/instance-methods).
+We recommend using [Prisma Client extensions](/orm/v6/prisma-client/client-extensions) to extend your models with [custom model methods](https://github.com/prisma/prisma-client-extensions/tree/main/instance-methods).
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/custom-validation.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/custom-validation.mdx
similarity index 94%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/custom-validation.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/custom-validation.mdx
index 1414254c41..ad92476c36 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/custom-validation.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/custom-validation.mdx
@@ -1,14 +1,14 @@
---
title: Custom validation
description: This page explains how to add custom validation to Prisma Client
-url: /v6/orm/prisma-client/queries/custom-validation
+url: /orm/v6/prisma-client/queries/custom-validation
metaTitle: Custom validation
metaDescription: This page explains how to add custom validation to Prisma Client
---
You can add runtime validation for your user input for Prisma Client queries in one of the following ways:
-- [Prisma Client extensions](/v6/orm/prisma-client/client-extensions)
+- [Prisma Client extensions](/orm/v6/prisma-client/client-extensions)
- A custom function
You can use any validation library you'd like. The Node.js ecosystem offers a number of high-quality, easy-to-use validation libraries to choose from including: [joi](https://github.com/sideway/joi), [validator.js](https://github.com/validatorjs/validator.js), [Yup](https://github.com/jquense/yup), [Zod](https://github.com/colinhacks/zod) and [Superstruct](https://github.com/ianstormtaylor/superstruct).
@@ -19,7 +19,7 @@ This example adds runtime validation when creating and updating values using a Z
:::warning
-Query extensions do not currently work for nested operations. In this example, validations are only run on the top level data object passed to methods such as `prisma.product.create()`. Validations implemented this way do not automatically run for [nested writes](/v6/orm/prisma-client/queries/relation-queries#nested-writes).
+Query extensions do not currently work for nested operations. In this example, validations are only run on the top level data object passed to methods such as `prisma.product.create()`. Validations implemented this way do not automatically run for [nested writes](/orm/v6/prisma-client/queries/relation-queries#nested-writes).
:::
@@ -171,6 +171,6 @@ The example above shows how you can create a custom type-safe `signup` function
## Going further
-- Learn how you can use [Prisma Client extensions](/v6/orm/prisma-client/client-extensions) to add input validation for your queries — [example](https://github.com/prisma/prisma-client-extensions/tree/main/input-validation).
-- Learn how you can organize your code better by moving the `signup` function into [a custom model](/v6/orm/prisma-client/queries/custom-models).
+- Learn how you can use [Prisma Client extensions](/orm/v6/prisma-client/client-extensions) to add input validation for your queries — [example](https://github.com/prisma/prisma-client-extensions/tree/main/input-validation).
+- Learn how you can organize your code better by moving the `signup` function into [a custom model](/orm/v6/prisma-client/queries/custom-models).
- There's an [outstanding feature request](https://github.com/prisma/prisma/issues/3528) to bake user validation into Prisma Client. If you'd like to see that happen, make sure to upvote that issue and share your use case!
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/excluding-fields.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/excluding-fields.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/excluding-fields.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/excluding-fields.mdx
index 74689c0ca3..0f28e5dc08 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/excluding-fields.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/excluding-fields.mdx
@@ -1,12 +1,12 @@
---
title: Excluding fields
description: This page explains how to exclude sensitive fields from Prisma Client
-url: /v6/orm/prisma-client/queries/excluding-fields
+url: /orm/v6/prisma-client/queries/excluding-fields
metaTitle: Excluding fields
metaDescription: This page explains how to exclude sensitive fields from Prisma Client
---
-By default Prisma Client returns all fields from a model. You can use [`select`](/v6/orm/prisma-client/queries/select-fields) to narrow the result set, but that can be unwieldy if you have a large model and you only want to exclude a small number of fields.
+By default Prisma Client returns all fields from a model. You can use [`select`](/orm/v6/prisma-client/queries/select-fields) to narrow the result set, but that can be unwieldy if you have a large model and you only want to exclude a small number of fields.
:::info
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/filtering-and-sorting.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/filtering-and-sorting.mdx
similarity index 92%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/filtering-and-sorting.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/filtering-and-sorting.mdx
index 9fa572ae18..83e495f2b5 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/filtering-and-sorting.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/filtering-and-sorting.mdx
@@ -1,7 +1,7 @@
---
title: Filtering and Sorting
description: 'Use Prisma Client API to filter records by any combination of fields or related record fields, and/or sort query results.'
-url: /v6/orm/prisma-client/queries/filtering-and-sorting
+url: /orm/v6/prisma-client/queries/filtering-and-sorting
metaTitle: Filtering and Sorting
metaDescription: 'Use Prisma Client API to filter records by any combination of fields or related record fields, and/or sort query results.'
---
@@ -75,11 +75,11 @@ const result = await prisma.user.findMany({
### Filter conditions and operators
-Refer to Prisma Client's reference documentation for [a full list of operators](/v6/orm/reference/prisma-client-reference#filter-conditions-and-operators) , such as `startsWith` and `contains`.
+Refer to Prisma Client's reference documentation for [a full list of operators](/orm/v6/reference/prisma-client-reference#filter-conditions-and-operators) , such as `startsWith` and `contains`.
#### Combining operators
-You can use operators (such as [`NOT`](/v6/orm/reference/prisma-client-reference#not-1) and [`OR`](/v6/orm/reference/prisma-client-reference#or) ) to filter by a combination of conditions. The following query returns all users whose `email` ends with `gmail.com` or `company.com`, but excludes any emails ending with `admin.company.com`
+You can use operators (such as [`NOT`](/orm/v6/reference/prisma-client-reference#not-1) and [`OR`](/orm/v6/reference/prisma-client-reference#or) ) to filter by a combination of conditions. The following query returns all users whose `email` ends with `gmail.com` or `company.com`, but excludes any emails ending with `admin.company.com`
```ts
const result = await prisma.user.findMany({
@@ -134,7 +134,7 @@ const posts = await prisma.post.findMany({
### Filter on relations
-Prisma Client supports [filtering on related records](/v6/orm/prisma-client/queries/relation-queries#relation-filters). For example, in the following schema, a user can have many blog posts:
+Prisma Client supports [filtering on related records](/orm/v6/prisma-client/queries/relation-queries#relation-filters). For example, in the following schema, a user can have many blog posts:
```prisma highlight=5,12-13;normal
model User {
@@ -185,7 +185,7 @@ const res = await prisma.post.findMany({
### Filter on scalar lists / arrays
-Scalar lists (for example, `String[]`) have a special set of [filter conditions](/v6/orm/reference/prisma-client-reference#scalar-list-filters) - for example, the following query returns all posts where the `tags` array contains `databases`:
+Scalar lists (for example, `String[]`) have a special set of [filter conditions](/orm/v6/reference/prisma-client-reference#scalar-list-filters) - for example, the following query returns all posts where the `tags` array contains `databases`:
```ts
const posts = await client.post.findMany({
@@ -199,7 +199,7 @@ const posts = await client.post.findMany({
### Case-insensitive filtering
-Case-insensitive filtering [is available as a feature for the PostgreSQL and MongoDB providers](/v6/orm/prisma-client/queries/case-sensitivity#options-for-case-insensitive-filtering). MySQL, MariaDB and Microsoft SQL Server are case-insensitive by default, and do not require a Prisma Client feature to make case-insensitive filtering possible.
+Case-insensitive filtering [is available as a feature for the PostgreSQL and MongoDB providers](/orm/v6/prisma-client/queries/case-sensitivity#options-for-case-insensitive-filtering). MySQL, MariaDB and Microsoft SQL Server are case-insensitive by default, and do not require a Prisma Client feature to make case-insensitive filtering possible.
To use case-insensitive filtering, add the `mode` property to a particular filter and specify `insensitive`:
@@ -217,7 +217,7 @@ const users = await prisma.user.findMany({
});
```
-See also: [Case sensitivity](/v6/orm/prisma-client/queries/case-sensitivity)
+See also: [Case sensitivity](/orm/v6/prisma-client/queries/case-sensitivity)
### Filtering FAQs
@@ -251,7 +251,7 @@ const users = await prisma.user.findMany({
## Sorting
-Use [`orderBy`](/v6/orm/reference/prisma-client-reference#orderby) to sort a list of records or a nested list of records by a particular field or set of fields. For example, the following query returns all `User` records sorted by `role` and `name`, **and** each user's posts sorted by `title`:
+Use [`orderBy`](/orm/v6/reference/prisma-client-reference#orderby) to sort a list of records or a nested list of records by a particular field or set of fields. For example, the following query returns all `User` records sorted by `role` and `name`, **and** each user's posts sorted by `title`:
```ts
const usersWithPosts = await prisma.user.findMany({
@@ -312,7 +312,7 @@ const usersWithPosts = await prisma.user.findMany({
]
```
-> **Note**: You can also [sort lists of nested records](/v6/orm/prisma-client/queries/relation-queries#filter-a-list-of-relations)
+> **Note**: You can also [sort lists of nested records](/orm/v6/prisma-client/queries/relation-queries#filter-a-list-of-relations)
> to retrieve a single record by ID.
### Sort by relation
@@ -354,7 +354,7 @@ In [3.5.0+](https://github.com/prisma/prisma/releases/3.5.0) for PostgreSQL and
This feature is further explain in [the PostgreSQL documentation](https://www.postgresql.org/docs/12/textsearch-controls.html) and [the MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/fulltext-search.html).
-**For PostgreSQL**, you need to enable order by relevance with the `fullTextSearchPostgres` [preview feature](/v6/orm/prisma-client/queries/full-text-search):
+**For PostgreSQL**, you need to enable order by relevance with the `fullTextSearchPostgres` [preview feature](/orm/v6/prisma-client/queries/full-text-search):
```prisma
generator client {
@@ -395,9 +395,9 @@ Prior to Prisma ORM 5.16.0, enabling the `fullTextSearch` preview feature would
Notes:
-- This feature is generally available in version `4.16.0` and later. To use this feature in versions [`4.1.0`](https://github.com/prisma/prisma/releases/tag/4.1.0) to [`4.15.0`](https://github.com/prisma/prisma/releases/tag/4.15.0) the [Preview feature](/v6/orm/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature) `orderByNulls` will need to be enabled.
+- This feature is generally available in version `4.16.0` and later. To use this feature in versions [`4.1.0`](https://github.com/prisma/prisma/releases/tag/4.1.0) to [`4.15.0`](https://github.com/prisma/prisma/releases/tag/4.15.0) the [Preview feature](/orm/v6/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature) `orderByNulls` will need to be enabled.
- This feature is not available for MongoDB.
-- You can only sort by nulls on optional [scalar](/v6/orm/prisma-schema/data-model/models#scalar-fields) fields. If you try to sort by nulls on a required or [relation](/v6/orm/prisma-schema/data-model/models#relation-fields) field, Prisma Client throws a [P2009 error](/v6/orm/reference/error-reference#p2009).
+- You can only sort by nulls on optional [scalar](/orm/v6/prisma-schema/data-model/models#scalar-fields) fields. If you try to sort by nulls on a required or [relation](/orm/v6/prisma-schema/data-model/models#relation-fields) field, Prisma Client throws a [P2009 error](/orm/v6/reference/error-reference#p2009).
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/full-text-search.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/full-text-search.mdx
similarity index 96%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/full-text-search.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/full-text-search.mdx
index 9ce6af4c2d..f88d153e13 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/full-text-search.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/full-text-search.mdx
@@ -2,7 +2,7 @@
title: Full-text search
description: This page explains how to search for text within a field.
badge: preview
-url: /v6/orm/prisma-client/queries/full-text-search
+url: /orm/v6/prisma-client/queries/full-text-search
metaTitle: Full-text search
metaDescription: This page explains how to search for text within a field.
---
@@ -19,7 +19,7 @@ In Prisma v6, FTS has been promoted to General Availability on MySQL. It still r
The full-text search API is currently a Preview feature. To enable this feature, carry out the following steps:
-1. Update the [`previewFeatures`](/v6/orm/reference/preview-features) block in your schema to include the `fullTextSearchPostgres` preview feature flag:
+1. Update the [`previewFeatures`](/orm/v6/reference/preview-features) block in your schema to include the `fullTextSearchPostgres` preview feature flag:
```prisma title="schema.prisma" showLineNumbers
generator client {
@@ -173,7 +173,7 @@ Sorting by relevance is only available for PostgreSQL and MySQL.
:::
-In addition to [Prisma Client's default `orderBy` behavior](/v6/orm/reference/prisma-client-reference#orderby), full-text search also adds sorting by relevance to a given string or strings. As an example, if you wanted to order posts by their relevance to the term `'database'` in their title, you could use the following:
+In addition to [Prisma Client's default `orderBy` behavior](/orm/v6/reference/prisma-client-reference#orderby), full-text search also adds sorting by relevance to a given string or strings. As an example, if you wanted to order posts by their relevance to the term `'database'` in their title, you could use the following:
```ts
const posts = await prisma.post.findMany({
@@ -246,11 +246,11 @@ However, if you try to search on `title` alone, the search will fail with the er
## Full-text search with raw SQL
-Full-text search is currently in Preview, and due to a [known issue](https://github.com/prisma/prisma/issues/23627), you might experience slow search queries. If so, you can optimize your query using [TypedSQL](/v6/orm/prisma-client/using-raw-sql).
+Full-text search is currently in Preview, and due to a [known issue](https://github.com/prisma/prisma/issues/23627), you might experience slow search queries. If so, you can optimize your query using [TypedSQL](/orm/v6/prisma-client/using-raw-sql).
### PostgreSQL
-With [TypedSQL](/v6/orm/prisma-client/using-raw-sql), you can use PostgreSQL's `to_tsvector` and `to_tsquery` to express your search query.
+With [TypedSQL](/orm/v6/prisma-client/using-raw-sql), you can use PostgreSQL's `to_tsvector` and `to_tsquery` to express your search query.
```sql tab="fullTextSearch.sql"
SELECT * FROM "Blog" WHERE to_tsvector('english', "Blog"."content") @@ to_tsquery('english', ${term});
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/queries/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/pagination.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/pagination.mdx
similarity index 99%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/pagination.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/pagination.mdx
index 684d6942be..e91a6decec 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/pagination.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/pagination.mdx
@@ -1,7 +1,7 @@
---
title: Pagination
description: Prisma Client supports both offset pagination and cursor-based pagination. Learn more about the pros and cons of different pagination approaches and how to implement them.
-url: /v6/orm/prisma-client/queries/pagination
+url: /orm/v6/prisma-client/queries/pagination
metaTitle: Pagination
metaDescription: Prisma Client supports both offset pagination and cursor-based pagination. Learn more about the pros and cons of different pagination approaches and how to implement them.
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/query-optimization-performance.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/query-optimization-performance.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/query-optimization-performance.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/query-optimization-performance.mdx
index b95bf726d0..f969198c3d 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/query-optimization-performance.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/query-optimization-performance.mdx
@@ -1,7 +1,7 @@
---
title: Query optimization
description: How to identify and optimize query performance with Prisma
-url: /v6/orm/prisma-client/queries/query-optimization-performance
+url: /orm/v6/prisma-client/queries/query-optimization-performance
metaTitle: Query optimization
metaDescription: How to identify and optimize query performance with Prisma
---
@@ -56,7 +56,7 @@ Use [Query Insights](/query-insights) to identify which queries are affected and
:::tip
-You can also [log query events at the client level](/v6/orm/prisma-client/observability-and-logging/logging#event-based-logging) to view the generated queries, their parameters, and execution times.
+You can also [log query events at the client level](/orm/v6/prisma-client/observability-and-logging/logging#event-based-logging) to view the generated queries, their parameters, and execution times.
:::
@@ -64,16 +64,16 @@ You can also [log query events at the client level](/v6/orm/prisma-client/observ
It is generally more performant to read and write large amounts of data in bulk - for example, inserting `50,000` records in batches of `1000` rather than as `50,000` separate inserts. `PrismaClient` supports the following bulk queries:
-- [`createMany()`](/v6/orm/reference/prisma-client-reference#createmany)
-- [`createManyAndReturn()`](/v6/orm/reference/prisma-client-reference#createmanyandreturn)
-- [`deleteMany()`](/v6/orm/reference/prisma-client-reference#deletemany)
-- [`updateMany()`](/v6/orm/reference/prisma-client-reference#updatemany)
-- [`updateManyAndReturn()`](/v6/orm/reference/prisma-client-reference#updatemanyandreturn)
-- [`findMany()`](/v6/orm/reference/prisma-client-reference#findmany)
+- [`createMany()`](/orm/v6/reference/prisma-client-reference#createmany)
+- [`createManyAndReturn()`](/orm/v6/reference/prisma-client-reference#createmanyandreturn)
+- [`deleteMany()`](/orm/v6/reference/prisma-client-reference#deletemany)
+- [`updateMany()`](/orm/v6/reference/prisma-client-reference#updatemany)
+- [`updateManyAndReturn()`](/orm/v6/reference/prisma-client-reference#updatemanyandreturn)
+- [`findMany()`](/orm/v6/reference/prisma-client-reference#findmany)
## Reuse `PrismaClient` or use connection pooling to avoid database connection pool exhaustion
-Creating multiple instances of `PrismaClient` can exhaust your database connection pool, especially in serverless or edge environments, potentially slowing down other queries. Learn more in the [serverless challenge](/v6/orm/prisma-client/setup-and-configuration/databases-connections#the-serverless-challenge).
+Creating multiple instances of `PrismaClient` can exhaust your database connection pool, especially in serverless or edge environments, potentially slowing down other queries. Learn more in the [serverless challenge](/orm/v6/prisma-client/setup-and-configuration/databases-connections#the-serverless-challenge).
For applications with a traditional server, instantiate `PrismaClient` once and reuse it throughout your app instead of creating multiple instances. For example, instead of:
@@ -109,7 +109,7 @@ async function getUsers() {
}
```
-For serverless development environments with frameworks that use HMR (Hot Module Replacement), ensure you properly handle a [single instance of Prisma in development](/v6/orm/more/troubleshooting/nextjs#best-practices-for-using-prisma-client-in-development).
+For serverless development environments with frameworks that use HMR (Hot Module Replacement), ensure you properly handle a [single instance of Prisma in development](/orm/v6/more/troubleshooting/nextjs#best-practices-for-using-prisma-client-in-development).
## Solving the n+1 problem
@@ -117,18 +117,7 @@ The n+1 problem occurs when you loop through the results of a query and perform
### Solving n+1 in GraphQL with `findUnique()` and Prisma Client's dataloader
-
-
-
-
-
+
The Prisma Client dataloader automatically _batches_ `findUnique()` queries that occur in the same [tick](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick#processnexttick) and have the same `where` and `include` parameters if:
@@ -241,7 +230,7 @@ const User = objectType({
#### Solution 1: Batching queries with the fluent API
-Use `findUnique()` in combination with [the fluent API](/v6/orm/prisma-client/queries/relation-queries#fluent-api) (`.posts()`) as shown to return a user's posts. Even though the resolver is called once per user, the Prisma dataloader in Prisma Client **✔ batches the `findUnique()` queries**.
+Use `findUnique()` in combination with [the fluent API](/orm/v6/prisma-client/queries/relation-queries#fluent-api) (`.posts()`) as shown to return a user's posts. Even though the resolver is called once per user, the Prisma dataloader in Prisma Client **✔ batches the `findUnique()` queries**.
:::info
@@ -307,7 +296,7 @@ If the `posts` resolver is invoked once per user, the dataloader in Prisma Clien
#### Solution 2: Using JOINs to perform queries
-You can perform the query with a [database join](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) by setting `relationLoadStrategy` to `"join"`, ensuring that only **one** query is executed against the database.
+You can perform the query with a [database join](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) by setting `relationLoadStrategy` to `"join"`, ensuring that only **one** query is executed against the database.
```ts
const User = objectType({
@@ -362,13 +351,13 @@ SELECT "public"."Post"."id", "public"."Post"."title" FROM "public"."Post" WHERE
This is not an efficient way to query. Instead, you can:
-- Use nested reads ([`include`](/v6/orm/reference/prisma-client-reference#include) ) to return users and related posts
-- Use the [`in`](/v6/orm/reference/prisma-client-reference#in) filter
-- Set the [`relationLoadStrategy`](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) to `"join"`
+- Use nested reads ([`include`](/orm/v6/reference/prisma-client-reference#include) ) to return users and related posts
+- Use the [`in`](/orm/v6/reference/prisma-client-reference#in) filter
+- Set the [`relationLoadStrategy`](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) to `"join"`
#### Solving n+1 with `include`
-You can use `include` to return each user's posts. This only results in **two** SQL queries - one to get users, and one to get posts. This is known as a [nested read](/v6/orm/prisma-client/queries/relation-queries#nested-reads).
+You can use `include` to return each user's posts. This only results in **two** SQL queries - one to get users, and one to get posts. This is known as a [nested read](/orm/v6/prisma-client/queries/relation-queries#nested-reads).
```ts
const usersWithPosts = await prisma.user.findMany({
@@ -408,7 +397,7 @@ SELECT "public"."Post"."id", "public"."Post"."createdAt", "public"."Post"."updat
#### Solving n+1 with `relationLoadStrategy: "join"`
-You can perform the query with a [database join](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) by setting `relationLoadStrategy` to `"join"`, ensuring that only **one** query is executed against the database.
+You can perform the query with a [database join](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) by setting `relationLoadStrategy` to `"join"`, ensuring that only **one** query is executed against the database.
```ts
const users = await prisma.user.findMany({});
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/relation-queries.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/relation-queries.mdx
similarity index 93%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/relation-queries.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/relation-queries.mdx
index 1b04f5258b..13f5c500bf 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/relation-queries.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/relation-queries.mdx
@@ -1,15 +1,15 @@
---
title: Relation queries
description: 'Prisma Client provides convenient queries for working with relations, such as a fluent API, nested writes (transactions), nested reads and relation filters.'
-url: /v6/orm/prisma-client/queries/relation-queries
+url: /orm/v6/prisma-client/queries/relation-queries
metaTitle: Relation queries (Concepts)
metaDescription: 'Prisma Client provides convenient queries for working with relations, such as a fluent API, nested writes (transactions), nested reads and relation filters.'
---
-A key feature of Prisma Client is the ability to query [relations](/v6/orm/prisma-schema/data-model/relations) between two or more models. Relation queries include:
+A key feature of Prisma Client is the ability to query [relations](/orm/v6/prisma-schema/data-model/relations) between two or more models. Relation queries include:
-- [Nested reads](#nested-reads) (sometimes referred to as _eager loading_) via [`select`](/v6/orm/reference/prisma-client-reference#select) and [`include`](/v6/orm/reference/prisma-client-reference#include)
-- [Nested writes](#nested-writes) with [transactional](/v6/orm/prisma-client/queries/transactions) guarantees
+- [Nested reads](#nested-reads) (sometimes referred to as _eager loading_) via [`select`](/orm/v6/reference/prisma-client-reference#select) and [`include`](/orm/v6/reference/prisma-client-reference#include)
+- [Nested writes](#nested-writes) with [transactional](/orm/v6/prisma-client/queries/transactions) guarantees
- [Filtering on related records](#relation-filters)
Prisma Client also has a [fluent API for traversing relations](#fluent-api).
@@ -18,8 +18,8 @@ Prisma Client also has a [fluent API for traversing relations](#fluent-api).
Nested reads allow you to read related data from multiple tables in your database - such as a user and that user's posts. You can:
-- Use [`include`](/v6/orm/reference/prisma-client-reference#include) to include related records, such as a user's posts or profile, in the query response.
-- Use a nested [`select`](/v6/orm/reference/prisma-client-reference#select) to include specific fields from a related record. You can also nest `select` inside an `include`.
+- Use [`include`](/orm/v6/reference/prisma-client-reference#include) to include related records, such as a user's posts or profile, in the query response.
+- Use a nested [`select`](/orm/v6/reference/prisma-client-reference#select) to include specific fields from a related record. You can also nest `select` inside an `include`.
### Relation load strategies (Preview)
@@ -46,7 +46,7 @@ Prisma Client supports two load strategies for relations:
Another important difference between these two options is that the `join` strategy uses JSON aggregation on the database level. That means that it creates the JSON structures returned by Prisma Client already in the database which saves computation resources on the application level.
-> **Note**: Once `relationLoadStrategy` moves from [Preview](/v6/orm/more/releases#preview) into [General Availability](/v6/orm/more/releases#generally-available-ga), `join` will universally become the default for all relation queries.
+> **Note**: Once `relationLoadStrategy` moves from [Preview](/orm/v6/more/releases#preview) into [General Availability](/orm/v6/more/releases#generally-available-ga), `join` will universally become the default for all relation queries.
#### Examples
@@ -326,7 +326,7 @@ const user = await prisma.user.findFirst({
## Relation count
-In [3.0.1](https://github.com/prisma/prisma/releases/3.0.1) and later, you can [`include` or `select` a count of relations](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#count-relations) alongside fields - for example, a user's post count.
+In [3.0.1](https://github.com/prisma/prisma/releases/3.0.1) and later, you can [`include` or `select` a count of relations](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#count-relations) alongside fields - for example, a user's post count.
```ts
const relationCount = await prisma.user.findMany({
@@ -395,7 +395,7 @@ Nested writes:
- Provide **transactional guarantees** for creating, updating or deleting data across multiple tables in a single Prisma Client query. If any part of the query fails (for example, creating a user succeeds but creating posts fails), Prisma Client rolls back all changes.
- Support any level of nesting supported by the data model.
-- Are available for [relation fields](/v6/orm/prisma-schema/data-model/relations#relation-fields) when using the model's create or update query. The following section shows the nested write options that are available per query.
+- Are available for [relation fields](/orm/v6/prisma-schema/data-model/relations#relation-fields) when using the model's create or update query. The following section shows the nested write options that are available per query.
### Create a related record
@@ -452,10 +452,10 @@ const result = await prisma.user.create({
There are two ways to create or update a single record and multiple related records - for example, a user with multiple posts:
-- Use a nested [`create`](/v6/orm/reference/prisma-client-reference#create) query
-- Use a nested [`createMany`](/v6/orm/reference/prisma-client-reference#nested-createmany-options) query
+- Use a nested [`create`](/orm/v6/reference/prisma-client-reference#create) query
+- Use a nested [`createMany`](/orm/v6/reference/prisma-client-reference#nested-createmany-options) query
-In most cases, a nested `create` will be preferable unless the [`skipDuplicates` query option](/v6/orm/reference/prisma-client-reference#nested-createmany-options) is required. Here's a quick table describing the differences between the two options:
+In most cases, a nested `create` will be preferable unless the [`skipDuplicates` query option](/orm/v6/reference/prisma-client-reference#nested-createmany-options) is required. Here's a quick table describing the differences between the two options:
| Feature | `create` | `createMany` | Notes |
| :------------------------------------ | :------- | :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -466,7 +466,7 @@ In most cases, a nested `create` will be preferable unless the [`skipDuplicates`
#### Using nested `create`
-The following query uses nested [`create`](/v6/orm/reference/prisma-client-reference#create) to create:
+The following query uses nested [`create`](/orm/v6/reference/prisma-client-reference#create) to create:
- One user
- Two posts
@@ -556,7 +556,7 @@ Here's a visual representation of how a nested create operation can write to sev
#### Using nested `createMany`
-The following query uses a nested [`createMany`](/v6/orm/reference/prisma-client-reference#createmany) to create:
+The following query uses a nested [`createMany`](/orm/v6/reference/prisma-client-reference#createmany) to create:
- One user
- Two posts
@@ -645,7 +645,7 @@ const posts = await prisma.post.createManyAndReturn({
});
```
-If you want to create _all_ records in a single database query, consider using a [`$transaction`](/v6/orm/prisma-client/queries/transactions#the-transaction-api) or [type-safe, raw SQL](/v6/orm/prisma-client/using-raw-sql/typedsql).
+If you want to create _all_ records in a single database query, consider using a [`$transaction`](/orm/v6/prisma-client/queries/transactions#the-transaction-api) or [type-safe, raw SQL](/orm/v6/prisma-client/using-raw-sql/typedsql).
### Create multiple records and multiple related records
@@ -676,7 +676,7 @@ const createMany = await prisma.user.createMany({
### Connect multiple records
-The following query creates ([`create`](/v6/orm/reference/prisma-client-reference#create) ) a new `User` record and connects that record ([`connect`](/v6/orm/reference/prisma-client-reference#connect) ) to three existing posts:
+The following query creates ([`create`](/orm/v6/reference/prisma-client-reference#create) ) a new `User` record and connects that record ([`connect`](/orm/v6/reference/prisma-client-reference#connect) ) to three existing posts:
```ts highlight=4-6;normal
const result = await prisma.user.create({
@@ -719,7 +719,7 @@ const result = await prisma.user.create({
### Connect a single record
-You can [`connect`](/v6/orm/reference/prisma-client-reference#connect) an existing record to a new or existing user. The following query connects an existing post (`id: 11`) to an existing user (`id: 9`)
+You can [`connect`](/orm/v6/reference/prisma-client-reference#connect) an existing record to a new or existing user. The following query connects an existing post (`id: 11`) to an existing user (`id: 9`)
```ts highlight=6-9;normal
const result = await prisma.user.update({
@@ -743,7 +743,7 @@ const result = await prisma.user.update({
### Connect _or_ create a record
-If a related record may or may not already exist, use [`connectOrCreate`](/v6/orm/reference/prisma-client-reference#connectorcreate) to connect the related record:
+If a related record may or may not already exist, use [`connectOrCreate`](/orm/v6/reference/prisma-client-reference#connectorcreate) to connect the related record:
- Connect a `User` with the email address `viola@prisma.io` _or_
- Create a new `User` with the email address `viola@prisma.io` if the user does not already exist
@@ -860,7 +860,7 @@ const result = await prisma.post.update({
### Disconnect all related records
-To [`disconnect`](/v6/orm/reference/prisma-client-reference#disconnect) _all_ related records in a one-to-many relation (a user has many posts), `set` the relation to an empty list as shown:
+To [`disconnect`](/orm/v6/reference/prisma-client-reference#disconnect) _all_ related records in a one-to-many relation (a user has many posts), `set` the relation to an empty list as shown:
```ts highlight=6-8;normal
const result = await prisma.user.update({
@@ -1076,7 +1076,7 @@ const result = await prisma.user.update({
### Filter on "-to-many" relations
-Prisma Client provides the [`some`](/v6/orm/reference/prisma-client-reference#some), [`every`](/v6/orm/reference/prisma-client-reference#every), and [`none`](/v6/orm/reference/prisma-client-reference#none) options to filter records by the properties of related records on the "-to-many" side of the relation. For example, filtering users based on properties of their posts.
+Prisma Client provides the [`some`](/orm/v6/reference/prisma-client-reference#some), [`every`](/orm/v6/reference/prisma-client-reference#every), and [`none`](/orm/v6/reference/prisma-client-reference#none) options to filter records by the properties of related records on the "-to-many" side of the relation. For example, filtering users based on properties of their posts.
For example:
@@ -1120,7 +1120,7 @@ const users = await prisma.user.findMany({
### Filter on "-to-one" relations
-Prisma Client provides the [`is`](/v6/orm/reference/prisma-client-reference#is) and [`isNot`](/v6/orm/reference/prisma-client-reference#isnot) options to filter records by the properties of related records on the "-to-one" side of the relation. For example, filtering posts based on properties of their author.
+Prisma Client provides the [`is`](/orm/v6/reference/prisma-client-reference#is) and [`isNot`](/orm/v6/reference/prisma-client-reference#isnot) options to filter records by the properties of related records on the "-to-one" side of the relation. For example, filtering posts based on properties of their author.
For example, the following query returns `Post` records that meet the following criteria:
@@ -1204,7 +1204,7 @@ const usersWithSomePosts = await prisma.user.findMany({
## Fluent API
-The fluent API lets you _fluently_ traverse the [relations](/v6/orm/prisma-schema/data-model/relations) of your models via function calls. Note that the _last_ function call determines the return type of the entire query (the respective type annotations are added in the code snippets below to make that explicit).
+The fluent API lets you _fluently_ traverse the [relations](/orm/v6/prisma-schema/data-model/relations) of your models via function calls. Note that the _last_ function call determines the return type of the entire query (the respective type annotations are added in the code snippets below to make that explicit).
This query returns all `Post` records by a specific `User`:
@@ -1228,7 +1228,7 @@ const postsByUser = await prisma.post.findMany({
The main difference between the queries is that the fluent API call is translated into two separate database queries while the other one only generates a single query (see this [GitHub issue](https://github.com/prisma/prisma/issues/1984))
-> **Note**: You can use the fact that `.findUnique({ where: { email: 'alice@prisma.io' } }).posts()` queries are automatically batched by the Prisma dataloader in Prisma Client to [avoid the n+1 problem in GraphQL resolvers](/v6/orm/prisma-client/queries/query-optimization-performance#solving-n1-in-graphql-with-findunique-and-prisma-clients-dataloader).
+> **Note**: You can use the fact that `.findUnique({ where: { email: 'alice@prisma.io' } }).posts()` queries are automatically batched by the Prisma dataloader in Prisma Client to [avoid the n+1 problem in GraphQL resolvers](/orm/v6/prisma-client/queries/query-optimization-performance#solving-n1-in-graphql-with-findunique-and-prisma-clients-dataloader).
This request returns all categories by a specific post:
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/select-fields.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/select-fields.mdx
similarity index 86%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/select-fields.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/select-fields.mdx
index 8faf60f35d..5e1d7f51ae 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/select-fields.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/select-fields.mdx
@@ -1,7 +1,7 @@
---
title: Select fields
description: This page explains how to select only a subset of a model's fields and/or include relations ("eager loading") in a Prisma Client query.
-url: /v6/orm/prisma-client/queries/select-fields
+url: /orm/v6/prisma-client/queries/select-fields
metaTitle: Select fields
metaDescription: This page explains how to select only a subset of a model's fields and/or include relations ("eager loading") in a Prisma Client query.
---
@@ -55,15 +55,15 @@ const users = await prisma.user.findFirst();
If you want to customize the result and have a different combination of fields returned, you can:
-- Use [`select`](/v6/orm/reference/prisma-client-reference#select) to return specific fields. You can also use a [nested `select`](/v6/orm/prisma-client/queries/relation-queries#select-specific-fields-of-included-relations) by selecting relation fields.
-- Use [`omit`](/v6/orm/reference/prisma-client-reference#omit) to exclude specific fields from the result. `omit` can be seen as the "opposite" to `select`.
-- Use [`include`](/v6/orm/reference/prisma-client-reference#include) to additionally [include relations](/v6/orm/prisma-client/queries/relation-queries#nested-reads).
+- Use [`select`](/orm/v6/reference/prisma-client-reference#select) to return specific fields. You can also use a [nested `select`](/orm/v6/prisma-client/queries/relation-queries#select-specific-fields-of-included-relations) by selecting relation fields.
+- Use [`omit`](/orm/v6/reference/prisma-client-reference#omit) to exclude specific fields from the result. `omit` can be seen as the "opposite" to `select`.
+- Use [`include`](/orm/v6/reference/prisma-client-reference#include) to additionally [include relations](/orm/v6/prisma-client/queries/relation-queries#nested-reads).
In all cases, the query result will be statically typed, ensuring that you don't accidentally access any fields that you did not actually query from the database.
Selecting only the fields and relations that you require rather than relying on the default selection set can reduce the size of the response and improve query speed.
-Since version [5.9.0](https://github.com/prisma/prisma/releases/tag/5.9.0), when doing a relation query with `include` or by using `select` on a relation field, you can also specify the `relationLoadStrategy` to decide whether you want to use a database-level join or perform multiple queries and merge the data on the application level. This feature is currently in [Preview](/v6/orm/more/releases#preview), you can learn more about it [here](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview).
+Since version [5.9.0](https://github.com/prisma/prisma/releases/tag/5.9.0), when doing a relation query with `include` or by using `select` on a relation field, you can also specify the `relationLoadStrategy` to decide whether you want to use a database-level join or perform multiple queries and merge the data on the application level. This feature is currently in [Preview](/orm/v6/more/releases#preview), you can learn more about it [here](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview).
## Example schema
@@ -143,7 +143,7 @@ const user = await prisma.user.findFirst({
## Return nested objects by selecting relation fields
-You can also return relations by nesting `select` multiple times on [relation fields](/v6/orm/prisma-schema/data-model/relations#relation-fields).
+You can also return relations by nesting `select` multiple times on [relation fields](/orm/v6/prisma-schema/data-model/relations#relation-fields).
The following query uses a nested `select` to select each user's `name` and the `title` of each related post:
@@ -232,14 +232,14 @@ const postsWithAuthorsAndProfiles = await prisma.post.findFirst({
:::note
-Be careful when deeply nesting relations because the underlying database query may become slow due to it needing to access a lot of different tables. To ensure your queries always have optimal speed, consider adding a caching layer with [Prisma Accelerate](/v6/accelerate) or use [Query Insights](/postgres/database/query-insights) to identify slow queries and optimize performance.
+Be careful when deeply nesting relations because the underlying database query may become slow due to it needing to access a lot of different tables. To ensure your queries always have optimal speed, consider adding a caching layer with [Prisma Accelerate](/accelerate) or use [Query Insights](/postgres/database/query-insights) to identify slow queries and optimize performance.
:::
For more information about querying relations, refer to the following documentation:
-- [Include a relation (including all fields)](/v6/orm/prisma-client/queries/relation-queries#include-all-fields-for-a-specific-relation)
-- [Select specific relation fields](/v6/orm/prisma-client/queries/relation-queries#select-specific-fields-of-included-relations)
+- [Include a relation (including all fields)](/orm/v6/prisma-client/queries/relation-queries#include-all-fields-for-a-specific-relation)
+- [Select specific relation fields](/orm/v6/prisma-client/queries/relation-queries#select-specific-fields-of-included-relations)
## Omit specific fields
@@ -270,4 +270,4 @@ Notice how the returned object does _not_ contain the `password` field.
## Relation count
-In [3.0.1](https://github.com/prisma/prisma/releases/3.0.1) and later, you can `include` or `select` a [count of relations](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#count-relations) alongside fields. For example, a user's post count.
+In [3.0.1](https://github.com/prisma/prisma/releases/3.0.1) and later, you can `include` or `select` a [count of relations](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#count-relations) alongside fields. For example, a user's post count.
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/queries/transactions.mdx b/apps/docs/content/docs/orm/v6/prisma-client/queries/transactions.mdx
similarity index 99%
rename from apps/docs/content/docs.v6/orm/prisma-client/queries/transactions.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/queries/transactions.mdx
index 39281ad933..616d9de8c9 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/queries/transactions.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/queries/transactions.mdx
@@ -1,7 +1,7 @@
---
title: Transactions and batch queries
description: This page explains the transactions API of Prisma Client.
-url: /v6/orm/prisma-client/queries/transactions
+url: /orm/v6/prisma-client/queries/transactions
metaTitle: Transactions and batch queries (Reference)
metaDescription: This page explains the transactions API of Prisma Client.
---
@@ -51,7 +51,7 @@ Prisma Client provides the following options for using transactions:
## Nested writes
-A [nested write](/v6/orm/prisma-client/queries/relation-queries#nested-writes) lets you perform a single Prisma Client API call with multiple _operations_ that touch multiple [_related_](/v6/orm/prisma-schema/data-model/relations) records. For example, creating a _user_ together with a _post_ or updating an _order_ together with an _invoice_. Prisma Client ensures that all operations succeed or fail as a whole.
+A [nested write](/orm/v6/prisma-client/queries/relation-queries#nested-writes) lets you perform a single Prisma Client API call with multiple _operations_ that touch multiple [_related_](/orm/v6/prisma-schema/data-model/relations) records. For example, creating a _user_ together with a _post_ or updating an _order_ together with an _invoice_. Prisma Client ensures that all operations succeed or fail as a whole.
The following example demonstrates a nested write with `create`:
@@ -426,7 +426,7 @@ To avoid transaction write conflicts and deadlocks on a transaction:
1. On your transaction, use the `isolationLevel` parameter to `Prisma.TransactionIsolationLevel.Serializable`.
- This ensures that your application commits multiple concurrent or parallel transactions as if they were run serially. When a transaction fails due to a write conflict or deadlock, Prisma Client returns a [P2034 error](/v6/orm/reference/error-reference#p2034).
+ This ensures that your application commits multiple concurrent or parallel transactions as if they were run serially. When a transaction fails due to a write conflict or deadlock, Prisma Client returns a [P2034 error](/orm/v6/reference/error-reference#p2034).
2. In your application code, add a retry around your transaction to handle any P2034 errors, as shown in this example:
@@ -599,7 +599,7 @@ However, this code has a problem - consider the following scenario:
Creating a team and adding a user should be one atomic operation that **succeeds or fails as a whole**.
-To implement atomic writes in a low-level database clients, you must wrap your inserts in `BEGIN`, `COMMIT` and `ROLLBACK` statements. Prisma Client solves the problem with [nested writes](/v6/orm/prisma-client/queries/relation-queries#nested-writes). The following query creates a team, creates a user, and connects the records in a single transaction:
+To implement atomic writes in a low-level database clients, you must wrap your inserts in `BEGIN`, `COMMIT` and `ROLLBACK` statements. Prisma Client solves the problem with [nested writes](/orm/v6/prisma-client/queries/relation-queries#nested-writes). The following query creates a team, creates a user, and connects the records in a single transaction:
```ts
const team = await prisma.team.create({
@@ -1142,7 +1142,7 @@ This section describes how to build your own optimistic concurrency control. See
- If you use version 4.4.0 or earlier, you cannot use optimistic concurrency control on `update` operations, because you cannot filter on non-unique fields. The `version` field you need to use with optimistic concurrency control is a non-unique field.
-- Since version 5.0.0 you are able to [filter on non-unique fields in `update` operations](/v6/orm/reference/prisma-client-reference#filter-on-non-unique-fields-with-userwhereuniqueinput) so that optimistic concurrency control is being used. The feature was also available via the Preview flag `extendedWhereUnique` from versions 4.5.0 to 4.16.2.
+- Since version 5.0.0 you are able to [filter on non-unique fields in `update` operations](/orm/v6/reference/prisma-client-reference#filter-on-non-unique-fields-with-userwhereuniqueinput) so that optimistic concurrency control is being used. The feature was also available via the Preview flag `extendedWhereUnique` from versions 4.5.0 to 4.16.2.
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/custom-model-and-field-names.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/custom-model-and-field-names.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/custom-model-and-field-names.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/custom-model-and-field-names.mdx
index fda756233e..ceb1e70fda 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/custom-model-and-field-names.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/custom-model-and-field-names.mdx
@@ -1,14 +1,14 @@
---
title: Custom model and field names
description: Learn how you can decouple the naming of Prisma models from database tables to improve the ergonomics of the generated Prisma Client API.
-url: /v6/orm/prisma-client/setup-and-configuration/custom-model-and-field-names
+url: /orm/v6/prisma-client/setup-and-configuration/custom-model-and-field-names
metaTitle: Custom model and field names
metaDescription: Learn how you can decouple the naming of Prisma models from database tables to improve the ergonomics of the generated Prisma Client API.
---
-The Prisma Client API is generated based on the models in your [Prisma schema](/v6/orm/prisma-schema/overview). Models are _typically_ 1:1 mappings of your database tables.
+The Prisma Client API is generated based on the models in your [Prisma schema](/orm/v6/prisma-schema/overview). Models are _typically_ 1:1 mappings of your database tables.
-In some cases, especially when using [introspection](/v6/orm/prisma-schema/introspection), it might be useful to _decouple_ the naming of database tables and columns from the names that are used in your Prisma Client API. This can be done via the [`@map` and `@@map`](/v6/orm/prisma-schema/data-model/models#mapping-model-names-to-tables-or-collections) attributes in your Prisma schema.
+In some cases, especially when using [introspection](/orm/v6/prisma-schema/introspection), it might be useful to _decouple_ the naming of database tables and columns from the names that are used in your Prisma Client API. This can be done via the [`@map` and `@@map`](/orm/v6/prisma-schema/data-model/models#mapping-model-names-to-tables-or-collections) attributes in your Prisma schema.
You can use `@map` and `@@map` to rename MongoDB fields and collections respectively. This page uses a relational database example.
@@ -93,7 +93,7 @@ There are a few "issues" with this Prisma schema when the Prisma Client API is g
**Adhering to Prisma ORM's naming conventions**
-Prisma ORM has a [naming convention](/v6/orm/reference/prisma-schema-reference#naming-conventions) of **camelCasing** and using the **singular form** for Prisma models. If these naming conventions are not met, the Prisma schema can become harder to interpret and the generated Prisma Client API will feel less natural. Consider the following, generated model:
+Prisma ORM has a [naming convention](/orm/v6/reference/prisma-schema-reference#naming-conventions) of **camelCasing** and using the **singular form** for Prisma models. If these naming conventions are not met, the Prisma schema can become harder to interpret and the generated Prisma Client API will feel less natural. Consider the following, generated model:
```prisma
model users {
@@ -117,11 +117,11 @@ model User {
}
```
-Because these fields are "Prisma ORM-level" [relation fields](/v6/orm/prisma-schema/data-model/relations#relation-fields) that do not manifest you can manually rename them in your Prisma schema.
+Because these fields are "Prisma ORM-level" [relation fields](/orm/v6/prisma-schema/data-model/relations#relation-fields) that do not manifest you can manually rename them in your Prisma schema.
**Naming of annotated relation fields**
-Foreign keys are represented as a combination of a [annotated relation fields](/v6/orm/prisma-schema/data-model/relations#relation-fields) and its corresponding relation scalar field in the Prisma schema. Here's how all the relations from the SQL schema are currently represented:
+Foreign keys are represented as a combination of a [annotated relation fields](/orm/v6/prisma-schema/data-model/relations#relation-fields) and its corresponding relation scalar field in the Prisma schema. Here's how all the relations from the SQL schema are currently represented:
```prisma
model categories {
@@ -254,7 +254,7 @@ const userByProfile = await prisma.profile
## Renaming relation fields
-Prisma ORM-level [relation fields](/v6/orm/prisma-schema/data-model/relations#relation-fields) (sometimes referred to as "virtual relation fields") only exist in the Prisma schema, but do not actually manifest in the underlying database. You can therefore name these fields whatever you want.
+Prisma ORM-level [relation fields](/orm/v6/prisma-schema/data-model/relations#relation-fields) (sometimes referred to as "virtual relation fields") only exist in the Prisma schema, but do not actually manifest in the underlying database. You can therefore name these fields whatever you want.
Consider the following example of an ambiguous relation in a SQL database:
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/database-polyfills.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/database-polyfills.mdx
similarity index 75%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/database-polyfills.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/database-polyfills.mdx
index 6a5a035425..364fbc63d0 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/database-polyfills.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/database-polyfills.mdx
@@ -1,20 +1,20 @@
---
title: Database polyfills
description: Prisma Client provides features that are not achievable with relational databases. These features are referred to as "polyfills" and explained on this page.
-url: /v6/orm/prisma-client/setup-and-configuration/database-polyfills
+url: /orm/v6/prisma-client/setup-and-configuration/database-polyfills
metaTitle: Database polyfills (Concepts)
metaDescription: Prisma Client provides features that are not achievable with relational databases. These features are referred to as "polyfills" and explained on this page.
---
Prisma Client provides features that are typically either not achievable with particular databases or require extensions. These features are referred to as _polyfills_. For all databases, this includes:
-- Initializing [ID](/v6/orm/prisma-schema/data-model/models#defining-an-id-field) values with `cuid` and `uuid` values
-- Using [`@updatedAt`](/v6/orm/prisma-schema/data-model/models#defining-attributes) to store the time when a record was last updated
+- Initializing [ID](/orm/v6/prisma-schema/data-model/models#defining-an-id-field) values with `cuid` and `uuid` values
+- Using [`@updatedAt`](/orm/v6/prisma-schema/data-model/models#defining-attributes) to store the time when a record was last updated
For relational databases, this includes:
-- [Implicit many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations)
+- [Implicit many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations)
For MongoDB, this includes:
-- [Relations in general](/v6/orm/prisma-schema/data-model/relations) - foreign key relations between documents are not enforced in MongoDB
+- [Relations in general](/orm/v6/prisma-schema/data-model/relations) - foreign key relations between documents are not enforced in MongoDB
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management.mdx
similarity index 88%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management.mdx
index 1f0975c9b8..9eb6471a0a 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management.mdx
@@ -1,7 +1,7 @@
---
title: Connection management
description: This page explains how database connections are handled with Prisma Client and how to manually connect and disconnect your database.
-url: /v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management
+url: /orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management
metaTitle: Connection management
metaDescription: This page explains how database connections are handled with Prisma Client and how to manually connect and disconnect your database.
---
@@ -12,12 +12,12 @@ This page explains how Prisma Client manages database connections, including how
`PrismaClient` connects and disconnects from your data source using the following two methods:
-- [`$connect()`](/v6/orm/reference/prisma-client-reference#connect-1)
-- [`$disconnect()`](/v6/orm/reference/prisma-client-reference#disconnect-1)
+- [`$connect()`](/orm/v6/reference/prisma-client-reference#connect-1)
+- [`$disconnect()`](/orm/v6/reference/prisma-client-reference#disconnect-1)
-In most cases, you **do not need to explicitly call these methods**. `PrismaClient` automatically connects when you run your first query, creates a [connection pool](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool), and disconnects when the Node.js process ends.
+In most cases, you **do not need to explicitly call these methods**. `PrismaClient` automatically connects when you run your first query, creates a [connection pool](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool), and disconnects when the Node.js process ends.
-See the [connection management guide](/v6/orm/prisma-client/setup-and-configuration/databases-connections) for information about managing connections for different deployment paradigms (long-running processes and serverless functions).
+See the [connection management guide](/orm/v6/prisma-client/setup-and-configuration/databases-connections) for information about managing connections for different deployment paradigms (long-running processes and serverless functions).
Questions answered in this page
@@ -30,7 +30,7 @@ See the [connection management guide](/v6/orm/prisma-client/setup-and-configurat
## `$connect()`
-It is not necessary to call [`$connect()`](/v6/orm/reference/prisma-client-reference#connect-1) thanks to the _lazy connect_ behavior: The `PrismaClient` instance connects lazily when the first request is made to the API (`$connect()` is called for you under the hood).
+It is not necessary to call [`$connect()`](/orm/v6/reference/prisma-client-reference#connect-1) thanks to the _lazy connect_ behavior: The `PrismaClient` instance connects lazily when the first request is made to the API (`$connect()` is called for you under the hood).
### Calling `$connect()` explicitly
@@ -45,7 +45,7 @@ await prisma.$connect();
## `$disconnect()`
-When you call [`$disconnect()`](/v6/orm/reference/prisma-client-reference#disconnect-1) , Prisma Client:
+When you call [`$disconnect()`](/orm/v6/reference/prisma-client-reference#disconnect-1) , Prisma Client:
1. Runs the [`beforeExit` hook](#exit-hooks)
2. Ends the Query Engine child process and closes all connections
@@ -54,7 +54,7 @@ In a long-running application such as a GraphQL API, which constantly serves req
:::tip
-To avoid too _many_ connections in a long-running application, we recommend that you [use a single instance of `PrismaClient` across your application](/v6/orm/prisma-client/setup-and-configuration/instantiate-prisma-client#the-number-of-prismaclient-instances-matters).
+To avoid too _many_ connections in a long-running application, we recommend that you [use a single instance of `PrismaClient` across your application](/orm/v6/prisma-client/setup-and-configuration/instantiate-prisma-client#the-number-of-prismaclient-instances-matters).
:::
@@ -97,7 +97,7 @@ If the above script runs multiple times in the context of a long-running applica
:::info
-From Prisma ORM 5.0.0, the `beforeExit` hook only applies to the [binary Query Engine](/v6/orm/more/internals/engines#configuring-the-query-engine).
+From Prisma ORM 5.0.0, the `beforeExit` hook only applies to the [binary Query Engine](/orm/v6/more/internals/engines#configuring-the-query-engine).
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool.mdx
similarity index 94%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool.mdx
index acd3944cf5..ca25fef1cd 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool.mdx
@@ -1,7 +1,7 @@
---
title: Connection pool
description: Prisma ORM's query engine creates a connection pool to store and manage database connections.
-url: /v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool
+url: /orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool
metaTitle: Connection pool
metaDescription: Prisma ORM's query engine creates a connection pool to store and manage database connections.
---
@@ -12,7 +12,7 @@ This page explains how Prisma ORM manages database connections using a connectio
The query engine manages a **connection pool** of database connections. The pool is created when Prisma Client opens the _first_ connection to the database, which can happen in one of two ways:
-- By [explicitly calling `$connect()`](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management#connect) _or_
+- By [explicitly calling `$connect()`](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management#connect) _or_
- By running the first query, which calls `$connect()` under the hood
Relational database connectors use Prisma ORM's own connection pool, and the MongoDB connectors uses the [MongoDB driver connection pool](https://github.com/mongodb/specifications/blob/master/source/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst).
@@ -28,7 +28,7 @@ Relational database connectors use Prisma ORM's own connection pool, and the Mon
## Relational databases
-Starting with Prisma ORM v7, relational datasources instantiate Prisma Client with [driver adapters](/v6/orm/overview/databases/database-drivers) by default. Driver adapters rely on the Node.js driver you supply, so connection pooling defaults (and configuration) now come from the driver itself.
+Starting with Prisma ORM v7, relational datasources instantiate Prisma Client with [driver adapters](/orm/v6/overview/databases/database-drivers) by default. Driver adapters rely on the Node.js driver you supply, so connection pooling defaults (and configuration) now come from the driver itself.
Use the tables below to translate Prisma ORM v6 connection URL parameters to the Prisma ORM v7 driver adapter fields alongside their defaults.
@@ -38,7 +38,7 @@ The following tables document the default connection pool settings for each driv
:::tip[Prisma timeouts]
-Prisma ORM also has its own configurable timeouts that are separate from the database driver timeouts. If you see a timeout error and are unsure whether it comes from the driver or from Prisma Client, see the [Prisma Client timeouts and transaction options documentation](/v6/orm/prisma-client/queries/transactions#transaction-options).
+Prisma ORM also has its own configurable timeouts that are separate from the database driver timeouts. If you see a timeout error and are unsure whether it comes from the driver or from Prisma Client, see the [Prisma Client timeouts and transaction options documentation](/orm/v6/prisma-client/queries/transactions#transaction-options).
:::
@@ -159,7 +159,7 @@ The MongoDB connector does not use the Prisma ORM connection pool. The connectio
You cannot increase the `connection_limit` beyond what the underlying database can support. This is a particular challenge in serverless environments, where each function manages an instance of `PrismaClient` - and its own connection pool.
-Consider introducing [an external connection pooler like PgBouncer](/v6/orm/prisma-client/setup-and-configuration/databases-connections#pgbouncer) to prevent your application or functions from exhausting the database connection limit.
+Consider introducing [an external connection pooler like PgBouncer](/orm/v6/prisma-client/setup-and-configuration/databases-connections#pgbouncer) to prevent your application or functions from exhausting the database connection limit.
## Manual database connection handling
@@ -178,7 +178,7 @@ The following steps describe how the query engine uses the connection pool:
1. If the query engine cannot reserve a connection from the pool, queries are added to a FIFO (First In First Out) queue in memory. FIFO means that queries are processed in the order they enter the queue.
1. If the query engine cannot process a query in the queue for **before the [time limit](#default-pool-timeout)**, it throws an exception with error code `P2024` for that query and moves on to the next one in the queue.
-If you consistently experience pool timeout errors, you need to [optimize the connection pool](/v6/orm/prisma-client/setup-and-configuration/databases-connections#optimizing-the-connection-pool) .
+If you consistently experience pool timeout errors, you need to [optimize the connection pool](/orm/v6/prisma-client/setup-and-configuration/databases-connections#optimizing-the-connection-pool) .
### Connection pool size
@@ -192,11 +192,11 @@ num_physical_cpus * 2 + 1
`num_physical_cpus` represents the number of physical CPUs on the machine your application is running on. If your machine has **four** physical CPUs, your connection pool will contain **nine** connections (`4 * 2 + 1 = 9`).
-Although the formula represents a good starting point, the [recommended connection limit](/v6/orm/prisma-client/setup-and-configuration/databases-connections#recommended-connection-pool-size) also depends on your deployment paradigm - particularly if you are using serverless.
+Although the formula represents a good starting point, the [recommended connection limit](/orm/v6/prisma-client/setup-and-configuration/databases-connections#recommended-connection-pool-size) also depends on your deployment paradigm - particularly if you are using serverless.
#### Setting the connection pool size
-You can specify the number of connections by explicitly setting the `connection_limit` parameter in your database connection URL. For example, with the following `datasource` configuration in your [Prisma schema](/v6/orm/prisma-schema/overview) the connection pool will have exactly five connections:
+You can specify the number of connections by explicitly setting the `connection_limit` parameter in your database connection URL. For example, with the following `datasource` configuration in your [Prisma schema](/orm/v6/prisma-schema/overview) the connection pool will have exactly five connections:
```prisma
datasource db {
@@ -207,9 +207,9 @@ datasource db {
#### Viewing the connection pool size
-The number of connections Prisma Client uses can be viewed using [logging](/v6/orm/prisma-client/observability-and-logging/logging) and built-in APIs provided by the driver adapter being used.
+The number of connections Prisma Client uses can be viewed using [logging](/orm/v6/prisma-client/observability-and-logging/logging) and built-in APIs provided by the driver adapter being used.
-Using the `info` [logging level](/v6/orm/reference/prisma-client-reference#log-levels), you can log the number of connections in a connection pool that are opened when Prisma Client is instantiated.
+Using the `info` [logging level](/orm/v6/reference/prisma-client-reference#log-levels), you can log the number of connections in a connection pool that are opened when Prisma Client is instantiated.
For example, consider the following Prisma Client instance and invocation:
@@ -239,7 +239,7 @@ Note that the output generated by `log: ['info']` can change in any release with
:::
-If you need even more insights into the size of your connection pool and the amount of in-use and idle connection, you can use the [metrics](/v6/orm/prisma-client/observability-and-logging/metrics) feature (which is currently in Preview).
+If you need even more insights into the size of your connection pool and the amount of in-use and idle connection, you can use the [metrics](/orm/v6/prisma-client/observability-and-logging/metrics) feature (which is currently in Preview).
Consider the following example:
@@ -298,7 +298,7 @@ main();
:::info
-For more details on what is available in the metrics output, see the [About metrics](/v6/orm/prisma-client/observability-and-logging/metrics#about-metrics) section.
+For more details on what is available in the metrics output, see the [About metrics](/orm/v6/prisma-client/observability-and-logging/metrics#about-metrics) section.
:::
@@ -330,4 +330,4 @@ datasource db {
}
```
-You can choose to [disable the connection pool timeout if queries **must** remain in the queue](/v6/orm/prisma-client/setup-and-configuration/databases-connections#disabling-the-pool-timeout) - for example, if you are importing a large number of records in parallel and are confident that the queue will not use up all available RAM before the job is complete.
+You can choose to [disable the connection pool timeout if queries **must** remain in the queue](/orm/v6/prisma-client/setup-and-configuration/databases-connections#disabling-the-pool-timeout) - for example, if you are importing a large number of records in parallel and are confident that the queue will not use up all available RAM before the job is complete.
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/index.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/index.mdx
similarity index 92%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/index.mdx
index f6f7a610ed..d31bd1d417 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/index.mdx
@@ -1,7 +1,7 @@
---
title: Database connections
description: Databases connections
-url: /v6/orm/prisma-client/setup-and-configuration/databases-connections
+url: /orm/v6/prisma-client/setup-and-configuration/databases-connections
metaTitle: Database connections
metaDescription: Databases connections
---
@@ -43,7 +43,7 @@ If you have **one** application instances:
If you have **multiple** application instances:
-- You must **manually** [set the `connection_limit` parameter](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool#setting-the-connection-pool-size) . For example, if your calculated pool size is _10_ and you have _2_ instances of your app, the `connection_limit` parameter should be **no more than _5_**.
+- You must **manually** [set the `connection_limit` parameter](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool#setting-the-connection-pool-size) . For example, if your calculated pool size is _10_ and you have _2_ instances of your app, the `connection_limit` parameter should be **no more than _5_**.
- You can optionally [tune the pool size](#optimizing-the-connection-pool).
### `PrismaClient` in long-running applications
@@ -81,7 +81,7 @@ You do not have to replicate the example above exactly - the goal is to make sur
#### Do not explicitly `$disconnect()`
-You [do not need to explicitly `$disconnect()`](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management#calling-disconnect-explicitly) in the context of a long-running application that is continuously serving requests. Opening a new connection takes time and can slow down your application if you disconnect after each query.
+You [do not need to explicitly `$disconnect()`](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management#calling-disconnect-explicitly) in the context of a long-running application that is continuously serving requests. Opening a new connection takes time and can slow down your application if you disconnect after each query.
#### Prevent hot reloading from creating new instances of `PrismaClient`
@@ -117,15 +117,15 @@ In local tests with Postgres, MySQL, and SQLite, each Prisma CLI command typical
| Command | Connections | Description |
| ------------------------------------------------------------------------------ | ----------- | ------------------------------------------------ |
-| [`migrate status`](/v6/orm/reference/prisma-cli-reference#migrate-status) | 1 | Checks the status of migrations |
-| [`migrate dev`](/v6/orm/reference/prisma-cli-reference#migrate-dev) | 1–4 | Applies pending migrations in development |
-| [`migrate diff`](/v6/orm/reference/prisma-cli-reference#migrate-diff) | 1–2 | Compares database schema with migration history |
-| [`migrate reset`](/v6/orm/reference/prisma-cli-reference#migrate-reset) | 1–2 | Resets the database and reapplies migrations |
-| [`migrate deploy`](/v6/orm/reference/prisma-cli-reference#migrate-deploy) | 1–2 | Applies pending migrations in production |
-| [`db pull`](/v6/orm/reference/prisma-cli-reference#db-pull) | 1 | Pulls the database schema into the Prisma schema |
-| [`db push`](/v6/orm/reference/prisma-cli-reference#db-push) | 1–2 | Pushes the Prisma schema to the database |
-| [`db execute`](/v6/orm/reference/prisma-cli-reference#db-execute) | 1 | Executes raw SQL commands |
-| [`db seed`](/v6/orm/reference/prisma-cli-reference#db-seed) | 1 | Seeds the database with initial data |
+| [`migrate status`](/orm/v6/reference/prisma-cli-reference#migrate-status) | 1 | Checks the status of migrations |
+| [`migrate dev`](/orm/v6/reference/prisma-cli-reference#migrate-dev) | 1–4 | Applies pending migrations in development |
+| [`migrate diff`](/orm/v6/reference/prisma-cli-reference#migrate-diff) | 1–2 | Compares database schema with migration history |
+| [`migrate reset`](/orm/v6/reference/prisma-cli-reference#migrate-reset) | 1–2 | Resets the database and reapplies migrations |
+| [`migrate deploy`](/orm/v6/reference/prisma-cli-reference#migrate-deploy) | 1–2 | Applies pending migrations in production |
+| [`db pull`](/orm/v6/reference/prisma-cli-reference#db-pull) | 1 | Pulls the database schema into the Prisma schema |
+| [`db push`](/orm/v6/reference/prisma-cli-reference#db-push) | 1–2 | Pushes the Prisma schema to the database |
+| [`db execute`](/orm/v6/reference/prisma-cli-reference#db-execute) | 1 | Executes raw SQL commands |
+| [`db seed`](/orm/v6/reference/prisma-cli-reference#db-seed) | 1 | Seeds the database with initial data |
## Serverless environments (FaaS)
@@ -221,7 +221,7 @@ export async function handler() {
#### Do not explicitly `$disconnect()`
-You [do not need to explicitly `$disconnect()`](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management#calling-disconnect-explicitly) at the end of a function, as there is a possibility that the container might be reused. Opening a new connection takes time and slows down your function's ability to process requests.
+You [do not need to explicitly `$disconnect()`](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management#calling-disconnect-explicitly) at the end of a function, as there is a possibility that the container might be reused. Opening a new connection takes time and slows down your function's ability to process requests.
### Other serverless considerations
@@ -243,7 +243,7 @@ Depending on your serverless concurrency limit (the number of serverless functio
## Optimizing the connection pool
-If the query engine cannot [process a query in the queue before the time limit](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool#how-the-connection-pool-works) , you will see connection pool timeout exceptions in your log. A connection pool timeout can occur if:
+If the query engine cannot [process a query in the queue before the time limit](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool#how-the-connection-pool-works) , you will see connection pool timeout exceptions in your log. A connection pool timeout can occur if:
- Many users are accessing your app simultaneously
- You send a large number of queries in parallel (for example, using `await Promise.all()`)
@@ -254,7 +254,7 @@ If you consistently experience connection pool timeouts after configuring the re
:::note
-As of Prisma ORM v7, [driver adapters](/v6/orm/overview/databases/database-drivers) are the default for relational databases, providing better performance and developer experience. Learn more [here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+As of Prisma ORM v7, [driver adapters](/orm/v6/overview/databases/database-drivers) are the default for relational databases, providing better performance and developer experience. Learn more [here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
**In Prisma ORM v7, the default generator configuration uses driver adapters**:
@@ -265,9 +265,9 @@ generator client {
}
```
-With driver adapters, connection pool configuration is handled by the Node.js driver you provide (like `pg`, `mariadb`, or `mssql`). See the [connection pool guide](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool) for v7 defaults and configuration details.
+With driver adapters, connection pool configuration is handled by the Node.js driver you provide (like `pg`, `mariadb`, or `mssql`). See the [connection pool guide](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool) for v7 defaults and configuration details.
-Prisma ORM also has its own configurable timeouts that are separate from the database driver timeouts. If you run into a timeout error and are unsure whether it comes from the specific driver or from Prisma Client, see the [Prisma Client timeouts and transaction options documentation](/v6/orm/prisma-client/queries/transactions#transaction-options).
+Prisma ORM also has its own configurable timeouts that are separate from the database driver timeouts. If you run into a timeout error and are unsure whether it comes from the specific driver or from Prisma Client, see the [Prisma Client timeouts and transaction options documentation](/orm/v6/prisma-client/queries/transactions#transaction-options).
You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog.
@@ -321,7 +321,7 @@ datasource db {
## External connection poolers
-Connection poolers like [Prisma Accelerate](/v6/accelerate) and PgBouncer prevent your application from exhausting the database's connection limit.
+Connection poolers like [Prisma Accelerate](/accelerate) and PgBouncer prevent your application from exhausting the database's connection limit.
To keep Prisma Client on the pooled connection while allowing Prisma CLI commands (for example, migrations or introspection) to connect directly, define two environment variables:
@@ -359,14 +359,14 @@ export const prisma = new PrismaClient({ adapter });
### Prisma Accelerate
-[Prisma Accelerate](/v6/accelerate) is a managed external connection pooler built by Prisma that is integrated in the [Prisma Data Platform](/v6/platform) and handles connection pooling for you.
+[Prisma Accelerate](/accelerate) is a managed external connection pooler built by Prisma that is integrated in the [Prisma Data Platform](/console) and handles connection pooling for you.
### PgBouncer
PostgreSQL only supports a certain amount of concurrent connections, and this limit can be reached quite fast when the service usage goes up – especially in [serverless environments](#serverless-environments-faas).
-[PgBouncer](https://www.pgbouncer.org/) holds a connection pool to the database and proxies incoming client connections by sitting between Prisma Client and the database. This reduces the number of processes a database has to handle at any given time. PgBouncer passes on a limited number of connections to the database and queues additional connections for delivery when connections becomes available. To use PgBouncer, see [Configure Prisma Client with PgBouncer](/v6/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer).
+[PgBouncer](https://www.pgbouncer.org/) holds a connection pool to the database and proxies incoming client connections by sitting between Prisma Client and the database. This reduces the number of processes a database has to handle at any given time. PgBouncer passes on a limited number of connections to the database and queues additional connections for delivery when connections becomes available. To use PgBouncer, see [Configure Prisma Client with PgBouncer](/orm/v6/prisma-client/setup-and-configuration/databases-connections/pgbouncer).
### AWS RDS Proxy
-Due to the way AWS RDS Proxy pins connections, [it does not provide any connection pooling benefits](/v6/orm/prisma-client/deployment/caveats-when-deploying-to-aws-platforms#aws-rds-proxy) when used together with Prisma Client.
+Due to the way AWS RDS Proxy pins connections, [it does not provide any connection pooling benefits](/orm/v6/prisma-client/deployment/caveats-when-deploying-to-aws-platforms#aws-rds-proxy) when used together with Prisma Client.
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/pgbouncer.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/pgbouncer.mdx
index 8d548f9706..bacbb8971f 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/databases-connections/pgbouncer.mdx
@@ -1,7 +1,7 @@
---
title: Configure Prisma Client with PgBouncer
description: 'Configure Prisma Client with PgBouncer and other poolers: when to use pgbouncer=true, required transaction mode, prepared statements, and Prisma Migrate workarounds.'
-url: /v6/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer
+url: /orm/v6/prisma-client/setup-and-configuration/databases-connections/pgbouncer
metaTitle: Configure Prisma Client with PgBouncer
metaDescription: 'Configure Prisma Client with PgBouncer and other poolers: when to use pgbouncer=true, required transaction mode, prepared statements, and Prisma Migrate workarounds.'
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/error-formatting.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/error-formatting.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/error-formatting.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/error-formatting.mdx
index be8828a736..b18bf0ad91 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/error-formatting.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/error-formatting.mdx
@@ -1,7 +1,7 @@
---
title: Configuring error formatting
description: This page explains how to configure the formatting of errors when using Prisma Client.
-url: /v6/orm/prisma-client/setup-and-configuration/error-formatting
+url: /orm/v6/prisma-client/setup-and-configuration/error-formatting
metaTitle: Configuring error formatting (Concepts)
metaDescription: This page explains how to configure the formatting of errors when using Prisma Client.
---
@@ -25,12 +25,12 @@ In order to configure these different error formatting levels, there are two opt
## Formatting via environment variables
-- [`NO_COLOR`](/v6/orm/reference/environment-variables-reference#no_color): If this env var is provided, colors are stripped from the error messages. Therefore you end up with a **colorless error**. The `NO_COLOR` environment variable is a standard described [here](https://no-color.org/).
+- [`NO_COLOR`](/orm/v6/reference/environment-variables-reference#no_color): If this env var is provided, colors are stripped from the error messages. Therefore you end up with a **colorless error**. The `NO_COLOR` environment variable is a standard described [here](https://no-color.org/).
- `NODE_ENV=production`: If the env var `NODE_ENV` is set to `production`, only the **minimal error** will be printed. This allows for easier digestion of logs in production environments.
### Formatting via the `PrismaClient` constructor
-Alternatively, use the `PrismaClient` [`errorFormat`](/v6/orm/reference/prisma-client-reference#errorformat) parameter to set the error format:
+Alternatively, use the `PrismaClient` [`errorFormat`](/orm/v6/reference/prisma-client-reference#errorformat) parameter to set the error format:
```ts
const prisma = new PrismaClient({
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/generating-prisma-client.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/generating-prisma-client.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client.mdx
index 11231e6120..66933946fe 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/generating-prisma-client.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client.mdx
@@ -1,7 +1,7 @@
---
title: Generating Prisma Client
description: 'This page explains how to generate Prisma Client. It also provides additional context on the generated client, typical workflows and Node.js configuration.'
-url: /v6/orm/prisma-client/setup-and-configuration/generating-prisma-client
+url: /orm/v6/prisma-client/setup-and-configuration/generating-prisma-client
metaTitle: Generating Prisma Client
metaDescription: 'This page explains how to generate Prisma Client. It also provides additional context on the generated client, typical workflows and Node.js configuration.'
---
@@ -26,22 +26,22 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
:::
To generate and instantiate Prisma Client:
-1. Ensure that you have [Prisma CLI installed on your machine](/v6/orm/tools/prisma-cli#installation).
+1. Ensure that you have [Prisma CLI installed on your machine](/orm/v6/tools/prisma-cli#installation).
```npm
npm install prisma --save-dev
@@ -74,7 +74,7 @@ To generate and instantiate Prisma Client:
npx prisma generate
```
-1. You can now [instantiate Prisma Client](/v6/orm/prisma-client/setup-and-configuration/instantiate-prisma-client) in your code:
+1. You can now [instantiate Prisma Client](/orm/v6/prisma-client/setup-and-configuration/instantiate-prisma-client) in your code:
```ts
import { PrismaClient } from "./prisma/generated/client";
@@ -121,7 +121,7 @@ import { PrismaClient } from "./generated/client";
:::note
-For improved compatibility with ECMAScript modules (ESM) and to ensure consistent behaviour of Prisma ORM across different Node.js runtimes, you can also use the newer [`prisma-client`](/v6/orm/prisma-schema/overview/generators#prisma-client) generator. This generator is specifically designed to handle common challenges with module resolution and runtime variations, providing a smoother integration experience and less friction with bundlers.
+For improved compatibility with ECMAScript modules (ESM) and to ensure consistent behaviour of Prisma ORM across different Node.js runtimes, you can also use the newer [`prisma-client`](/orm/v6/prisma-schema/overview/generators#prisma-client) generator. This generator is specifically designed to handle common challenges with module resolution and runtime variations, providing a smoother integration experience and less friction with bundlers.
:::
@@ -177,7 +177,7 @@ This means that you still import `@prisma/client` in your own `.ts` files:
import { PrismaClient } from "@prisma/client";
```
-Prisma Client is generated from your Prisma schema and is unique to your project. Each time you change the schema (for example, by performing a [schema migration](/v6/orm/prisma-migrate/getting-started)) and run `prisma generate`, Prisma Client's code changes:
+Prisma Client is generated from your Prisma schema and is unique to your project. Each time you change the schema (for example, by performing a [schema migration](/orm/v6/prisma-migrate/getting-started)) and run `prisma generate`, Prisma Client's code changes:

diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/instantiate-prisma-client.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/instantiate-prisma-client.mdx
similarity index 73%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/instantiate-prisma-client.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/instantiate-prisma-client.mdx
index bc51b3b80d..08cfce07ba 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/instantiate-prisma-client.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/instantiate-prisma-client.mdx
@@ -1,12 +1,12 @@
---
title: Instantiating Prisma Client
description: How to create and use an instance of PrismaClient in your app.
-url: /v6/orm/prisma-client/setup-and-configuration/instantiate-prisma-client
+url: /orm/v6/prisma-client/setup-and-configuration/instantiate-prisma-client
metaTitle: Instantiating Prisma Client
metaDescription: How to create and use an instance of PrismaClient in your app.
---
-The following example demonstrates how to import and instantiate your [generated client](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client) from the [default path](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path):
+The following example demonstrates how to import and instantiate your [generated client](/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client) from the [default path](/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path):
```ts tab="TypeScript"
import { PrismaClient } from "../prisma/generated/client";
@@ -22,20 +22,20 @@ const prisma = new PrismaClient();
:::tip
-You can further customize `PrismaClient` with [constructor parameters](/v6/orm/reference/prisma-client-reference#prismaclient) — for example, set [logging levels](/v6/orm/prisma-client/observability-and-logging/logging), [transaction options](/v6/orm/prisma-client/queries/transactions#transaction-options) or customize [error formatting](/v6/orm/prisma-client/setup-and-configuration/error-formatting).
+You can further customize `PrismaClient` with [constructor parameters](/orm/v6/reference/prisma-client-reference#prismaclient) — for example, set [logging levels](/orm/v6/prisma-client/observability-and-logging/logging), [transaction options](/orm/v6/prisma-client/queries/transactions#transaction-options) or customize [error formatting](/orm/v6/prisma-client/setup-and-configuration/error-formatting).
:::
## The number of `PrismaClient` instances matters
-Your application should generally only create **one instance** of `PrismaClient`. How to achieve this depends on whether you are using Prisma ORM in a [long-running application](/v6/orm/prisma-client/setup-and-configuration/databases-connections#prismaclient-in-long-running-applications) or in a [serverless environment](/v6/orm/prisma-client/setup-and-configuration/databases-connections#prismaclient-in-serverless-environments) .
+Your application should generally only create **one instance** of `PrismaClient`. How to achieve this depends on whether you are using Prisma ORM in a [long-running application](/orm/v6/prisma-client/setup-and-configuration/databases-connections#prismaclient-in-long-running-applications) or in a [serverless environment](/orm/v6/prisma-client/setup-and-configuration/databases-connections#prismaclient-in-serverless-environments) .
The reason for this is that each instance of `PrismaClient` manages a connection pool, which means that a large number of clients can **exhaust the database connection limit**. This applies to all database connectors.
-If you use the **MongoDB connector**, connections are managed by the MongoDB driver connection pool. If you use a **relational database connector**, connections are managed by Prisma ORM's [connection pool](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool). Each instance of `PrismaClient` creates its own pool.
+If you use the **MongoDB connector**, connections are managed by the MongoDB driver connection pool. If you use a **relational database connector**, connections are managed by Prisma ORM's [connection pool](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool). Each instance of `PrismaClient` creates its own pool.
-1. Each client creates its own instance of the [query engine](/v6/orm/more/internals/engines).
-1. Each query engine creates a [connection pool](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool) with a default pool size of:
+1. Each client creates its own instance of the [query engine](/orm/v6/more/internals/engines).
+1. Each query engine creates a [connection pool](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool) with a default pool size of:
- `num_physical_cpus * 2 + 1` for relational databases
- [`100` for MongoDB](https://www.mongodb.com/docs/manual/reference/connection-string-options/#mongodb-urioption-urioption.maxPoolSize)
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/introduction.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/introduction.mdx
similarity index 83%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/introduction.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/introduction.mdx
index 8764e162a4..4e11b52284 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/introduction.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/introduction.mdx
@@ -1,26 +1,26 @@
---
title: Introduction to Prisma Client
description: Learn how to set up Prisma Client.
-url: /v6/orm/prisma-client/setup-and-configuration/introduction
+url: /orm/v6/prisma-client/setup-and-configuration/introduction
metaTitle: Introduction to Prisma Client
metaDescription: Learn how to set up Prisma Client.
---
-Prisma Client is an auto-generated and type-safe query builder that's _tailored_ to your data. The easiest way to get started with Prisma Client is by following the **[Quickstart](/v6/prisma-orm/quickstart/sqlite)**.
+Prisma Client is an auto-generated and type-safe query builder that's _tailored_ to your data. The easiest way to get started with Prisma Client is by following the **[Quickstart](/prisma-orm/quickstart/sqlite)**.
-[⭐ Quickstart (5 min)](/v6/prisma-orm/quickstart/sqlite)
+[⭐ Quickstart (5 min)](/prisma-orm/quickstart/sqlite)
The setup instructions [below](#set-up) provide a high-level overview of the steps needed to set up Prisma Client. If you want to get started using Prisma Client with your own database, follow one of these guides:
-[🚀 Set up a new project from scratch](/v6/prisma-orm/quickstart/postgresql)
+[🚀 Set up a new project from scratch](/prisma-orm/quickstart/postgresql)
-[➕ Add Prisma to an existing project](/v6/prisma-orm/add-to-existing-project/postgresql)
+[➕ Add Prisma to an existing project](/prisma-orm/add-to-existing-project/postgresql)
## Set up
### 1. Prerequisites
-In order to set up Prisma Client, you need a [Prisma schema file](/v6/orm/prisma-schema/overview) with your database connection, the Prisma Client generator, and at least one model:
+In order to set up Prisma Client, you need a [Prisma schema file](/orm/v6/prisma-schema/overview) with your database connection, the Prisma Client generator, and at least one model:
```prisma title="schema.prisma"
datasource db {
@@ -40,7 +40,7 @@ model User {
}
```
-Also make sure to [install the Prisma CLI](/v6/orm/tools/prisma-cli#installation):
+Also make sure to [install the Prisma CLI](/orm/v6/tools/prisma-cli#installation):
```npm
npm install prisma --save-dev
@@ -92,7 +92,7 @@ const prisma = new PrismaClient();
// use `prisma` in your application to read and write data in your DB
```
-> **Note**: If you're using [driver adapters](/v6/orm/overview/databases/database-drivers#driver-adapters), you can import from the location specified in your generator's `output` path directly, e.g. `./src/generated/prisma`. No need to import from `./src/generated/prisma/edge`.
+> **Note**: If you're using [driver adapters](/orm/v6/overview/databases/database-drivers#driver-adapters), you can import from the location specified in your generator's `output` path directly, e.g. `./src/generated/prisma`. No need to import from `./src/generated/prisma/edge`.
### 4. Use Prisma Client to send queries to your database
@@ -112,7 +112,7 @@ const users = await prisma.user.findMany();
:::info
-All Prisma Client methods return an instance of [`PrismaPromise`](/v6/orm/reference/prisma-client-reference#prismapromise-behavior) which only executes when you call `await` or `.then()` or `.catch()`.
+All Prisma Client methods return an instance of [`PrismaPromise`](/orm/v6/reference/prisma-client-reference#prismapromise-behavior) which only executes when you call `await` or `.then()` or `.catch()`.
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/no-rust-engine.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/no-rust-engine.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/no-rust-engine.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/no-rust-engine.mdx
index ac7e6e9535..6c75c4704d 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/no-rust-engine.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/no-rust-engine.mdx
@@ -1,12 +1,12 @@
---
title: No Rust engine
description: Learn how to use Prisma ORM without Rust engines
-url: /v6/orm/prisma-client/setup-and-configuration/no-rust-engine
+url: /orm/v6/prisma-client/setup-and-configuration/no-rust-engine
metaTitle: No Rust engine
metaDescription: Learn how to use Prisma ORM without Rust engines
---
-As of [v6.16.0](https://pris.ly/release/6.16.0), usage of Prisma ORM without [Rust engine](/v6/orm/more/internals/engines) binaries on PostgreSQL, CockroachDB, Neon, MySQL, PlanetScale, SQLite, D1 & MS SQL Server databases has been [Generally Available](/v6/orm/more/releases#generally-available-ga).
+As of [v6.16.0](https://pris.ly/release/6.16.0), usage of Prisma ORM without [Rust engine](/orm/v6/more/internals/engines) binaries on PostgreSQL, CockroachDB, Neon, MySQL, PlanetScale, SQLite, D1 & MS SQL Server databases has been [Generally Available](/orm/v6/more/releases#generally-available-ga).
This page gives an overview of how to use this version of Prisma ORM.
@@ -17,7 +17,7 @@ The main technical differences if you're using Prisma ORM without a Rust engine
- no `binaryTargets` field on the `generator` block
- no query engine binary that's downloaded into the directory with your generated Prisma Client
- `engineType` needs to be set to `"client"` on the `generator` block
-- required usage of [driver adapters](/v6/orm/overview/databases/database-drivers#driver-adapters) for database connection management
+- required usage of [driver adapters](/orm/v6/overview/databases/database-drivers#driver-adapters) for database connection management
:::warning
The Rust-free version of Prisma ORM has been thoroughly tested with the `prisma-client` generator (see below), not with `prisma-client-js`. Use the old generator at your discretion.
@@ -196,7 +196,7 @@ If you went through the previous steps, you can query your database as you're us
## Usage with Prisma Accelerate or Prisma Postgres
-When using the Rust-free version of Prisma ORM with [Prisma Accelerate](/v6/accelerate) or [Prisma Postgres](/v6/postgres), you **should not** use driver adapters. Instead, you can directly instantiate Prisma Client with the appropriate extension.
+When using the Rust-free version of Prisma ORM with [Prisma Accelerate](/accelerate) or [Prisma Postgres](/postgres), you **should not** use driver adapters. Instead, you can directly instantiate Prisma Client with the appropriate extension.
### 1. Set `engineType` on the `generator` block
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/read-replicas.mdx b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/read-replicas.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/read-replicas.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/read-replicas.mdx
index 6df14473f8..327a0ea847 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/setup-and-configuration/read-replicas.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/setup-and-configuration/read-replicas.mdx
@@ -1,7 +1,7 @@
---
title: Read replicas
description: Learn how to set up and use read replicas with Prisma Client
-url: /v6/orm/prisma-client/setup-and-configuration/read-replicas
+url: /orm/v6/prisma-client/setup-and-configuration/read-replicas
metaTitle: Read replicas
metaDescription: Learn how to set up and use read replicas with Prisma Client
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/composite-types.mdx b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/composite-types.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/composite-types.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/composite-types.mdx
index 6aa405c846..9e1dc25a6b 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/composite-types.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/composite-types.mdx
@@ -1,7 +1,7 @@
---
title: Composite types
description: Learn about composite types in Prisma Client for MongoDB
-url: /v6/orm/prisma-client/special-fields-and-types/composite-types
+url: /orm/v6/prisma-client/special-fields-and-types/composite-types
metaTitle: Composite types
metaDescription: Composite types
---
@@ -12,9 +12,9 @@ Composite types are only available with MongoDB.
:::
-[Composite types](/v6/orm/prisma-schema/data-model/models#defining-composite-types), known as [embedded documents](https://www.mongodb.com/docs/manual/data-modeling/#embedded-data) in MongoDB, allow you to embed records within other records.
+[Composite types](/orm/v6/prisma-schema/data-model/models#defining-composite-types), known as [embedded documents](https://www.mongodb.com/docs/manual/data-modeling/#embedded-data) in MongoDB, allow you to embed records within other records.
-We made composite types [Generally Available](/v6/orm/more/releases#generally-available-ga) in v3.12.0. They were previously available in [Preview](/v6/orm/reference/preview-features) from v3.10.0.
+We made composite types [Generally Available](/orm/v6/more/releases#generally-available-ga) in v3.12.0. They were previously available in [Preview](/orm/v6/reference/preview-features) from v3.10.0.
This page explains how to:
@@ -89,8 +89,8 @@ In this schema, the `Product` model has a `Photo[]` composite type, and the `Ord
There are currently some limitations when using composite types in Prisma Client:
-- [`findUnique()`](/v6/orm/reference/prisma-client-reference#findunique) can't filter on composite types
-- [`aggregate`](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#aggregate), [`groupBy()`](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#group-by), [`count`](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#count) don’t support composite operations
+- [`findUnique()`](/orm/v6/reference/prisma-client-reference#findunique) can't filter on composite types
+- [`aggregate`](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#aggregate), [`groupBy()`](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#group-by), [`count`](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#count) don’t support composite operations
## Default values for required fields on composite types
@@ -98,13 +98,13 @@ From version 4.0.0, if you carry out a database read on a composite type when al
Conditions:
-- A field on the composite type is [required](/v6/orm/prisma-schema/data-model/models#optional-and-mandatory-fields), and
-- this field has a [default value](/v6/orm/prisma-schema/data-model/models#defining-a-default-value), and
+- A field on the composite type is [required](/orm/v6/prisma-schema/data-model/models#optional-and-mandatory-fields), and
+- this field has a [default value](/orm/v6/prisma-schema/data-model/models#defining-a-default-value), and
- this field is not present in the returned document or documents.
Note:
-- This is the same behavior as with [model fields](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types).
+- This is the same behavior as with [model fields](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types).
- On read operations, Prisma Client inserts the default value into the result, but does not insert the default value into the database.
In our example schema, suppose that you add a required field to `photo`. This field, `bitDepth`, has a default value:
@@ -119,7 +119,7 @@ type Photo {
...
```
-Suppose that you then run `npx prisma db push` to [update your database](/v6/orm/reference/prisma-cli-reference#db-push) and regenerate your Prisma Client with `npx prisma generate`. Then, you run the following application code:
+Suppose that you then run `npx prisma db push` to [update your database](/orm/v6/reference/prisma-cli-reference#db-push) and regenerate your Prisma Client with `npx prisma generate`. Then, you run the following application code:
```ts
console.dir(await prisma.product.findMany({}), { depth: Infinity });
@@ -536,7 +536,7 @@ const order = await prisma.order.update({
});
```
-You can use [filters](/v6/orm/prisma-client/special-fields-and-types/composite-types#finding-records-that-contain-composite-types-with-find-and-findmany) within `updateMany` to update all records that match a composite type. The following example uses the `is` filter to match the street name from a shipping address on a list of orders:
+You can use [filters](/orm/v6/prisma-client/special-fields-and-types/composite-types#finding-records-that-contain-composite-types-with-find-and-findmany) within `updateMany` to update all records that match a composite type. The following example uses the `is` filter to match the street name from a shipping address on a list of orders:
```ts
const orders = await prisma.order.updateMany({
@@ -674,7 +674,7 @@ const deleteProduct = await prisma.product.deleteMany({
});
```
-You can also use [filters](/v6/orm/prisma-client/special-fields-and-types/composite-types#finding-records-that-contain-composite-types-with-find-and-findmany) to delete records that match a composite type. The example below uses the `some` filter to delete products that contain a certain photo:
+You can also use [filters](/orm/v6/prisma-client/special-fields-and-types/composite-types#finding-records-that-contain-composite-types-with-find-and-findmany) to delete records that match a composite type. The example below uses the `some` filter to delete products that contain a certain photo:
```ts
const product = await prisma.product.deleteMany({
@@ -757,7 +757,7 @@ Note: MongoDB throws an error if you try to store the same value in two separate
### Use Prisma ORM relations to enforce unique values in a record
-In the example above, MongoDB did not enforce the unique constraint on a nested address name. However, you can model your data differently to enforce unique values in a record. To do so, use Prisma ORM [relations](/v6/orm/prisma-schema/data-model/relations) to turn the composite type into a collection. Set a relationship to this collection and place a unique constraint on the field that you want to be unique.
+In the example above, MongoDB did not enforce the unique constraint on a nested address name. However, you can model your data differently to enforce unique values in a record. To do so, use Prisma ORM [relations](/orm/v6/prisma-schema/data-model/relations) to turn the composite type into a collection. Set a relationship to this collection and place a unique constraint on the field that you want to be unique.
In the following example, MongoDB enforces unique values in a record. There is a relation between `Mailbox` and the `Address` model. Also, the `name` field in the `Address` model has a unique constraint.
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/index.mdx b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/index.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/index.mdx
index 08fcf97f78..32e30af58c 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/index.mdx
@@ -1,7 +1,7 @@
---
title: Fields & types
description: Learn how to use about special fields and types with Prisma Client.
-url: /v6/orm/prisma-client/special-fields-and-types
+url: /orm/v6/prisma-client/special-fields-and-types
metaTitle: Fields & types
metaDescription: Learn how to use about special fields and types with Prisma Client.
---
@@ -103,7 +103,7 @@ const newTypes = await prisma.sample.create({
});
```
-Learn more in the [upgrade guide to v6](/v6/orm/more/upgrades/to-v7).
+Learn more in the [upgrade guide to v6](/orm/v6/more/upgrades/to-v7).
## Working with `DateTime`
@@ -113,7 +113,7 @@ There currently is a [bug](https://github.com/prisma/prisma/issues/9516) that do
:::
-When creating records that have fields of type [`DateTime`](/v6/orm/reference/prisma-schema-reference#datetime), Prisma Client accepts values as [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) objects adhering to the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
+When creating records that have fields of type [`DateTime`](/orm/v6/reference/prisma-schema-reference#datetime), Prisma Client accepts values as [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) objects adhering to the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
Consider the following schema:
@@ -168,12 +168,12 @@ await prisma.user.create({
## Working with `Json`
-See: [Working with `Json` fields](/v6/orm/prisma-client/special-fields-and-types/working-with-json-fields)
+See: [Working with `Json` fields](/orm/v6/prisma-client/special-fields-and-types/working-with-json-fields)
## Working with scalar lists / scalar arrays
-See: [Working with scalar lists / arrays](/v6/orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays)
+See: [Working with scalar lists / arrays](/orm/v6/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays)
## Working with composite IDs and compound unique constraints
-See: [Working with composite IDs and compound unique constraints](/v6/orm/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints)
+See: [Working with composite IDs and compound unique constraints](/orm/v6/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints)
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/null-and-undefined.mdx b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/null-and-undefined.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/null-and-undefined.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/null-and-undefined.mdx
index 6576eef575..cc0e6a43fe 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/null-and-undefined.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/null-and-undefined.mdx
@@ -2,7 +2,7 @@
title: Null and undefined
description: How Prisma Client handles null and undefined
preview: false
-url: /v6/orm/prisma-client/special-fields-and-types/null-and-undefined
+url: /orm/v6/prisma-client/special-fields-and-types/null-and-undefined
metaTitle: Null and undefined in Prisma Client (Reference)
metaDescription: How Prisma Client handles null and undefined
---
@@ -356,7 +356,7 @@ The following table provides a high-level overview of how the different operator
| `AND` | return all items | validate single filter | validate all filters |
| `NOT` | return all items | validate single filter | validate all filters |
-This example shows how an `undefined` parameter impacts the results returned by a query that uses the [`OR`](/v6/orm/reference/prisma-client-reference#or) operator.
+This example shows how an `undefined` parameter impacts the results returned by a query that uses the [`OR`](/orm/v6/reference/prisma-client-reference#or) operator.
```ts
interface FormData {
@@ -385,7 +385,7 @@ const users = await prisma.user.findMany({
The query receives filters from a formData object, which includes an optional email property. In this instance, the value of the email property is `undefined`. When this query is run no data is returned.
-This is in contrast to the [`AND`](/v6/orm/reference/prisma-client-reference#and) and [`NOT`](/v6/orm/reference/prisma-client-reference#not-1) operators, which will both return all the users
+This is in contrast to the [`AND`](/orm/v6/reference/prisma-client-reference#and) and [`NOT`](/orm/v6/reference/prisma-client-reference#not-1) operators, which will both return all the users
if you pass in an `undefined` value.
> This is because passing an `undefined` value to an `AND` or `NOT` operator is the same
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints.mdx b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints.mdx
index 9a4b2e2147..92a9dc9ce4 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints.mdx
@@ -1,12 +1,12 @@
---
title: Working with compound IDs and unique constraints
description: 'How to read, write, and filter by compound IDs and unique constraints.'
-url: /v6/orm/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints
+url: /orm/v6/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints
metaTitle: Working with compound IDs and unique constraints (Concepts)
metaDescription: 'How to read, write, and filter by compound IDs and unique constraints.'
---
-Composite IDs and compound unique constraints can be defined in your Prisma schema using the [`@@id`](/v6/orm/reference/prisma-schema-reference#id-1) and [`@@unique`](/v6/orm/reference/prisma-schema-reference#unique-1) attributes.
+Composite IDs and compound unique constraints can be defined in your Prisma schema using the [`@@id`](/orm/v6/reference/prisma-schema-reference#id-1) and [`@@unique`](/orm/v6/reference/prisma-schema-reference#unique-1) attributes.
:::warning
@@ -98,7 +98,7 @@ const like = await prisma.like.findUnique({
:::info
-Note composite ID and compound unique constraint keys are only available as filter options for _unique_ queries such as `findUnique()` and `findUniqueOrThrow`. See the [section](/v6/orm/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints#where-you-can-use-compound-ids-and-unique-constraints) above for a list of places these fields may be used.
+Note composite ID and compound unique constraint keys are only available as filter options for _unique_ queries such as `findUnique()` and `findUniqueOrThrow`. See the [section](/orm/v6/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints#where-you-can-use-compound-ids-and-unique-constraints) above for a list of places these fields may be used.
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/working-with-json-fields.mdx b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/working-with-json-fields.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/working-with-json-fields.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/working-with-json-fields.mdx
index 122ddb9d79..386078ae7f 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/working-with-json-fields.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/working-with-json-fields.mdx
@@ -1,12 +1,12 @@
---
title: Working with Json fields
description: 'How to read, write, and filter by Json fields.'
-url: /v6/orm/prisma-client/special-fields-and-types/working-with-json-fields
+url: /orm/v6/prisma-client/special-fields-and-types/working-with-json-fields
metaTitle: Working with Json fields (Concepts)
metaDescription: 'How to read, write, and filter by Json fields.'
---
-Use the [`Json`](/v6/orm/reference/prisma-schema-reference#json) Prisma ORM field type to read, write, and perform basic filtering on JSON types in the underlying database. In the following example, the `User` model has an optional `Json` field named `extendedPetsData`:
+Use the [`Json`](/orm/v6/reference/prisma-schema-reference#json) Prisma ORM field type to read, write, and perform basic filtering on JSON types in the underlying database. In the following example, the `User` model has an optional `Json` field named `extendedPetsData`:
```prisma highlight=6;normal
model User {
@@ -130,7 +130,7 @@ const getUsers = await prisma.user.findMany({
## Filter on a `Json` field (advanced)
-You can also filter rows by the data inside a `Json` field. We call this **advanced `Json` filtering**. This functionality is supported by [PostgreSQL](/v6/orm/overview/databases/postgresql) and [MySQL](/v6/orm/overview/databases/mysql) only with [different syntaxes for the `path` option](#path-syntax-depending-on-database).
+You can also filter rows by the data inside a `Json` field. We call this **advanced `Json` filtering**. This functionality is supported by [PostgreSQL](/orm/v6/overview/databases/postgresql) and [MySQL](/orm/v6/overview/databases/mysql) only with [different syntaxes for the `path` option](#path-syntax-depending-on-database).
:::warning
@@ -142,8 +142,8 @@ PostgreSQL does not support [filtering on object key values in arrays](#filterin
The availability of advanced `Json` filtering depends on your Prisma version:
-- v4.0.0 or later: advanced `Json` filtering is [generally available](/v6/orm/more/releases#generally-available-ga).
-- From v2.23.0, but before v4.0.0: advanced `Json` filtering is a [preview feature](/v6/orm/reference/preview-features/client-preview-features). Add `previewFeatures = ["filterJson"]` to your schema. [Learn more](/v6/orm/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature).
+- v4.0.0 or later: advanced `Json` filtering is [generally available](/orm/v6/more/releases#generally-available-ga).
+- From v2.23.0, but before v4.0.0: advanced `Json` filtering is a [preview feature](/orm/v6/reference/preview-features/client-preview-features). Add `previewFeatures = ["filterJson"]` to your schema. [Learn more](/orm/v6/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature).
- Before v2.23.0: you can [filter on the exact `Json` field value](#filter-on-exact-field-value), but you cannot use the other features described in this section.
:::
@@ -152,8 +152,8 @@ The availability of advanced `Json` filtering depends on your Prisma version:
The filters below use a `path` option to select specific parts of the `Json` value to filter on. The implementation of that filtering differs between connectors:
-- The [MySQL connector](/v6/orm/overview/databases/mysql) uses [MySQL's implementation of JSON path](https://dev.mysql.com/doc/refman/8.0/en/json.html#json-path-syntax)
-- The [PostgreSQL connector](/v6/orm/overview/databases/postgresql) uses the custom JSON functions and operators [supported in version 12 _and earlier_](https://www.postgresql.org/docs/11/functions-json.html)
+- The [MySQL connector](/orm/v6/overview/databases/mysql) uses [MySQL's implementation of JSON path](https://dev.mysql.com/doc/refman/8.0/en/json.html#json-path-syntax)
+- The [PostgreSQL connector](/orm/v6/overview/databases/postgresql) uses the custom JSON functions and operators [supported in version 12 _and earlier_](https://www.postgresql.org/docs/11/functions-json.html)
For example, the following is a valid MySQL `path` value:
@@ -228,11 +228,11 @@ const getUsers = await prisma.user.findMany({
The following string filters are available:
-- [`string_contains`](/v6/orm/reference/prisma-client-reference#string_contains)
-- [`string_starts_with`](/v6/orm/reference/prisma-client-reference#string_starts_with)
-- [`string_ends_with`](/v6/orm/reference/prisma-client-reference#string_ends_with) .
+- [`string_contains`](/orm/v6/reference/prisma-client-reference#string_contains)
+- [`string_starts_with`](/orm/v6/reference/prisma-client-reference#string_starts_with)
+- [`string_ends_with`](/orm/v6/reference/prisma-client-reference#string_ends_with) .
-To use case insensitive filter with these, you can use the [`mode`](/v6/orm/reference/prisma-client-reference#mode) option:
+To use case insensitive filter with these, you can use the [`mode`](/orm/v6/reference/prisma-client-reference#mode) option:
```ts tab="PostgreSQL"
const getUsers = await prisma.user.findMany({
@@ -389,9 +389,9 @@ In PostgreSQL, the value of `array_contains` must be an array and not a string,
The following array filters are available:
-- [`array_contains`](/v6/orm/reference/prisma-client-reference#array_contains)
-- [`array_starts_with`](/v6/orm/reference/prisma-client-reference#array_starts_with)
-- [`array_ends_with`](/v6/orm/reference/prisma-client-reference#array_ends_with)
+- [`array_contains`](/orm/v6/reference/prisma-client-reference#array_contains)
+- [`array_starts_with`](/orm/v6/reference/prisma-client-reference#array_starts_with)
+- [`array_ends_with`](/orm/v6/reference/prisma-client-reference#array_ends_with)
### Filtering on nested array value
@@ -553,7 +553,7 @@ Depending on your provider, you can filter on the key value of an object inside
:::warning
-Filtering on object key values within an array is **only** supported by the [MySQL database connector](/v6/orm/overview/databases/mysql). However, you can still [filter on the presence of entire JSON objects](#json-object-arrays).
+Filtering on object key values within an array is **only** supported by the [MySQL database connector](/orm/v6/overview/databases/mysql). However, you can still [filter on the presence of entire JSON objects](#json-object-arrays).
:::
@@ -878,7 +878,7 @@ Prisma's `Json` fields are untyped by default. To add strong typing, you can use
}
```
-2. Next, link a field to a TypeScript type using an [AST comment](/v6/orm/prisma-schema/overview#comments).
+2. Next, link a field to a TypeScript type using an [AST comment](/orm/v6/prisma-schema/overview#comments).
```prisma highlight=4;normal title="schema.prisma" showLineNumbers
model Log {
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays.mdx b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays.mdx
similarity index 92%
rename from apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays.mdx
index b993d59044..c678d6ffe4 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays.mdx
@@ -1,12 +1,12 @@
---
title: Working with scalar lists
description: 'How to read, write, and filter by scalar lists / arrays.'
-url: /v6/orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays
+url: /orm/v6/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays
metaTitle: Working with scalar lists/arrays (Concepts)
metaDescription: 'How to read, write, and filter by scalar lists / arrays.'
---
-[Scalar lists](/v6/orm/reference/prisma-schema-reference#-modifier) are represented by the `[]` modifier and are only available if the underlying database supports scalar lists. The following example has one scalar `String` list named `pets`:
+[Scalar lists](/orm/v6/reference/prisma-schema-reference#-modifier) are represented by the `[]` modifier and are only available if the underlying database supports scalar lists. The following example has one scalar `String` list named `pets`:
```prisma highlight=4;normal tab="Relational databases"
model User {
@@ -32,7 +32,7 @@ Example field value:
## Setting the value of a scalar list
-The following example demonstrates how to [`set`](/v6/orm/reference/prisma-client-reference#set-1) the value of a scalar list (`coinflips`) when you create a model:
+The following example demonstrates how to [`set`](/orm/v6/reference/prisma-client-reference#set-1) the value of a scalar list (`coinflips`) when you create a model:
```ts
const createdUser = await prisma.user.create({
@@ -52,7 +52,7 @@ This method is available on MongoDB only in versions
:::
-The following example demonstrates how to [`unset`](/v6/orm/reference/prisma-client-reference#unset) the value of a scalar list (`coinflips`):
+The following example demonstrates how to [`unset`](/orm/v6/reference/prisma-client-reference#unset) the value of a scalar list (`coinflips`):
```ts
const createdUser = await prisma.user.create({
@@ -79,7 +79,7 @@ Available for:
:::
-Use the [`push`](/v6/orm/reference/prisma-client-reference#push) method to add a single value to a scalar list:
+Use the [`push`](/orm/v6/reference/prisma-client-reference#push) method to add a single value to a scalar list:
```ts
const userUpdate = await prisma.user.update({
@@ -133,7 +133,7 @@ Available for:
:::
-Use [scalar list filters](/v6/orm/reference/prisma-client-reference#scalar-list-filters) to filter for records with scalar lists that match a specific condition. The following example returns all posts where the tags list includes `databases` _and_ `typescript`:
+Use [scalar list filters](/orm/v6/reference/prisma-client-reference#scalar-list-filters) to filter for records with scalar lists that match a specific condition. The following example returns all posts where the tags list includes `databases` _and_ `typescript`:
```ts
const posts = await prisma.post.findMany({
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/testing/index.mdx b/apps/docs/content/docs/orm/v6/prisma-client/testing/index.mdx
similarity index 89%
rename from apps/docs/content/docs.v6/orm/prisma-client/testing/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/testing/index.mdx
index 1c126057a5..3521bb69b6 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/testing/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/testing/index.mdx
@@ -1,7 +1,7 @@
---
title: Testing
description: How to implement unit and integration testing with Prisma ORM
-url: /v6/orm/prisma-client/testing
+url: /orm/v6/prisma-client/testing
metaTitle: Testing
metaDescription: How to implement unit and integration testing with Prisma ORM
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/testing/integration-testing.mdx b/apps/docs/content/docs/orm/v6/prisma-client/testing/integration-testing.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-client/testing/integration-testing.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/testing/integration-testing.mdx
index e64f0de7f5..3d6a60ccfd 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/testing/integration-testing.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/testing/integration-testing.mdx
@@ -1,7 +1,7 @@
---
title: Integration testing
description: Learn how to setup and run integration tests with Prisma and Docker
-url: /v6/orm/prisma-client/testing/integration-testing
+url: /orm/v6/prisma-client/testing/integration-testing
metaTitle: Integration testing with Prisma
metaDescription: Learn how to setup and run integration tests with Prisma and Docker
---
@@ -89,7 +89,7 @@ model Customer {
-The guide uses a singleton pattern for Prisma Client setup. Refer to the [singleton](/v6/orm/prisma-client/testing/unit-testing#singleton) docs for a walk through of how to set that up.
+The guide uses a singleton pattern for Prisma Client setup. Refer to the [singleton](/orm/v6/prisma-client/testing/unit-testing#singleton) docs for a walk through of how to set that up.
## Add Docker to your project
@@ -133,7 +133,7 @@ DATABASE_URL="postgresql://prisma:prisma@localhost:5433/tests"
:::info
-The above `.env.test` file is used as part of a multiple `.env` file setup. Checkout the [using multiple .env files.](/v6/orm/more/dev-environment/environment-variables) section to learn more about setting up your project with multiple `.env` files
+The above `.env.test` file is used as part of a multiple `.env` file setup. Checkout the [using multiple .env files.](/orm/v6/more/dev-environment/environment-variables) section to learn more about setting up your project with multiple `.env` files
:::
@@ -278,13 +278,13 @@ The following tests will check if the `createOrder` function works as it should
- Creating an order with an existing customer
- Show an "Out of stock" error message if a product doesn't exist
-Before the test suite is run the database is seeded with data. After the test suite has finished a [`deleteMany`](/v6/orm/reference/prisma-client-reference#deletemany) is used to clear the database of its data.
+Before the test suite is run the database is seeded with data. After the test suite has finished a [`deleteMany`](/orm/v6/reference/prisma-client-reference#deletemany) is used to clear the database of its data.
:::tip
Using `deleteMany` may suffice in situations where you know ahead of time how your schema is structured. This is because the operations need to be executed in the correct order according to how the model relations are setup.
-However, this doesn't scale as well as having a more generic solution that maps over your models and performs a truncate on them. For those scenarios and examples of using raw SQL queries see [Deleting all data with raw SQL / `TRUNCATE`](/v6/orm/prisma-client/queries/crud#deleting-all-data-with-raw-sql--truncate)
+However, this doesn't scale as well as having a more generic solution that maps over your models and performs a truncate on them. For those scenarios and examples of using raw SQL queries see [Deleting all data with raw SQL / `TRUNCATE`](/orm/v6/prisma-client/queries/crud#deleting-all-data-with-raw-sql--truncate)
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/testing/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/testing/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/testing/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/testing/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/testing/unit-testing.mdx b/apps/docs/content/docs/orm/v6/prisma-client/testing/unit-testing.mdx
similarity index 99%
rename from apps/docs/content/docs.v6/orm/prisma-client/testing/unit-testing.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/testing/unit-testing.mdx
index 91c9b5154b..dd4dc01a4b 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/testing/unit-testing.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/testing/unit-testing.mdx
@@ -1,7 +1,7 @@
---
title: Unit testing
description: Learn how to setup and run unit tests with Prisma Client
-url: /v6/orm/prisma-client/testing/unit-testing
+url: /orm/v6/prisma-client/testing/unit-testing
metaTitle: Unit testing with Prisma ORM
metaDescription: Learn how to setup and run unit tests with Prisma Client
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/type-safety/index.mdx b/apps/docs/content/docs/orm/v6/prisma-client/type-safety/index.mdx
similarity index 94%
rename from apps/docs/content/docs.v6/orm/prisma-client/type-safety/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/type-safety/index.mdx
index 72c2134e4a..988d935794 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/type-safety/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/type-safety/index.mdx
@@ -1,7 +1,7 @@
---
title: Type safety
description: 'Prisma Client provides full type safety for queries, even for partial queries or included relations. This page explains how to leverage the generated types and utilities.'
-url: /v6/orm/prisma-client/type-safety
+url: /orm/v6/prisma-client/type-safety
metaTitle: Type safety
metaDescription: 'Prisma Client provides full type safety for queries, even for partial queries or included relations. This page explains how to leverage the generated types and utilities.'
---
@@ -31,7 +31,7 @@ const createUser = await prisma.user.create({
});
```
-See also: [Using the `Prisma.UserCreateInput` generated type](/v6/orm/prisma-client/queries/crud#create-a-single-record-using-generated-types)
+See also: [Using the `Prisma.UserCreateInput` generated type](/orm/v6/prisma-client/queries/crud#create-a-single-record-using-generated-types)
## What are generated types?
@@ -111,11 +111,11 @@ userPosts.posts;
userPosts.profile;
```
-> See the [model query options](/v6/orm/reference/prisma-client-reference#model-query-options) reference for more information about the different types available.
+> See the [model query options](/orm/v6/reference/prisma-client-reference#model-query-options) reference for more information about the different types available.
### Generated `UncheckedInput` types
-The `UncheckedInput` types are a special set of generated types that allow you to perform some operations that Prisma Client considers "unsafe", like directly writing [relation scalar fields](/v6/orm/prisma-schema/data-model/relations). You can choose either the "safe" `Input` types or the "unsafe" `UncheckedInput` type when doing operations like `create`, `update`, or `upsert`.
+The `UncheckedInput` types are a special set of generated types that allow you to perform some operations that Prisma Client considers "unsafe", like directly writing [relation scalar fields](/orm/v6/prisma-schema/data-model/relations). You can choose either the "safe" `Input` types or the "unsafe" `UncheckedInput` type when doing operations like `create`, `update`, or `upsert`.
For example, this Prisma schema has a one-to-many relation between `User` and `Post`:
@@ -187,7 +187,7 @@ prisma.post.create({
});
```
-This query will also result in an error if an author with an `id` of `1` does not exist. In this case, Prisma Client will give a more descriptive error message. You can also use the [`connectOrCreate`](/v6/orm/reference/prisma-client-reference#connectorcreate) API to safely create a new user if one does not already exist with the given `id`.
+This query will also result in an error if an author with an `id` of `1` does not exist. In this case, Prisma Client will give a more descriptive error message. You can also use the [`connectOrCreate`](/orm/v6/reference/prisma-client-reference#connectorcreate) API to safely create a new user if one does not already exist with the given `id`.
We recommend using the "safe" `Input` types whenever possible.
@@ -201,7 +201,7 @@ This feature is available from Prisma ORM version 4.9.0 upwards.
To help you create highly type-safe applications, Prisma Client provides a set of type utilities that tap into input and output types. These types are fully dynamic, which means that they adapt to any given model and schema. You can use them to improve the auto-completion and developer experience of your projects.
-This is especially useful in [validating inputs](/v6/orm/prisma-client/type-safety/prisma-validator) and [shared Prisma Client extensions](/v6/orm/prisma-client/client-extensions/shared-extensions).
+This is especially useful in [validating inputs](/orm/v6/prisma-client/type-safety/prisma-validator) and [shared Prisma Client extensions](/orm/v6/prisma-client/client-extensions/shared-extensions).
The following type utilities are available in Prisma Client:
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/type-safety/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/type-safety/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/type-safety/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/type-safety/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/type-safety/operating-against-partial-structures-of-model-types.mdx b/apps/docs/content/docs/orm/v6/prisma-client/type-safety/operating-against-partial-structures-of-model-types.mdx
similarity index 88%
rename from apps/docs/content/docs.v6/orm/prisma-client/type-safety/operating-against-partial-structures-of-model-types.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/type-safety/operating-against-partial-structures-of-model-types.mdx
index 2bf0f9566f..8e0e3d3c11 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/type-safety/operating-against-partial-structures-of-model-types.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/type-safety/operating-against-partial-structures-of-model-types.mdx
@@ -1,12 +1,12 @@
---
title: Operating against partial structures of your model types
description: This page documents various scenarios for using the generated types from the Prisma namespace
-url: /v6/orm/prisma-client/type-safety/operating-against-partial-structures-of-model-types
+url: /orm/v6/prisma-client/type-safety/operating-against-partial-structures-of-model-types
metaTitle: Operating against partial structures of your model types
metaDescription: This page documents various scenarios for using the generated types from the Prisma namespace
---
-When using Prisma Client, every model from your [Prisma schema](/v6/orm/prisma-schema/overview) is translated into a dedicated TypeScript type. For example, assume you have the following `User` and `Post` models:
+When using Prisma Client, every model from your [Prisma schema](/orm/v6/prisma-schema/overview) is translated into a dedicated TypeScript type. For example, assume you have the following `User` and `Post` models:
```prisma
model User {
@@ -45,9 +45,9 @@ In some scenarios, you may need a _variation_ of the generated `User` type. For
As a solution, you can customize the generated model type using Prisma Client's helper types.
-The `User` type only contains the model's [scalar](/v6/orm/prisma-schema/data-model/models#scalar-fields) fields, but doesn't account for any relations. That's because [relations are not included by default](/v6/orm/prisma-client/queries/select-fields#return-the-default-fields) in Prisma Client queries.
+The `User` type only contains the model's [scalar](/orm/v6/prisma-schema/data-model/models#scalar-fields) fields, but doesn't account for any relations. That's because [relations are not included by default](/orm/v6/prisma-client/queries/select-fields#return-the-default-fields) in Prisma Client queries.
-However, sometimes it's useful to have a type available that **includes a relation** (i.e. a type that you'd get from an API call that uses [`include`](/v6/orm/prisma-client/queries/select-fields#return-nested-objects-by-selecting-relation-fields)). Similarly, another useful scenario could be to have a type available that **includes only a subset of the model's scalar fields** (i.e. a type that you'd get from an API call that uses [`select`](/v6/orm/prisma-client/queries/select-fields#select-specific-fields)).
+However, sometimes it's useful to have a type available that **includes a relation** (i.e. a type that you'd get from an API call that uses [`include`](/orm/v6/prisma-client/queries/select-fields#return-nested-objects-by-selecting-relation-fields)). Similarly, another useful scenario could be to have a type available that **includes only a subset of the model's scalar fields** (i.e. a type that you'd get from an API call that uses [`select`](/orm/v6/prisma-client/queries/select-fields#select-specific-fields)).
One way of achieving this would be to define these types manually in your application code:
@@ -67,7 +67,7 @@ type UserPersonalData = {
};
```
-While this is certainly feasible, this approach increases the maintenance burden upon changes to the Prisma schema as you need to manually maintain the types. A cleaner solution to this is to use the `UserGetPayload` type that is generated and exposed by Prisma Client under the `Prisma` namespace in combination with the [`validator`](/v6/orm/prisma-client/type-safety/prisma-validator).
+While this is certainly feasible, this approach increases the maintenance burden upon changes to the Prisma schema as you need to manually maintain the types. A cleaner solution to this is to use the `UserGetPayload` type that is generated and exposed by Prisma Client under the `Prisma` namespace in combination with the [`validator`](/orm/v6/prisma-client/type-safety/prisma-validator).
The following example uses the `Prisma.validator` to create two type-safe objects and then uses the `Prisma.UserGetPayload` utility function to create a type that can be used to return all users and their posts.
@@ -97,7 +97,7 @@ The main benefits of the latter approach are:
### Description
-When doing [`select`](/v6/orm/reference/prisma-client-reference#select) or [`include`](/v6/orm/reference/prisma-client-reference#include) operations on your models and returning these variants from a function, it can be difficult to gain access to the return type, e.g:
+When doing [`select`](/orm/v6/reference/prisma-client-reference#select) or [`include`](/orm/v6/reference/prisma-client-reference#include) operations on your models and returning these variants from a function, it can be difficult to gain access to the return type, e.g:
```ts
// Function definition that returns a partial structure
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/type-safety/prisma-type-system.mdx b/apps/docs/content/docs/orm/v6/prisma-client/type-safety/prisma-type-system.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/prisma-client/type-safety/prisma-type-system.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/type-safety/prisma-type-system.mdx
index b59dedfe8d..13a24eab6c 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/type-safety/prisma-type-system.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/type-safety/prisma-type-system.mdx
@@ -1,7 +1,7 @@
---
title: How to use Prisma ORM's type system
description: How to use Prisma ORM's type system
-url: /v6/orm/prisma-client/type-safety/prisma-type-system
+url: /orm/v6/prisma-client/type-safety/prisma-type-system
metaTitle: How to use Prisma ORM's type system
metaDescription: How to use Prisma ORM's type system
---
@@ -10,7 +10,7 @@ This guide introduces Prisma ORM's type system and explains how to introspect ex
## How does Prisma ORM's type system work?
-Prisma ORM uses _types_ to define the kind of data that a field can hold. To make it easy to get started, Prisma ORM provides a small number of core [scalar types](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types) that should cover most default use cases. For example, take the following blog post model:
+Prisma ORM uses _types_ to define the kind of data that a field can hold. To make it easy to get started, Prisma ORM provides a small number of core [scalar types](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types) that should cover most default use cases. For example, take the following blog post model:
```prisma title="schema.prisma" showLineNumbers
datasource db {
@@ -37,12 +37,12 @@ To allow you to get started with our core scalar types, Prisma ORM provides _def
- by default Prisma ORM's `String` type gets mapped to PostgreSQL's `text` type and MySQL's `varchar` type
- by default Prisma ORM's `DateTime` type gets mapped to PostgreSQL's `timestamp(3)` type and SQL Server's `datetime2` type
-See Prisma ORM's [database connector pages](/v6/orm/overview/databases/database-drivers) for the default type mappings for a given database. For example, [this table](/v6/orm/overview/databases/postgresql#type-mapping-between-postgresql-and-prisma-schema) gives the default type mappings for PostgreSQL.
-To see the default type mappings for all databases for a specific given Prisma ORM type, see the [model field scalar types section](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types) of the Prisma schema reference. For example, [this table](/v6/orm/reference/prisma-schema-reference#float) gives the default type mappings for the `Float` scalar type.
+See Prisma ORM's [database connector pages](/orm/v6/overview/databases/database-drivers) for the default type mappings for a given database. For example, [this table](/orm/v6/overview/databases/postgresql#type-mapping-between-postgresql-and-prisma-schema) gives the default type mappings for PostgreSQL.
+To see the default type mappings for all databases for a specific given Prisma ORM type, see the [model field scalar types section](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types) of the Prisma schema reference. For example, [this table](/orm/v6/reference/prisma-schema-reference#float) gives the default type mappings for the `Float` scalar type.
### Native type mappings
-Sometimes you may need to use a more specific database type that is not one of the default type mappings for your Prisma ORM type. For this purpose, Prisma ORM provides [native type attributes](/v6/orm/prisma-schema/data-model/models#native-types-mapping) to refine the core scalar types. For example, in the `createdAt` field of your `Post` model above you may want to use a date-only column in your underlying PostgreSQL database, by using the `date` type instead of the default type mapping of `timestamp(3)`. To do this, add a `@db.Date` native type attribute to the `createdAt` field:
+Sometimes you may need to use a more specific database type that is not one of the default type mappings for your Prisma ORM type. For this purpose, Prisma ORM provides [native type attributes](/orm/v6/prisma-schema/data-model/models#native-types-mapping) to refine the core scalar types. For example, in the `createdAt` field of your `Post` model above you may want to use a date-only column in your underlying PostgreSQL database, by using the `date` type instead of the default type mapping of `timestamp(3)`. To do this, add a `@db.Date` native type attribute to the `createdAt` field:
```prisma title="schema.prisma" showLineNumbers
model Post {
@@ -56,7 +56,7 @@ Native type mappings allow you to express all the types in your database. Howeve
## How to introspect database types
-When you [introspect](/v6/orm/prisma-schema/introspection) an existing database, Prisma ORM will take the database type of each table column and represent it in your Prisma schema using the correct Prisma ORM type for the corresponding model field. If the database type is not the default database type for that Prisma ORM scalar type, Prisma ORM will also add a native type attribute.
+When you [introspect](/orm/v6/prisma-schema/introspection) an existing database, Prisma ORM will take the database type of each table column and represent it in your Prisma schema using the correct Prisma ORM type for the corresponding model field. If the database type is not the default database type for that Prisma ORM scalar type, Prisma ORM will also add a native type attribute.
As an example, take a `User` table in a PostgreSQL database, with:
@@ -157,5 +157,5 @@ Notice that the `@db.Date` native type attribute modifies the database type of t
For further reference information on using Prisma ORM's type system, see the following resources:
-- The [database connector](/v6/orm/overview/introduction/what-is-prisma) page for each database provider has a type mapping section with a table of default type mappings between Prisma ORM types and database types, and a table of database types with their corresponding native type attribute in Prisma ORM. For example, the type mapping section for PostgreSQL is [here](/v6/orm/overview/databases/postgresql#type-mapping-between-postgresql-and-prisma-schema).
-- The [model field scalar types](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types) section of the Prisma schema reference has a subsection for each Prisma ORM scalar type. This includes a table of default mappings for that Prisma ORM type in each database, and a table for each database listing the corresponding database types and their native type attributes in Prisma ORM. For example, the entry for the `String` Prisma ORM type is [here](/v6/orm/reference/prisma-schema-reference#string).
+- The [database connector](/orm/v6/overview/introduction/what-is-prisma) page for each database provider has a type mapping section with a table of default type mappings between Prisma ORM types and database types, and a table of database types with their corresponding native type attribute in Prisma ORM. For example, the type mapping section for PostgreSQL is [here](/orm/v6/overview/databases/postgresql#type-mapping-between-postgresql-and-prisma-schema).
+- The [model field scalar types](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types) section of the Prisma schema reference has a subsection for each Prisma ORM scalar type. This includes a table of default mappings for that Prisma ORM type in each database, and a table for each database listing the corresponding database types and their native type attributes in Prisma ORM. For example, the entry for the `String` Prisma ORM type is [here](/orm/v6/reference/prisma-schema-reference#string).
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/type-safety/prisma-validator.mdx b/apps/docs/content/docs/orm/v6/prisma-client/type-safety/prisma-validator.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-client/type-safety/prisma-validator.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/type-safety/prisma-validator.mdx
index b0bff8bcd5..6ddf9fa016 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/type-safety/prisma-validator.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/type-safety/prisma-validator.mdx
@@ -1,12 +1,12 @@
---
title: Prisma validator
description: The Prisma validator is a utility function that takes a generated type and returns a type-safe object which adheres to the generated types model fields.
-url: /v6/orm/prisma-client/type-safety/prisma-validator
+url: /orm/v6/prisma-client/type-safety/prisma-validator
metaTitle: Prisma validator
metaDescription: The Prisma validator is a utility function that takes a generated type and returns a type-safe object which adheres to the generated types model fields.
---
-The [`Prisma.validator`](/v6/orm/reference/prisma-client-reference#prismavalidator) is a utility function that takes a generated type and returns a type-safe object which adheres to the generated types model fields.
+The [`Prisma.validator`](/orm/v6/reference/prisma-client-reference#prismavalidator) is a utility function that takes a generated type and returns a type-safe object which adheres to the generated types model fields.
This page introduces the `Prisma.validator` and offers some motivations behind why you might choose to use it.
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/index.mdx b/apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/index.mdx
similarity index 84%
rename from apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/index.mdx
index 9ee6ecefc8..a50d032244 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/index.mdx
@@ -1,7 +1,7 @@
---
title: Write your own SQL
description: Learn how to use raw SQL queries in Prisma Client.
-url: /v6/orm/prisma-client/using-raw-sql
+url: /orm/v6/prisma-client/using-raw-sql
metaTitle: Write Your Own SQL in Prisma Client
metaDescription: Learn how to use raw SQL queries in Prisma Client.
---
@@ -10,13 +10,13 @@ While the Prisma Client API aims to make all your database queries intuitive, ty
This can happen for various reasons, such as the need to optimize the performance of a specific query or because your data requirements can't be fully expressed by Prisma Client's query API.
-In most cases, [TypedSQL](#writing-type-safe-queries-with-prisma-client-and-typedsql) allows you to express your query in SQL while still benefiting from Prisma Client's excellent user experience. However, since TypedSQL is statically typed, it may not handle certain scenarios, such as dynamically generated `WHERE` clauses. In these cases, you will need to use [`$queryRaw`](/v6/orm/prisma-client/using-raw-sql/raw-queries#queryraw) or [`$executeRaw`](/v6/orm/prisma-client/using-raw-sql/raw-queries#executeraw), or their unsafe counterparts.
+In most cases, [TypedSQL](#writing-type-safe-queries-with-prisma-client-and-typedsql) allows you to express your query in SQL while still benefiting from Prisma Client's excellent user experience. However, since TypedSQL is statically typed, it may not handle certain scenarios, such as dynamically generated `WHERE` clauses. In these cases, you will need to use [`$queryRaw`](/orm/v6/prisma-client/using-raw-sql/raw-queries#queryraw) or [`$executeRaw`](/orm/v6/prisma-client/using-raw-sql/raw-queries#executeraw), or their unsafe counterparts.
## Writing type-safe queries with Prisma Client and TypedSQL
:::info
-TypedSQL is available in Prisma ORM 5.19.0 and later. For raw database access in previous versions, see [our raw queries documentation](/v6/orm/prisma-client/using-raw-sql/raw-queries).
+TypedSQL is available in Prisma ORM 5.19.0 and later. For raw database access in previous versions, see [our raw queries documentation](/orm/v6/prisma-client/using-raw-sql/raw-queries).
:::
@@ -39,7 +39,7 @@ TypedSQL is particularly useful for:
By using TypedSQL, you can write efficient, type-safe database queries without sacrificing the power and flexibility of raw SQL. This feature allows you to seamlessly integrate custom SQL queries into your Prisma-powered applications, ensuring type safety and improving developer productivity.
-For a detailed guide on how to get started with TypedSQL, including setup instructions and usage examples, please refer to our [TypedSQL documentation](/v6/orm/prisma-client/using-raw-sql/typedsql).
+For a detailed guide on how to get started with TypedSQL, including setup instructions and usage examples, please refer to our [TypedSQL documentation](/orm/v6/prisma-client/using-raw-sql/typedsql).
## Raw queries
@@ -51,10 +51,10 @@ While not as ergonomic as [TypedSQL](#writing-type-safe-queries-with-prisma-clie
Prisma ORM supports four methods to execute raw SQL queries in relational databases:
-- [`$queryRaw`](/v6/orm/prisma-client/using-raw-sql/raw-queries#queryraw)
-- [`$executeRaw`](/v6/orm/prisma-client/using-raw-sql/raw-queries#executeraw)
-- [`$queryRawUnsafe`](/v6/orm/prisma-client/using-raw-sql/raw-queries#queryrawunsafe)
-- [`$executeRawUnsafe`](/v6/orm/prisma-client/using-raw-sql/raw-queries#executerawunsafe)
+- [`$queryRaw`](/orm/v6/prisma-client/using-raw-sql/raw-queries#queryraw)
+- [`$executeRaw`](/orm/v6/prisma-client/using-raw-sql/raw-queries#executeraw)
+- [`$queryRawUnsafe`](/orm/v6/prisma-client/using-raw-sql/raw-queries#queryrawunsafe)
+- [`$executeRawUnsafe`](/orm/v6/prisma-client/using-raw-sql/raw-queries#executerawunsafe)
These commands are similar to using TypedSQL, but they are not type-safe and are written as strings in your code rather than in dedicated `.sql` files.
@@ -62,9 +62,9 @@ These commands are similar to using TypedSQL, but they are not type-safe and are
For MongoDB, Prisma ORM supports three methods to execute raw queries:
-- [`$runCommandRaw`](/v6/orm/prisma-client/using-raw-sql/raw-queries#runcommandraw)
-- [`.findRaw`](/v6/orm/prisma-client/using-raw-sql/raw-queries#findraw)
-- [`.aggregateRaw`](/v6/orm/prisma-client/using-raw-sql/raw-queries#aggregateraw)
+- [`$runCommandRaw`](/orm/v6/prisma-client/using-raw-sql/raw-queries#runcommandraw)
+- [`.findRaw`](/orm/v6/prisma-client/using-raw-sql/raw-queries#findraw)
+- [`.aggregateRaw`](/orm/v6/prisma-client/using-raw-sql/raw-queries#aggregateraw)
These methods allow you to execute raw MongoDB commands and queries, providing flexibility when you need to use MongoDB-specific features or optimizations.
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/meta.json b/apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/raw-queries.mdx b/apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/raw-queries.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/raw-queries.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/raw-queries.mdx
index 85840b4707..02909aba1b 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/raw-queries.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/raw-queries.mdx
@@ -1,14 +1,14 @@
---
title: Raw queries
description: Learn how you can send raw SQL and MongoDB queries to your database using the raw() methods from the Prisma Client API.
-url: /v6/orm/prisma-client/using-raw-sql/raw-queries
+url: /orm/v6/prisma-client/using-raw-sql/raw-queries
metaTitle: Raw queries
metaDescription: Learn how you can send raw SQL and MongoDB queries to your database using the raw() methods from the Prisma Client API.
---
:::warning
-With Prisma ORM `5.19.0`, we have released [TypedSQL](/v6/orm/prisma-client/using-raw-sql). TypedSQL is a new way to write SQL queries that are type-safe and even easier to add to your workflow.
+With Prisma ORM `5.19.0`, we have released [TypedSQL](/orm/v6/prisma-client/using-raw-sql). TypedSQL is a new way to write SQL queries that are type-safe and even easier to add to your workflow.
We strongly recommend using TypedSQL queries over the legacy raw queries described below whenever possible.
@@ -139,7 +139,7 @@ const result = await prisma.$queryRaw`SELECT * FROM User`;
> **Note**: If you do not provide a type, `$queryRaw` defaults to `unknown`.
-If you are selecting **specific fields** of the model or want to include relations, refer to the documentation about [leveraging Prisma Client's generated types](/v6/orm/prisma-client/type-safety/operating-against-partial-structures-of-model-types#problem-using-variations-of-the-generated-model-type) if you want to make sure that the results are properly typed.
+If you are selecting **specific fields** of the model or want to include relations, refer to the documentation about [leveraging Prisma Client's generated types](/orm/v6/prisma-client/type-safety/operating-against-partial-structures-of-model-types#problem-using-variations-of-the-generated-model-type) if you want to make sure that the results are properly typed.
#### Type caveats when using raw SQL
@@ -338,7 +338,7 @@ Prisma maps any database values returned by `$queryRaw` and `$queryRawUnsafe`to
**Feature availability:**
-- In v3.14.x and v3.15.x, raw query type mapping was available with the preview feature `improvedQueryRaw`. We made raw query type mapping [Generally Available](/v6/orm/more/releases#generally-available-ga) in version 4.0.0, so you do not need to use `improvedQueryRaw` in version 4.0.0 or later.
+- In v3.14.x and v3.15.x, raw query type mapping was available with the preview feature `improvedQueryRaw`. We made raw query type mapping [Generally Available](/orm/v6/more/releases#generally-available-ga) in version 4.0.0, so you do not need to use `improvedQueryRaw` in version 4.0.0 or later.
- Before version 4.0.0, raw query type mapping was not available for SQLite.
:::
@@ -376,7 +376,7 @@ The following table shows the conversion between types used in the database and
| Uuid | `String` |
| Xml | `String` |
-Note that the exact name for each database type will vary between databases – for example, the boolean type is known as `boolean` in PostgreSQL and `STRING` in CockroachDB. See the [Scalar types reference](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types) for full details of type names for each database.
+Note that the exact name for each database type will vary between databases – for example, the boolean type is known as `boolean` in PostgreSQL and `STRING` in CockroachDB. See the [Scalar types reference](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types) for full details of type names for each database.
### Raw query typecasting behavior
@@ -403,7 +403,7 @@ await prisma.$queryRaw`SELECT LENGTH(${42}::text);`;
:::info
-**Feature availability:** This funtionality is [Generally Available](/v6/orm/more/releases#generally-available-ga) since version 4.0.0. In v3.14.x and v3.15.x, it was available with the preview feature `improvedQueryRaw`.
+**Feature availability:** This funtionality is [Generally Available](/orm/v6/more/releases#generally-available-ga) since version 4.0.0. In v3.14.x and v3.15.x, it was available with the preview feature `improvedQueryRaw`.
For the example above before version 4.0.0, Prisma ORM silently coerces `42` to `text` and does not require the explicit cast.
@@ -420,7 +420,7 @@ await prisma.$queryRaw`SELECT ${1.5}::int as int`;
### Transactions
-In 2.10.0 and later, you can use `.$executeRaw()` and `.$queryRaw()` inside a [transaction](/v6/orm/prisma-client/queries/transactions).
+In 2.10.0 and later, you can use `.$executeRaw()` and `.$queryRaw()` inside a [transaction](/orm/v6/prisma-client/queries/transactions).
### Using variables
@@ -481,7 +481,7 @@ await prisma.$executeRawUnsafe('ALTER USER prisma WITH PASSWORD "$1"', password}
### Unsupported types
-[`Unsupported` types](/v6/orm/reference/prisma-schema-reference#unsupported) need to be cast to Prisma Client supported types before using them in `$queryRaw` or `$queryRawUnsafe`. For example, take the following model, which has a `location` field with an `Unsupported` type:
+[`Unsupported` types](/orm/v6/reference/prisma-schema-reference#unsupported) need to be cast to Prisma Client supported types before using them in `$queryRaw` or `$queryRawUnsafe`. For example, take the following model, which has a `location` field with an `Unsupported` type:
```tsx
model Country {
@@ -505,7 +505,7 @@ await prisma.$queryRaw`SELECT location::text FROM Country;`;
The database will thus provide a `String` representation of your data which Prisma Client supports.
-For details of supported Prisma types, see the [Prisma connector overview](/v6/orm/overview/databases/database-drivers) for the relevant database.
+For details of supported Prisma types, see the [Prisma connector overview](/orm/v6/overview/databases/database-drivers) for the relevant database.
## SQL injection prevention
@@ -680,7 +680,7 @@ console.log(result);
#### Using `$queryRawUnsafe` and `$executeRawUnsafe` unsafely
-If you cannot use tagged templates, you can instead use [`$queryRawUnsafe`](/v6/orm/prisma-client/using-raw-sql/raw-queries#queryrawunsafe) or [`$executeRawUnsafe`](/v6/orm/prisma-client/using-raw-sql/raw-queries#executerawunsafe). However, **be aware that these functions significantly increase the risk of SQL injection vulnerabilities in your code**.
+If you cannot use tagged templates, you can instead use [`$queryRawUnsafe`](/orm/v6/prisma-client/using-raw-sql/raw-queries#queryrawunsafe) or [`$executeRawUnsafe`](/orm/v6/prisma-client/using-raw-sql/raw-queries#executerawunsafe). However, **be aware that these functions significantly increase the risk of SQL injection vulnerabilities in your code**.
The following example concatenates `query` and `inputString`. Prisma Client ❌ **cannot** escape `inputString` in this example, which makes it vulnerable to SQL injection:
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/safeql.mdx b/apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/safeql.mdx
similarity index 96%
rename from apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/safeql.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/safeql.mdx
index 0a03bb4906..ceaa575c01 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/safeql.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/safeql.mdx
@@ -1,20 +1,20 @@
---
title: SafeQL & Prisma Client
description: 'Learn how to use SafeQL and Prisma Client extensions to work around features not natively supported by Prisma, such as PostGIS.'
-url: /v6/orm/prisma-client/using-raw-sql/safeql
+url: /orm/v6/prisma-client/using-raw-sql/safeql
metaTitle: Integrate SafeQL with Prisma Client
metaDescription: 'Learn how to use SafeQL and Prisma Client extensions to work around features not natively supported by Prisma, such as PostGIS.'
---
## Overview
-This page explains how to improve the experience of writing raw SQL in Prisma ORM. It uses [Prisma Client extensions](/v6/orm/prisma-client/client-extensions) and [SafeQL](https://safeql.dev) to create custom, type-safe Prisma Client queries which abstract custom SQL that your app might need (using `$queryRaw`).
+This page explains how to improve the experience of writing raw SQL in Prisma ORM. It uses [Prisma Client extensions](/orm/v6/prisma-client/client-extensions) and [SafeQL](https://safeql.dev) to create custom, type-safe Prisma Client queries which abstract custom SQL that your app might need (using `$queryRaw`).
The example will be using [PostGIS](https://postgis.net/) and PostgreSQL, but is applicable to any raw SQL queries that you might need in your application.
:::note
-This page builds on the [legacy raw query methods](/v6/orm/prisma-client/using-raw-sql/raw-queries) available in Prisma Client. While many use cases for raw SQL in Prisma Client are covered by [TypedSQL](/v6/orm/prisma-client/using-raw-sql/typedsql), using these legacy methods is still the recommended approach for working with `Unsupported` fields.
+This page builds on the [legacy raw query methods](/orm/v6/prisma-client/using-raw-sql/raw-queries) available in Prisma Client. While many use cases for raw SQL in Prisma Client are covered by [TypedSQL](/orm/v6/prisma-client/using-raw-sql/typedsql), using these legacy methods is still the recommended approach for working with `Unsupported` fields.
:::
@@ -36,7 +36,7 @@ To follow along, you will be expected to have:
At the time of writing, Prisma ORM does not support working with geographic data, specifically using [PostGIS](https://github.com/prisma/prisma/issues/2789).
-A model that has geographic data columns will be stored using the [`Unsupported`](/v6/orm/reference/prisma-schema-reference#unsupported) data type. Fields with `Unsupported` types are present in the generated Prisma Client and will be typed as `any`. A model with a required `Unsupported` type does not expose write operations such as `create`, and `update`.
+A model that has geographic data columns will be stored using the [`Unsupported`](/orm/v6/reference/prisma-schema-reference#unsupported) data type. Fields with `Unsupported` types are present in the generated Prisma Client and will be typed as `any`. A model with a required `Unsupported` type does not expose write operations such as `create`, and `update`.
Prisma Client supports write operations on models with a required `Unsupported` field using `$queryRaw` and `$executeRaw`. You can use Prisma Client extensions and SafeQL to improve the type-safety when working with geographical data in raw queries.
@@ -107,7 +107,7 @@ model PointOfInterest {
}
```
-You'll notice that the `location` field uses an [`Unsupported`](/v6/orm/reference/prisma-schema-reference#unsupported) type. This means that we lose a lot of the benefits of Prisma ORM when working with `PointOfInterest`. We'll be using [SafeQL](https://safeql.dev/) to fix this.
+You'll notice that the `location` field uses an [`Unsupported`](/orm/v6/reference/prisma-schema-reference#unsupported) type. This means that we lose a lot of the benefits of Prisma ORM when working with `PointOfInterest`. We'll be using [SafeQL](https://safeql.dev/) to fix this.
Like before, create and execute a migration using the `prisma migrate dev` command to create the `PointOfInterest` table in your database:
@@ -233,7 +233,7 @@ SafeQL is now fully configured to help you write better raw SQL using Prisma Cli
## 4. Creating extensions to make raw SQL queries type-safe
-In this section, we'll create two [`model`](/v6/orm/prisma-client/client-extensions/model) extensions with custom queries to be able to work conveniently with the `PointOfInterest` model:
+In this section, we'll create two [`model`](/orm/v6/prisma-client/client-extensions/model) extensions with custom queries to be able to work conveniently with the `PointOfInterest` model:
1. A `create` query that allows us to create new `PointOfInterest` records in the database
1. A `findClosestPoints` query that returns the `PointOfInterest` records that are closest to a given coordinate
diff --git a/apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/typedsql.mdx b/apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/typedsql.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/typedsql.mdx
rename to apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/typedsql.mdx
index 2c189c20e0..16eaa705d5 100644
--- a/apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/typedsql.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-client/using-raw-sql/typedsql.mdx
@@ -2,7 +2,7 @@
title: TypedSQL
description: Learn how to use TypedSQL to write fully type-safe SQL queries that are compatible with any SQL console and Prisma Client.
badge: preview
-url: /v6/orm/prisma-client/using-raw-sql/typedsql
+url: /orm/v6/prisma-client/using-raw-sql/typedsql
metaTitle: Writing Type-safe SQL with TypedSQL and Prisma Client
metaDescription: Learn how to use TypedSQL to write fully type-safe SQL queries that are compatible with any SQL console and Prisma Client.
---
@@ -33,7 +33,7 @@ To start using TypedSQL in your Prisma project, follow these steps:
:::tip[Using driver adapters with TypedSQL]
- If you are deploying Prisma in serverless or edge environments, you can use [driver adapters](/v6/orm/overview/databases/database-drivers#driver-adapters) to connect through JavaScript database drivers. Driver adapters are compatible with TypedSQL, with the exception of `@prisma/adapter-better-sqlite3`. For SQLite support, use [`@prisma/adapter-libsql`](https://www.npmjs.com/package/@prisma/adapter-libsql) instead. All other driver adapters are supported.
+ If you are deploying Prisma in serverless or edge environments, you can use [driver adapters](/orm/v6/overview/databases/database-drivers#driver-adapters) to connect through JavaScript database drivers. Driver adapters are compatible with TypedSQL, with the exception of `@prisma/adapter-better-sqlite3`. For SQLite support, use [`@prisma/adapter-libsql`](https://www.npmjs.com/package/@prisma/adapter-libsql) instead. All other driver adapters are supported.
:::
@@ -254,7 +254,7 @@ const columns = "name, email, age"; // Columns determined at runtime
const result = await prisma.$queryRawUnsafe(`SELECT ${columns} FROM Users WHERE active = true`);
```
-In this example, the columns to be selected are defined dynamically and included in the SQL query. While this approach provides flexibility, it requires careful attention to security, particularly to [avoid SQL injection vulnerabilities](/v6/orm/prisma-client/using-raw-sql/raw-queries#sql-injection-prevention). Additionally, using raw SQL queries means foregoing the type-safety and DX of TypedSQL.
+In this example, the columns to be selected are defined dynamically and included in the SQL query. While this approach provides flexibility, it requires careful attention to security, particularly to [avoid SQL injection vulnerabilities](/orm/v6/prisma-client/using-raw-sql/raw-queries#sql-injection-prevention). Additionally, using raw SQL queries means foregoing the type-safety and DX of TypedSQL.
## Acknowledgements
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/getting-started.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/getting-started.mdx
similarity index 94%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/getting-started.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/getting-started.mdx
index 977a425f82..c6bafb7f61 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/getting-started.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/getting-started.mdx
@@ -1,7 +1,7 @@
---
title: Getting started with Prisma Migrate
description: Learn how to migrate your schema in a development environment using Prisma Migrate.
-url: /v6/orm/prisma-migrate/getting-started
+url: /orm/v6/prisma-migrate/getting-started
metaTitle: Getting started with Prisma Migrate
metaDescription: Learn how to migrate your schema in a development environment using Prisma Migrate.
---
@@ -57,7 +57,7 @@ model Post {
:::tip
- You can use [native type mapping attributes](/v6/orm/prisma-migrate/workflows/native-database-types) in your schema to decide which exact database type to create (for example, `String` can map to `varchar(100)` or `text`).
+ You can use [native type mapping attributes](/orm/v6/prisma-migrate/workflows/native-database-types) in your schema to decide which exact database type to create (for example, `String` can map to `varchar(100)` or `text`).
:::
@@ -149,7 +149,7 @@ model Post {
└─ migration.sql
```
-You now have a migration history that you can [source control](/v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories#committing-the-migration-history-to-source-control) and use to [deploy changes to test environments and production](/v6/orm/prisma-migrate/workflows/development-and-production#production-and-testing-environments).
+You now have a migration history that you can [source control](/orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories#committing-the-migration-history-to-source-control) and use to [deploy changes to test environments and production](/orm/v6/prisma-migrate/workflows/development-and-production#production-and-testing-environments).
## Adding Prisma Migrate to an existing project
@@ -200,7 +200,7 @@ To create a baseline migration:
### Work around features not supported by Prisma Schema Language
-To include [unsupported database features](/v6/orm/prisma-migrate/workflows/unsupported-database-features) that already exist in the database, you must replace or modify the initial migration SQL:
+To include [unsupported database features](/orm/v6/prisma-migrate/workflows/unsupported-database-features) that already exist in the database, you must replace or modify the initial migration SQL:
1. Open the `migration.sql` file generated in the [Create a baseline migration](#create-a-baseline-migration) section.
1. Modify the generated SQL. For example:
@@ -242,5 +242,5 @@ Commit the following to source control:
## Going further
-- Refer to the [Deploying database changes with Prisma Migrate](/v6/orm/prisma-client/deployment/deploy-database-changes-with-prisma-migrate) guide for more on deploying migrations to production.
-- Refer to the [Production Troubleshooting](/v6/orm/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute) guide to learn how to debug and resolve failed migrations in production using `prisma migrate diff`, `prisma db execute` and/ or `prisma migrate resolve`.
+- Refer to the [Deploying database changes with Prisma Migrate](/orm/v6/prisma-client/deployment/deploy-database-changes-with-prisma-migrate) guide for more on deploying migrations to production.
+- Refer to the [Production Troubleshooting](/orm/v6/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute) guide to learn how to debug and resolve failed migrations in production using `prisma migrate diff`, `prisma db execute` and/ or `prisma migrate resolve`.
diff --git a/apps/docs/content/docs/orm/v6/prisma-migrate/meta.json b/apps/docs/content/docs/orm/v6/prisma-migrate/meta.json
new file mode 100644
index 0000000000..8550eacd81
--- /dev/null
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/meta.json
@@ -0,0 +1,10 @@
+{
+ "title": "Prisma Migrate",
+ "defaultOpen": true,
+ "pages": [
+ "index",
+ "getting-started",
+ "...understanding-prisma-migrate",
+ "workflows"
+ ]
+}
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/legacy-migrate.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/legacy-migrate.mdx
similarity index 94%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/legacy-migrate.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/legacy-migrate.mdx
index 8d26f1a0c1..04c8c8c558 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/legacy-migrate.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/legacy-migrate.mdx
@@ -2,27 +2,27 @@
title: Legacy Prisma Migrate
description: Legacy Prisma Migrate is a declarative data modeling and schema migration tool that is available via the Prisma CLI.
unlisted: true
-url: /v6/orm/prisma-migrate/understanding-prisma-migrate/legacy-migrate
+url: /orm/v6/prisma-migrate/understanding-prisma-migrate/legacy-migrate
metaTitle: Legacy Prisma Migrate
metaDescription: Legacy Prisma Migrate is a declarative data modeling and schema migration tool that is available via the Prisma CLI.
---
-> **Important!** This page documents legacy Prisma Migrate (Experimental) available in version 2.12.0 and earlier. [Prisma Migrate](/v6/orm/prisma-migrate/getting-started) is available in version [2.13.0](https://github.com/prisma/prisma/releases/tag/2.13.0) and Generally Available in [2.19.0](https://github.com/prisma/prisma/releases/tag/2.19.0).
+> **Important!** This page documents legacy Prisma Migrate (Experimental) available in version 2.12.0 and earlier. [Prisma Migrate](/orm/v6/prisma-migrate/getting-started) is available in version [2.13.0](https://github.com/prisma/prisma/releases/tag/2.13.0) and Generally Available in [2.19.0](https://github.com/prisma/prisma/releases/tag/2.19.0).
-Legacy Prisma Migrate is a tool that lets you _change your database schema_, e.g. by creating new tables or adding columns to existing tables. These changes are called _schema migrations_. legacy Prisma Migrate is available as part of the [Prisma CLI](/v6/orm/tools/prisma-cli#installation) via the `legacy Prisma Migrate` command.
+Legacy Prisma Migrate is a tool that lets you _change your database schema_, e.g. by creating new tables or adding columns to existing tables. These changes are called _schema migrations_. legacy Prisma Migrate is available as part of the [Prisma CLI](/orm/v6/tools/prisma-cli#installation) via the `legacy Prisma Migrate` command.
## Documentation
### Legacy Prisma Migrate vs the `db push` command
-If you want to prototype or iterate on a schema design in a development environment, consider the [`db push` command](/v6/orm/reference/prisma-cli-reference#db-push).
+If you want to prototype or iterate on a schema design in a development environment, consider the [`db push` command](/orm/v6/reference/prisma-cli-reference#db-push).
### Legacy Prisma Migrate vs SQL migrations
Legacy Prisma Migrate is a _declarative_ migration system, as opposed to SQL which can be considered _imperative_:
- **SQL (imperative)**: Provide the individual _steps_ to get from the current schema to the desired schema.
-- **legacy Prisma Migrate (declarative)**: Define the desired schema as a [Prisma schema data model](/v6/orm/prisma-schema/data-model/models) (legacy Prisma Migrate takes care of generating the necessary _steps_).
+- **legacy Prisma Migrate (declarative)**: Define the desired schema as a [Prisma schema data model](/orm/v6/prisma-schema/data-model/models) (legacy Prisma Migrate takes care of generating the necessary _steps_).
Here's a quick comparison. Assume you have the following scenario:
@@ -70,7 +70,7 @@ ADD COLUMN published BOOLEAN DEFAULT false;
#### legacy Prisma Migrate
-With legacy Prisma Migrate, you write the desired database schema in the form of a [Prisma schema data model](/v6/orm/prisma-schema/data-model/models) inside your [Prisma schema file](/v6/orm/prisma-schema/overview). To map the data model to your database schema, you then have to run these two commands:
+With legacy Prisma Migrate, you write the desired database schema in the form of a [Prisma schema data model](/orm/v6/prisma-schema/data-model/models) inside your [Prisma schema file](/orm/v6/prisma-schema/overview). To map the data model to your database schema, you then have to run these two commands:
```bash
prisma migrate save --experimental
@@ -102,7 +102,7 @@ prisma migrate up --experimental
##### 2. Create two new tables `Post` and `Profile` with foreign keys to `User`
-Add two models with [relation fields](/v6/orm/prisma-schema/data-model/relations#relation-fields) to your Prisma schema:
+Add two models with [relation fields](/orm/v6/prisma-schema/data-model/relations#relation-fields) to your Prisma schema:
```prisma
model User {
@@ -128,7 +128,7 @@ model Post {
}
```
-Notice that in addition to the [annotated relation fields](/v6/orm/prisma-schema/data-model/relations#annotated-relation-fields) and its relation scalar field (which represent the foreign keys), you must also specify the Prisma-level [relation fields](/v6/orm/prisma-schema/data-model/relations#relation-fields) on the other side of the relation.
+Notice that in addition to the [annotated relation fields](/orm/v6/prisma-schema/data-model/relations#annotated-relation-fields) and its relation scalar field (which represent the foreign keys), you must also specify the Prisma-level [relation fields](/orm/v6/prisma-schema/data-model/relations#relation-fields) on the other side of the relation.
Now run the two commands mentioned above:
@@ -139,7 +139,7 @@ prisma migrate up --experimental
##### 3. Add a new column with default value to the `Post` table
-Add a [field](/v6/orm/prisma-schema/data-model/models#defining-fields) to the `Post` model:
+Add a [field](/orm/v6/prisma-schema/data-model/models#defining-fields) to the `Post` model:
```prisma
model User {
@@ -194,7 +194,7 @@ The following table shows which SQL operations are currently supported by legacy
| Create indexes | `CREATE INDEX` | ✔️ |
| Cascading deletes | `ON DELETE` | No (workaround: manually add in SQL and introspect) |
| Cascading updates | `ON UPDATE` | No |
-| Data validation | `CHECK` | No ([workaround](/v6/orm/more/troubleshooting/check-constraints)) |
+| Data validation | `CHECK` | No ([workaround](/orm/v6/more/troubleshooting/check-constraints)) |
Note that this table assumes that the operation is also supported by the underlying database. For example, `ENUM` is not supported in SQLite. This means that you also can't use `enum` when using legacy Prisma Migrate.
@@ -219,7 +219,7 @@ The `_Migration` table additionally stores information about each migration that
With **legacy Prisma Migrate**, the workflow looks slightly different:
-1. Manually adjust your [Prisma schema data model](/v6/orm/prisma-schema/data-model/models)
+1. Manually adjust your [Prisma schema data model](/orm/v6/prisma-schema/data-model/models)
1. Migrate your database using the `legacy Prisma Migrate` CLI commands
1. (Re-)generate Prisma Client
1. Use Prisma Client in your application code to access your database
@@ -254,7 +254,7 @@ Saves a migration that defines the steps necessary to update your current schema
#### Prerequisites
-Before using the `migrate save` command, you must define a valid [`datasource`](/v6/orm/prisma-schema/overview/data-sources) within your `schema.prisma` file.
+Before using the `migrate save` command, you must define a valid [`datasource`](/orm/v6/prisma-schema/overview/data-sources) within your `schema.prisma` file.
For example, the following `datasource` defines a SQLite database file within the current directory:
@@ -322,7 +322,7 @@ Migrate the database up to a specific state.
#### Prerequisites
-Before using the `migrate up` command, you must define a valid [`datasource`](/v6/orm/prisma-schema/overview/data-sources) within your `schema.prisma` file.
+Before using the `migrate up` command, you must define a valid [`datasource`](/orm/v6/prisma-schema/overview/data-sources) within your `schema.prisma` file.
For example, the following `datasource` defines a SQLite database file within the current directory:
@@ -399,7 +399,7 @@ Migrate the database down to a specific state.
#### Prerequisites
-Before using the `migrate down` command, you must define a valid [`datasource`](/v6/orm/prisma-schema/overview/data-sources) within your `schema.prisma` file.
+Before using the `migrate down` command, you must define a valid [`datasource`](/orm/v6/prisma-schema/overview/data-sources) within your `schema.prisma` file.
For example, the following `datasource` defines a SQLite database file within the current directory:
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues.mdx
index 17c65cf12c..786f0bbb5a 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues.mdx
@@ -1,7 +1,7 @@
---
title: Limitations and known issues
description: 'Learn about current limitations and known issues with Prisma Migrate, including database provider constraints and migration file compatibility.'
-url: /v6/orm/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues
+url: /orm/v6/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues
metaTitle: Limitations and known issues
metaDescription: Limitations and known issues
---
@@ -46,7 +46,7 @@ The `prisma migrate dev` and `prisma migrate reset` commands are designed to be
When the database is reset, if Prisma Migrate detects a seed script in `package.json`, it will trigger seeding.
-> **Note**: For a simple and integrated way to re-create data when the database is reset, check out our [seeding guide](/v6/orm/prisma-migrate/workflows/seeding).
+> **Note**: For a simple and integrated way to re-create data when the database is reset, check out our [seeding guide](/orm/v6/prisma-migrate/workflows/seeding).
## Prisma Migrate and PgBouncer
@@ -57,7 +57,7 @@ Error: undefined: Database error
Error querying the database: db error: ERROR: prepared statement "s0" already exists
```
-See [Prisma Migrate and PgBouncer workaround](/v6/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer) for further information and a workaround. Follow [GitHub issue #6485](https://github.com/prisma/prisma/issues/6485) for updates.
+See [Prisma Migrate and PgBouncer workaround](/orm/v6/prisma-client/setup-and-configuration/databases-connections/pgbouncer) for further information and a workaround. Follow [GitHub issue #6485](https://github.com/prisma/prisma/issues/6485) for updates.
## Prisma Migrate in non-interactive environments
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/mental-model.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/mental-model.mdx
similarity index 94%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/mental-model.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/mental-model.mdx
index 6774c2fe51..5f66cdc85f 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/mental-model.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/mental-model.mdx
@@ -1,7 +1,7 @@
---
title: Mental model
description: A mental model guide for working with Prisma Migrate in your project
-url: /v6/orm/prisma-migrate/understanding-prisma-migrate/mental-model
+url: /orm/v6/prisma-migrate/understanding-prisma-migrate/mental-model
metaTitle: A mental model for Prisma Migrate
metaDescription: A mental model guide for working with Prisma Migrate in your project
---
@@ -93,7 +93,7 @@ This section describes how you can evolve your database schema in different envi
#### Track your migration history with `prisma migrate dev`
-The [`prisma migrate dev`](/v6/orm/reference/prisma-cli-reference#migrate-dev) command allows you to track the changes you make to your database. The `prisma migrate dev` command automatically generates SQL migration files (saved in `/prisma/migrations`) and applies them to the database. When a migration is applied to the database, the migrations table (`_prisma_migrations`) in your database is also updated.
+The [`prisma migrate dev`](/orm/v6/reference/prisma-cli-reference#migrate-dev) command allows you to track the changes you make to your database. The `prisma migrate dev` command automatically generates SQL migration files (saved in `/prisma/migrations`) and applies them to the database. When a migration is applied to the database, the migrations table (`_prisma_migrations`) in your database is also updated.

@@ -108,7 +108,7 @@ The `prisma migrate dev` command tracks the state of the database using the foll
You can customize migrations before you apply them to the database using the `--create-only` flag. For example, you might want to edit a migration if you want to rename columns without incurring any data loss or load database extensions (in PostgreSQL) and database views (currently not supported).
-Under the hood, Prisma Migrate uses a [shadow database](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database) to detect a [schema drift](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database#detecting-schema-drift) and generate new migrations.
+Under the hood, Prisma Migrate uses a [shadow database](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database) to detect a [schema drift](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database#detecting-schema-drift) and generate new migrations.
> **Note**: `prisma migrate dev` is intended to be used only in development with a disposable database.
@@ -126,7 +126,7 @@ If `prisma migrate dev` detects a schema drift or a migration history conflict,
A schema drift occurs when the expected database schema is different from what is in the migration history. For example, this can occur when you manually update the database schema without also updating the Prisma schema and `prisma/migrations` accordingly.
-For such instances, you can use the [`prisma migrate diff`](/v6/orm/reference/prisma-cli-reference#migrate-diff) command to compare your migration history and revert changes made to your database schema.
+For such instances, you can use the [`prisma migrate diff`](/orm/v6/reference/prisma-cli-reference#migrate-diff) command to compare your migration history and revert changes made to your database schema.

@@ -135,11 +135,11 @@ You can use `migrate diff` to generate the SQL that either:
- Reverts the changes made in the database schema to synchronize it with the current Prisma schema
- Moves your database schema forward to apply missing changes from the Prisma schema and `/migrations`
-You can then apply the changes to your database using [`prisma db execute`](/v6/orm/reference/prisma-cli-reference#db-execute) command.
+You can then apply the changes to your database using [`prisma db execute`](/orm/v6/reference/prisma-cli-reference#db-execute) command.
#### Prototype your schema
-The [`prisma db push`](/v6/orm/reference/prisma-cli-reference#db-push) command allows you to sync your Prisma schema and database schema without persisting a migration (`/prisma/migrations`). The `prisma db push` command tracks the state of the database using the following pieces of state:
+The [`prisma db push`](/orm/v6/reference/prisma-cli-reference#db-push) command allows you to sync your Prisma schema and database schema without persisting a migration (`/prisma/migrations`). The `prisma db push` command tracks the state of the database using the following pieces of state:
- the Prisma schema
- the database schema
@@ -154,13 +154,13 @@ The `prisma db push` command is useful when:
If the `prisma db push` command detects destructive change to your database schema, it will prompt you to reset your database. For example, this will happen when you add a required field to a table with existing content without providing a default value.
-> A [schema drift](/v6/orm/prisma-migrate/workflows/troubleshooting#schema-drift) occurs when your database schema is out of sync with your migrations history and migrations table.
+> A [schema drift](/orm/v6/prisma-migrate/workflows/troubleshooting#schema-drift) occurs when your database schema is out of sync with your migrations history and migrations table.
### Prisma Migrate in a staging and production environment
#### Sync your migration histories
-The [`prisma migrate deploy`](/v6/orm/reference/prisma-cli-reference#migrate-deploy) command allows you to sync your migration history from your development environment with your database in your **staging or production environment**.
+The [`prisma migrate deploy`](/orm/v6/reference/prisma-cli-reference#migrate-deploy) command allows you to sync your migration history from your development environment with your database in your **staging or production environment**.
Under the hood, the `migrate deploy` command:
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/meta.json b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories.mdx
similarity index 93%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories.mdx
index 08b0b6104f..aa4c102e69 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories.mdx
@@ -1,7 +1,7 @@
---
title: About migration histories
description: About migration histories
-url: /v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories
+url: /orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories
metaTitle: About migration histories
metaDescription: About migration histories
---
@@ -29,7 +29,7 @@ Your migration history is the story of the changes to your data model, and is re
- If an applied migration was deleted
- If an applied migration was changed
- If you change or delete a migration (**not** recommended), the next steps depend on whether you are in a [development environment](/v6/orm/prisma-migrate/workflows/development-and-production#development-environments) (and therefore using `migrate dev`) or a [production / testing environment](/v6/orm/prisma-migrate/workflows/development-and-production#production-and-testing-environments) (and therefore using `migrate deploy`).
+ If you change or delete a migration (**not** recommended), the next steps depend on whether you are in a [development environment](/orm/v6/prisma-migrate/workflows/development-and-production#development-environments) (and therefore using `migrate dev`) or a [production / testing environment](/orm/v6/prisma-migrate/workflows/development-and-production#production-and-testing-environments) (and therefore using `migrate deploy`).
## Do not edit or delete migrations that have been applied
@@ -62,9 +62,9 @@ If Prisma Migrate reports a missing or edited migration that has already been ap
## Committing the migration history to source control
-You must commit the entire `prisma/migrations` folder to source control. This includes the `prisma/migrations/migration_lock.toml` file, which is used to detect if you have [attempted to change providers](/v6/orm/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues#you-cannot-automatically-switch-database-providers).
+You must commit the entire `prisma/migrations` folder to source control. This includes the `prisma/migrations/migration_lock.toml` file, which is used to detect if you have [attempted to change providers](/orm/v6/prisma-migrate/understanding-prisma-migrate/limitations-and-known-issues#you-cannot-automatically-switch-database-providers).
Source-controlling the `schema.prisma` file is not enough - you must include your migration history. This is because:
-- As you start to [customize migrations](/v6/orm/prisma-migrate/workflows/development-and-production#customizing-migrations), your migration history contains **information that cannot be represented in the Prisma schema**. For example, you can customize a migration to mitigate data loss that would be caused by a breaking change.
+- As you start to [customize migrations](/orm/v6/prisma-migrate/workflows/development-and-production#customizing-migrations), your migration history contains **information that cannot be represented in the Prisma schema**. For example, you can customize a migration to mitigate data loss that would be caused by a breaking change.
- The `prisma migrate deploy` command, which is used to deploy changes to staging, testing, and production environments, _only_ runs migration files. It does not use the Prisma schema to fetch the models.
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/overview.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/overview.mdx
similarity index 65%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/overview.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/overview.mdx
index 19b6fbaf0a..3eb6f71c98 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/overview.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/overview.mdx
@@ -1,7 +1,7 @@
---
title: Overview on Prisma Migrate
description: Learn everything you need to know about Prisma Migrate.
-url: /v6/orm/prisma-migrate/understanding-prisma-migrate/overview
+url: /orm/v6/prisma-migrate/understanding-prisma-migrate/overview
metaTitle: Overview on Prisma Migrate
metaDescription: Learn everything you need to know about Prisma Migrate.
---
@@ -10,26 +10,26 @@ metaDescription: Learn everything you need to know about Prisma Migrate.
:::info
-**Does not apply for MongoDB** Instead of `migrate dev` and related commands, use [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) for [MongoDB](/v6/orm/overview/databases/mongodb).
+**Does not apply for MongoDB** Instead of `migrate dev` and related commands, use [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) for [MongoDB](/orm/v6/overview/databases/mongodb).
:::
Prisma Migrate enables you to:
-- Keep your database schema in sync with your [Prisma schema](/v6/orm/prisma-schema/overview) as it evolves _and_
+- Keep your database schema in sync with your [Prisma schema](/orm/v6/prisma-schema/overview) as it evolves _and_
- Maintain existing data in your database
-Prisma Migrate generates [a history of `.sql` migration files](/v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories), and plays a role in both [development and production](/v6/orm/prisma-migrate/workflows/development-and-production).
+Prisma Migrate generates [a history of `.sql` migration files](/orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories), and plays a role in both [development and production](/orm/v6/prisma-migrate/workflows/development-and-production).
Prisma Migrate can be considered a _hybrid_ database schema migration tool, meaning it has both of _declarative_ and _imperative_ elements:
-- Declarative: The data model is described in a declarative way in the [Prisma schema](/v6/orm/prisma-schema/overview). Prisma Migrate generates SQL migration files from that data model.
+- Declarative: The data model is described in a declarative way in the [Prisma schema](/orm/v6/prisma-schema/overview). Prisma Migrate generates SQL migration files from that data model.
- Imperative: All generated SQL migration files are fully customizable. Prisma Migrate hence provides the flexibility of an imperative migration tool by enabling you to modify what and how migrations are executed (and allows you to run custom SQL to e.g. make use of native database feature, perform data migrations, ...).
:::tip
-If you are prototyping, consider using the [`db push`](/v6/orm/reference/prisma-cli-reference#db-push) command - see [Schema prototyping with `db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) for examples.
+If you are prototyping, consider using the [`db push`](/orm/v6/reference/prisma-cli-reference#db-push) command - see [Schema prototyping with `db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) for examples.
:::
-See the [Prisma Migrate reference](/v6/orm/reference/prisma-cli-reference#prisma-migrate) for detailed information about the Prisma Migrate CLI commands.
+See the [Prisma Migrate reference](/orm/v6/reference/prisma-cli-reference#prisma-migrate) for detailed information about the Prisma Migrate CLI commands.
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database.mdx
similarity index 96%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database.mdx
index 7f8b818bb5..5dfb674413 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database.mdx
@@ -1,14 +1,14 @@
---
title: About the shadow database
description: About the shadow database
-url: /v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database
+url: /orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database
metaTitle: About the shadow database
metaDescription: About the shadow database
---
The shadow database is a second, _temporary_ database that is **created and deleted automatically**\* each time you run `prisma migrate dev` and is primarily used to **detect problems** such as schema drift or potential data loss of the generated migration.
-[`migrate diff` command](/v6/orm/reference/prisma-cli-reference#migrate-diff) also requires a shadow database when diffing against a local `migrations` directory with `--from-migrations` or `--to-migrations`.
+[`migrate diff` command](/orm/v6/reference/prisma-cli-reference#migrate-diff) also requires a shadow database when diffing against a local `migrations` directory with `--from-migrations` or `--to-migrations`.
- If your database does not allow creation and deleting of databases (e.g. in a cloud-hosted environment), you need to [create and configure the shadow database manually](#cloud-hosted-shadow-databases-must-be-created-manually).
@@ -43,7 +43,7 @@ When you run `prisma migrate dev` to create a new migration, Prisma Migrate uses
To detect drift in development, Prisma Migrate:
-1. Creates a fresh copy of the shadow database (or performs a soft reset if the shadow database is configured via [`shadowDatabaseUrl`](/v6/orm/reference/prisma-schema-reference#datasource))
+1. Creates a fresh copy of the shadow database (or performs a soft reset if the shadow database is configured via [`shadowDatabaseUrl`](/orm/v6/reference/prisma-schema-reference#datasource))
1. Reruns the **current**, existing migration history in the shadow database.
1. **Introspects** the shadow database to generate the 'current state' of your Prisma schema.
1. Compares the end state of the current migration history to the development database.
@@ -70,7 +70,7 @@ Assuming Prisma Migrate did not [detect schema drift](#detecting-schema-drift),
1. Renders these steps to a SQL string and saves it in the new migration file.
1. Evaluate data loss caused by the SQL and warns about that.
1. Applies the generated migration to the development database (assuming you have not specified the `--create-only` flag)
-1. Drops the shadow database (shadow databases configured via [`shadowDatabaseUrl`](/v6/orm/reference/prisma-schema-reference#datasource) are not dropped, but are reset at the start of the `migrate dev` command)
+1. Drops the shadow database (shadow databases configured via [`shadowDatabaseUrl`](/orm/v6/reference/prisma-schema-reference#datasource) are not dropped, but are reset at the start of the `migrate dev` command)
## Manually configuring the shadow database
@@ -165,6 +165,6 @@ To resolve this error:
- If you are working locally, we recommend that you update the database user's privileges.
- If you are developing against a database that does not allow creating and dropping databases (for any reason) see [Manually configuring the shadow database](#manually-configuring-the-shadow-database)
- If you are developing against a cloud-based database (for example, on Heroku, Digital Ocean, or Vercel Postgres) see: [Cloud-hosted shadow databases](#cloud-hosted-shadow-databases-must-be-created-manually).
-- If you are developing against a cloud-based database (for example, on Heroku, Digital Ocean, or Vercel Postgres) and are currently **prototyping** such that you don't care about generated migration files and only need to apply your Prisma schema to the database schema, you can run [`prisma db push`](/v6/orm/reference/prisma-cli-reference#db) instead of the `prisma migrate dev` command.
+- If you are developing against a cloud-based database (for example, on Heroku, Digital Ocean, or Vercel Postgres) and are currently **prototyping** such that you don't care about generated migration files and only need to apply your Prisma schema to the database schema, you can run [`prisma db push`](/orm/v6/reference/prisma-cli-reference#db) instead of the `prisma migrate dev` command.
> **Important**: The shadow database is _only_ required in a development environment (specifically for the `prisma migrate dev` command) - you **do not** need to make any changes to your production environment.
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/baselining.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/baselining.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/baselining.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/baselining.mdx
index 36d829ce74..bed73fef02 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/baselining.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/baselining.mdx
@@ -1,7 +1,7 @@
---
title: Baselining a database
description: How to initialize a migration history for an existing database that contains important data.
-url: /v6/orm/prisma-migrate/workflows/baselining
+url: /orm/v6/prisma-migrate/workflows/baselining
metaTitle: Baselining a database
metaDescription: How to initialize a migration history for an existing database that contains important data.
---
@@ -15,12 +15,12 @@ Baselining tells Prisma Migrate to assume that one or more migrations have **alr
> **Note**: We assume it is acceptable to reset and seed development databases.
-Baselining is part of [adding Prisma Migrate to a project with an existing database](/v6/orm/prisma-migrate/getting-started#adding-prisma-migrate-to-an-existing-project).
+Baselining is part of [adding Prisma Migrate to a project with an existing database](/orm/v6/prisma-migrate/getting-started#adding-prisma-migrate-to-an-existing-project).
:::warning
This guide **does not apply for MongoDB**.
-Instead of `migrate deploy`, [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/v6/orm/overview/databases/mongodb).
+Instead of `migrate deploy`, [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/orm/v6/overview/databases/mongodb).
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/customizing-migrations.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/customizing-migrations.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/customizing-migrations.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/customizing-migrations.mdx
index 70435a381a..093d07e408 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/customizing-migrations.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/customizing-migrations.mdx
@@ -1,7 +1,7 @@
---
title: Customizing migrations
description: How to edit a migration file before applying it to avoid data loss in production.
-url: /v6/orm/prisma-migrate/workflows/customizing-migrations
+url: /orm/v6/prisma-migrate/workflows/customizing-migrations
metaTitle: Customizing migrations
metaDescription: How to edit a migration file before applying it to avoid data loss in production.
---
@@ -9,7 +9,7 @@ metaDescription: How to edit a migration file before applying it to avoid data l
:::warning
This guide **does not apply for MongoDB**.
-Instead of `migrate dev`, [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/v6/orm/overview/databases/mongodb).
+Instead of `migrate dev`, [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/orm/v6/overview/databases/mongodb).
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/data-migration.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/data-migration.mdx
similarity index 58%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/data-migration.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/data-migration.mdx
index 2dfbc8f02a..94bdaae55d 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/data-migration.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/data-migration.mdx
@@ -1,9 +1,9 @@
---
title: Data migrations
description: How to migrate data using Prisma ORM with the expand and contract pattern.
-url: /v6/orm/prisma-migrate/workflows/data-migration
+url: /orm/v6/prisma-migrate/workflows/data-migration
metaTitle: Data migrations
metaDescription: How to migrate data using Prisma ORM with the expand and contract pattern.
---
-This guide has been moved to our new [guides section](/v6/guides/data-migration). You can find the guide there.
+This guide has been moved to our new [guides section](/guides/database/data-migration). You can find the guide there.
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/development-and-production.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/development-and-production.mdx
similarity index 86%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/development-and-production.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/development-and-production.mdx
index eea91d316d..be4750ccd7 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/development-and-production.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/development-and-production.mdx
@@ -1,7 +1,7 @@
---
title: Development and production
description: Development and production
-url: /v6/orm/prisma-migrate/workflows/development-and-production
+url: /orm/v6/prisma-migrate/workflows/development-and-production
metaTitle: Development and production
metaDescription: Development and production
---
@@ -26,7 +26,7 @@ npx prisma migrate dev
This command:
-1. Reruns the existing migration history in the [shadow database](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database) in order to detect schema drift (edited or deleted migration file, or a manual changes to the database schema)
+1. Reruns the existing migration history in the [shadow database](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database) in order to detect schema drift (edited or deleted migration file, or a manual changes to the database schema)
1. Applies pending migrations to the shadow database (for example, new migrations created by colleagues)
1. If it detects changes to the Prisma schema, it generates a new migration from these changes
1. Applies all unapplied migrations to the development database and updates the `_prisma_migrations` table
@@ -34,7 +34,7 @@ This command:
The `migrate dev` command will prompt you to reset the database in the following scenarios:
-- Migration history conflicts caused by [modified or missing migrations](/v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories#do-not-edit-or-delete-migrations-that-have-been-applied)
+- Migration history conflicts caused by [modified or missing migrations](/orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories#do-not-edit-or-delete-migrations-that-have-been-applied)
- The database schema has drifted away from the end-state of the migration history
### Reset the development database
@@ -60,15 +60,15 @@ This command:
¹ For MySQL and MongoDB this refers to the database, for PostgreSQL and SQL Server to the schema, and for SQLite to the database file.
-> **Note**: For a simple and integrated way to re-create data in your development database as often as needed, check out our [seeding guide](/v6/orm/prisma-migrate/workflows/seeding).
+> **Note**: For a simple and integrated way to re-create data in your development database as often as needed, check out our [seeding guide](/orm/v6/prisma-migrate/workflows/seeding).
### Customizing migrations
Sometimes, you need to modify a migration **before applying it**. For example:
- You want to introduce a significant refactor, such as changing blog post tags from a `String[]` to a `Tag[]`
-- You want to [rename a field](/v6/orm/prisma-migrate/workflows/customizing-migrations#example-rename-a-field) (by default, Prisma Migrate will drop the existing field)
-- You want to [change the direction of a 1-1 relationship](/v6/orm/prisma-migrate/workflows/customizing-migrations#example-change-the-direction-of-a-1-1-relation)
+- You want to [rename a field](/orm/v6/prisma-migrate/workflows/customizing-migrations#example-rename-a-field) (by default, Prisma Migrate will drop the existing field)
+- You want to [change the direction of a 1-1 relationship](/orm/v6/prisma-migrate/workflows/customizing-migrations#example-change-the-direction-of-a-1-1-relation)
- You want to add features that cannot be represented in Prisma Schema Language - such as a partial index or a stored procedure.
The `--create-only` command allows you to create a migration without applying it:
@@ -79,11 +79,11 @@ npx prisma migrate dev --create-only
To apply the edited migration, run `prisma migrate dev` again.
-Refer to [Customizing migrations](/v6/orm/prisma-migrate/workflows/customizing-migrations) for examples.
+Refer to [Customizing migrations](/orm/v6/prisma-migrate/workflows/customizing-migrations) for examples.
### Team development
-See: [Team development with Prisma Migrate](/v6/orm/prisma-migrate/workflows/team-development) .
+See: [Team development with Prisma Migrate](/orm/v6/prisma-migrate/workflows/team-development) .
## Production and testing environments
@@ -115,8 +115,8 @@ The `migrate deploy` command:
See also:
-- [Prisma Migrate in deployment](/v6/orm/prisma-client/deployment/deploy-database-changes-with-prisma-migrate)
-- [Production troubleshooting](/v6/orm/prisma-migrate/workflows/patching-and-hotfixing)
+- [Prisma Migrate in deployment](/orm/v6/prisma-client/deployment/deploy-database-changes-with-prisma-migrate)
+- [Production troubleshooting](/orm/v6/prisma-migrate/workflows/patching-and-hotfixing)
### Advisory locking
@@ -136,4 +136,4 @@ Advisory locking has a **10 second timeout** (not configurable), and uses the de
Prisma Migrate's implementation of advisory locking is purely to avoid catastrophic errors - if your command times out, you will need to run it again.
-Since `5.3.0`, the advisory locking can be disabled using the [`PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK` environment variable](/v6/orm/reference/environment-variables-reference#prisma_schema_disable_advisory_lock)
+Since `5.3.0`, the advisory locking can be disabled using the [`PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK` environment variable](/orm/v6/reference/environment-variables-reference#prisma_schema_disable_advisory_lock)
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/generating-down-migrations.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/generating-down-migrations.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/generating-down-migrations.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/generating-down-migrations.mdx
index ddf117fc08..1203893d27 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/generating-down-migrations.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/generating-down-migrations.mdx
@@ -1,18 +1,18 @@
---
title: Generating down migrations
description: How to generate down migrations
-url: /v6/orm/prisma-migrate/workflows/generating-down-migrations
+url: /orm/v6/prisma-migrate/workflows/generating-down-migrations
metaTitle: Generating down migrations
metaDescription: How to generate down migrations
---
-This guide describes how to generate a down migration SQL file that reverses a given [migration file](/v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories).
+This guide describes how to generate a down migration SQL file that reverses a given [migration file](/orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories).
## About down migrations
When generating a migration SQL file, you may wish to also create a "down migration" SQL file that reverses the schema changes in the corresponding "up migration" file. Note that "down migrations" are also sometimes called "migration rollbacks".
-This guide explains how to use Prisma Migrate's [`migrate diff` command](/v6/orm/reference/prisma-cli-reference#migrate-diff) to create a down migration, and how to apply it to your production database with the [`db execute`](/v6/orm/reference/prisma-cli-reference#db-execute) command in the case of a failed up migration.
+This guide explains how to use Prisma Migrate's [`migrate diff` command](/orm/v6/reference/prisma-cli-reference#migrate-diff) to create a down migration, and how to apply it to your production database with the [`db execute`](/orm/v6/reference/prisma-cli-reference#db-execute) command in the case of a failed up migration.
:::warning
@@ -34,7 +34,7 @@ When generating a down migration file, there are some considerations to be aware
- The down migration will revert your database schema, but other changes to data and application code that are carried out as part of the up migration will not be reverted. For example, if you have a script that changes data during the migration, this data will not be changed back when you run the down migration.
- You will not be able to use `migrate diff` to revert manually changed or added SQL in your migration files. If you have any custom additions, such as a view or trigger, you will need to:
- Create the down migration following [the instructions below](#how-to-generate-and-run-down-migrations)
- - Create the up migration using [`migrate dev --create-only`](/v6/orm/reference/prisma-cli-reference#options-6), so that it can be edited before it is applied to the database
+ - Create the up migration using [`migrate dev --create-only`](/orm/v6/reference/prisma-cli-reference#options-6), so that it can be edited before it is applied to the database
- Manually add your custom SQL to the up migration (e.g. adding a view)
- Manually add the inverted custom SQL to the down migration (e.g. dropping the view)
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/meta.json b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/native-database-functions.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/native-database-functions.mdx
similarity index 89%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/native-database-functions.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/native-database-functions.mdx
index 6c51b84182..1f4f9b76d0 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/native-database-functions.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/native-database-functions.mdx
@@ -1,22 +1,22 @@
---
title: Native database functions
description: How to enable PostgreSQL native database functions for projects that use Prisma Migrate.
-url: /v6/orm/prisma-migrate/workflows/native-database-functions
+url: /orm/v6/prisma-migrate/workflows/native-database-functions
metaTitle: Native database functions
metaDescription: How to enable PostgreSQL native database functions for projects that use Prisma Migrate.
---
-In PostgreSQL, some [native database functions](/v6/orm/prisma-schema/data-model/unsupported-database-features#native-database-functions) are part of optional extensions. For example, in PostgreSQL versions 12.13 and earlier the `gen_random_uuid()` function is part of the [`pgcrypto`](https://www.postgresql.org/docs/10/pgcrypto.html) extension.
+In PostgreSQL, some [native database functions](/orm/v6/prisma-schema/data-model/unsupported-database-features#native-database-functions) are part of optional extensions. For example, in PostgreSQL versions 12.13 and earlier the `gen_random_uuid()` function is part of the [`pgcrypto`](https://www.postgresql.org/docs/10/pgcrypto.html) extension.
To use a PostgreSQL extension, you must install it on the file system of your database server and then activate the extension. If you use Prisma Migrate, this must be done as part of a migration.
:::warning
-Do not activate extensions outside a migration file if you use Prisma Migrate. The [shadow database](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database) requires the same extensions. Prisma Migrate creates and deletes the shadow database automatically, so the only way to activate an extension is to include it in a migration file.
+Do not activate extensions outside a migration file if you use Prisma Migrate. The [shadow database](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database) requires the same extensions. Prisma Migrate creates and deletes the shadow database automatically, so the only way to activate an extension is to include it in a migration file.
:::
-In Prisma ORM versions 4.5.0 and later, you can activate the extension by declaring it in your Prisma schema with the [`postgresqlExtensions` preview feature](/v6/orm/prisma-schema/postgresql-extensions):
+In Prisma ORM versions 4.5.0 and later, you can activate the extension by declaring it in your Prisma schema with the [`postgresqlExtensions` preview feature](/orm/v6/prisma-schema/postgresql-extensions):
```prisma title="schema.prisma" highlight=3,9;add showLineNumbers
generator client {
@@ -31,13 +31,13 @@ datasource db {
}
```
-You can then apply these changes to your database with Prisma Migrate. See [How to migrate PostgreSQL extensions](/v6/orm/prisma-schema/postgresql-extensions) for details.
+You can then apply these changes to your database with Prisma Migrate. See [How to migrate PostgreSQL extensions](/orm/v6/prisma-schema/postgresql-extensions) for details.
In earlier versions of Prisma ORM, you must instead add a SQL command to your migration file to activate the extension. See [How to install a PostgreSQL extension as part of a migration](#how-to-install-a-postgresql-extension-as-part-of-a-migration).
## How to install a PostgreSQL extension as part of a migration
-This section describes how to add a SQL command to a migration file to activate a PostgreSQL extension. If you manage PostgreSQL extensions in your Prisma Schema with the `postgresqlExtensions` preview feature instead, see [How to migrate PostgreSQL extensions](/v6/orm/prisma-schema/postgresql-extensions).
+This section describes how to add a SQL command to a migration file to activate a PostgreSQL extension. If you manage PostgreSQL extensions in your Prisma Schema with the `postgresqlExtensions` preview feature instead, see [How to migrate PostgreSQL extensions](/orm/v6/prisma-schema/postgresql-extensions).
The following example demonstrates how to install the `pgcrypto` extension as part of a migration:
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/native-database-types.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/native-database-types.mdx
similarity index 80%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/native-database-types.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/native-database-types.mdx
index 41f0db4022..50471778b5 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/native-database-types.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/native-database-types.mdx
@@ -1,21 +1,21 @@
---
title: Native database types
description: Native database types
-url: /v6/orm/prisma-migrate/workflows/native-database-types
+url: /orm/v6/prisma-migrate/workflows/native-database-types
metaTitle: Native database types
metaDescription: Native database types
---
-Prisma Migrate translates the model defined in your [Prisma schema](/v6/orm/prisma-schema/overview) into features in your database.
+Prisma Migrate translates the model defined in your [Prisma schema](/orm/v6/prisma-schema/overview) into features in your database.

-Every¹ feature in your [data model](/v6/orm/prisma-schema/data-model/models) maps to a corresponding feature in the underlying database. **If you can define a feature in the Prisma schema, it is supported by Prisma Migrate.**
+Every¹ feature in your [data model](/orm/v6/prisma-schema/data-model/models) maps to a corresponding feature in the underlying database. **If you can define a feature in the Prisma schema, it is supported by Prisma Migrate.**
For a complete list of Prisma schema features, refer to:
-- [Database features matrix](/v6/orm/reference/database-features) for a list of database features and what they map to in the Prisma schema.
-- [Prisma schema reference](/v6/orm/reference/prisma-schema-reference) for a list of all Prisma schema features, including field types, attributes, and functions.
+- [Database features matrix](/orm/v6/reference/database-features) for a list of database features and what they map to in the Prisma schema.
+- [Prisma schema reference](/orm/v6/reference/prisma-schema-reference) for a list of all Prisma schema features, including field types, attributes, and functions.
Prisma Migrate also supports mapping each field to a [specific native type](#mapping-fields-to-a-specific-native-type), and there are ways to [include features without a Prisma schema equivalent in your database](#handling-unsupported-database-features).
@@ -27,7 +27,7 @@ Comments and Prisma ORM-level functions (`uuid()` and `cuid()`) do not map to da
## Mapping fields to a specific native type
-Each Prisma ORM type maps to a default underlying database type - for example, the PostgreSQL connector maps `String` to `text` by default. [Native database type attributes](/v6/orm/prisma-schema/data-model/models#native-types-mapping) determines which _specific_ native type should be created in the database.
+Each Prisma ORM type maps to a default underlying database type - for example, the PostgreSQL connector maps `String` to `text` by default. [Native database type attributes](/orm/v6/prisma-schema/data-model/models#native-types-mapping) determines which _specific_ native type should be created in the database.
:::info
@@ -81,21 +81,21 @@ ALTER TABLE "Post" ADD FOREIGN KEY("authorId") REFERENCES "User"("id") ON DELETE
### Mappings by Prisma ORM type
-For type mappings organized by Prisma ORM type, refer to the [Prisma schema reference](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types) documentation.
+For type mappings organized by Prisma ORM type, refer to the [Prisma schema reference](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types) documentation.
### Mappings by database provider
For type mappings organized by database provider, see:
-- [PostgreSQL mappings](/v6/orm/overview/databases/postgresql#type-mapping-between-postgresql-and-prisma-schema)
-- [MySQL mappings](/v6/orm/overview/databases/mysql#native-type-mappings)
-- [Microsoft SQL Server mappings](/v6/orm/overview/databases/sql-server#type-mapping-between-microsoft-sql-server-to-prisma-schema)
-- [SQLite mappings](/v6/orm/overview/databases/sqlite#type-mapping-between-sqlite-to-prisma-schema)
+- [PostgreSQL mappings](/orm/v6/overview/databases/postgresql#type-mapping-between-postgresql-and-prisma-schema)
+- [MySQL mappings](/orm/v6/overview/databases/mysql#native-type-mappings)
+- [Microsoft SQL Server mappings](/orm/v6/overview/databases/sql-server#type-mapping-between-microsoft-sql-server-to-prisma-schema)
+- [SQLite mappings](/orm/v6/overview/databases/sqlite#type-mapping-between-sqlite-to-prisma-schema)
## Handling unsupported database features
Prisma Migrate cannot automatically create database features that have no equivalent in Prisma Schema Language (PSL). For example, there is currently no way to define a stored procedure or a partial index in PSL. However, there are ways to add unsupported features to your database with Prisma Migrate:
-- [Handle unsupported field types](/v6/orm/prisma-schema/data-model/unsupported-database-features#unsupported-field-types) (like `circle`)
-- [Handle unsupported features](/v6/orm/prisma-schema/data-model/unsupported-database-features#unsupported-database-features), like stored procedures
-- [How to use native database functions](/v6/orm/prisma-schema/data-model/unsupported-database-features#native-database-functions)
+- [Handle unsupported field types](/orm/v6/prisma-schema/data-model/unsupported-database-features#unsupported-field-types) (like `circle`)
+- [Handle unsupported features](/orm/v6/prisma-schema/data-model/unsupported-database-features#unsupported-database-features), like stored procedures
+- [How to use native database functions](/orm/v6/prisma-schema/data-model/unsupported-database-features#native-database-functions)
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/patching-and-hotfixing.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/patching-and-hotfixing.mdx
similarity index 96%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/patching-and-hotfixing.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/patching-and-hotfixing.mdx
index 21e8411691..e74ca4170d 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/patching-and-hotfixing.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/patching-and-hotfixing.mdx
@@ -1,7 +1,7 @@
---
title: Patching & hotfixing
description: How to reconcile the migration history after applying a hotfix or patch to a production environment.
-url: /v6/orm/prisma-migrate/workflows/patching-and-hotfixing
+url: /orm/v6/prisma-migrate/workflows/patching-and-hotfixing
metaTitle: Patching & hotfixing
metaDescription: How to reconcile the migration history after applying a hotfix or patch to a production environment.
---
@@ -13,7 +13,7 @@ Patching the production database directly results in **schema drift**: your data
:::warning
This guide **does not apply for MongoDB**.
-Instead of `migrate dev`, [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/v6/orm/overview/databases/mongodb).
+Instead of `migrate dev`, [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/orm/v6/overview/databases/mongodb).
:::
@@ -58,7 +58,7 @@ To reconcile your migration history and database schema in production:
A migration might fail if:
-- You [modify a migration before running it](/v6/orm/prisma-migrate/workflows/customizing-migrations) and introduce a syntax error
+- You [modify a migration before running it](/orm/v6/prisma-migrate/workflows/customizing-migrations) and introduce a syntax error
- You add a mandatory (`NOT NULL`) column to a table that already has data
- The migration process stopped unexpectedly
- The database shut down in the middle of the migration process
@@ -116,8 +116,8 @@ The following example demonstrates how to manually complete the steps of a migra
To help with fixing a failed migration, Prisma ORM provides the following commands for creating and executing a migration file:
-- [`prisma migrate diff`](/v6/orm/reference/prisma-cli-reference#migrate-diff) which diffs two database schema sources to create a migration taking one to the state of the second. You can output either a summary of the difference or a sql script. The script can be output into a file via `> file_name.sql` or be piped to the `db execute --stdin` command.
-- [`prisma db execute`](/v6/orm/reference/prisma-cli-reference#db-execute) which applies a SQL script to the database without interacting with the Prisma migrations table.
+- [`prisma migrate diff`](/orm/v6/reference/prisma-cli-reference#migrate-diff) which diffs two database schema sources to create a migration taking one to the state of the second. You can output either a summary of the difference or a sql script. The script can be output into a file via `> file_name.sql` or be piped to the `db execute --stdin` command.
+- [`prisma db execute`](/orm/v6/reference/prisma-cli-reference#db-execute) which applies a SQL script to the database without interacting with the Prisma migrations table.
These commands are available in Preview in versions `3.9.0` and later (with the `--preview-feature` CLI flag), and generally available in versions `3.13.0` and later.
@@ -275,4 +275,4 @@ Error: undefined: Database error
Error querying the database: db error: ERROR: prepared statement "s0" already exists
```
-See [Prisma Migrate and PgBouncer workaround](/v6/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer) for further information and a workaround. Follow [GitHub issue #6485](https://github.com/prisma/prisma/issues/6485) for updates.
+See [Prisma Migrate and PgBouncer workaround](/orm/v6/prisma-client/setup-and-configuration/databases-connections/pgbouncer) for further information and a workaround. Follow [GitHub issue #6485](https://github.com/prisma/prisma/issues/6485) for updates.
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/prototyping-your-schema.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/prototyping-your-schema.mdx
similarity index 94%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/prototyping-your-schema.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/prototyping-your-schema.mdx
index 507ca43b5c..dc4483a0c1 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/prototyping-your-schema.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/prototyping-your-schema.mdx
@@ -2,12 +2,12 @@
title: Prototyping your schema
description: Prototyping your schema
codeStyle: false
-url: /v6/orm/prisma-migrate/workflows/prototyping-your-schema
+url: /orm/v6/prisma-migrate/workflows/prototyping-your-schema
metaTitle: Prototyping your schema
metaDescription: Prototyping your schema
---
-The Prisma CLI has a dedicated command for prototyping schemas: [`db push`](/v6/orm/reference/prisma-cli-reference#db-push)
+The Prisma CLI has a dedicated command for prototyping schemas: [`db push`](/orm/v6/reference/prisma-cli-reference#db-push)
`db push` uses the same engine as Prisma Migrate to synchronize your Prisma schema with your database schema. The `db push` command:
@@ -20,7 +20,7 @@ The Prisma CLI has a dedicated command for prototyping schemas: [`db push`](/v6/
> **Notes**:
>
> - `db push` does not interact with or rely on migrations. The migrations table `_prisma_migrations` will not be created or updated, and no migration files will be generated.
-> - When working with PlanetScale, we recommend that you use `db push` instead of `migrate`. For details refer to our Getting started documentation, either [Start from scratch guide](/v6/prisma-orm/quickstart/planetscale) or [Add to existing project guide](/v6/prisma-orm/add-to-existing-project/planetscale) depending on your situation.
+> - When working with PlanetScale, we recommend that you use `db push` instead of `migrate`. For details refer to our Getting started documentation, either [Start from scratch guide](/prisma-orm/quickstart/planetscale) or [Add to existing project guide](/prisma-orm/add-to-existing-project/planetscale) depending on your situation.
## Choosing `db push` or Prisma Migrate
@@ -30,18 +30,18 @@ The Prisma CLI has a dedicated command for prototyping schemas: [`db push`](/v6/
- You are prioritizing reaching a **desired end-state** and not the changes or steps executed to reach that end-state (there is no way to preview changes made by `db push`)
- You do not need to control how schema changes impact data. There is no way to orchestrate schema and data migrations—if `db push` anticipates that changes will result in data loss, you can either accept data loss with the `--accept-data-loss` option or stop the process. There is no way to customize the changes.
-See [Schema prototyping with `db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) for an example of how to use `db push` in this way.
+See [Schema prototyping with `db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) for an example of how to use `db push` in this way.
`db push` is **not recommended** if:
- You want to replicate your schema changes in other environments without losing data. You can use `db push` for prototyping, but you should use migrations to commit the schema changes and apply these in your other environments.
-- You want fine-grained control over how the schema changes are executed - for example, [renaming a column instead of dropping it and creating a new one](/v6/orm/prisma-migrate/workflows/customizing-migrations#example-rename-a-field).
+- You want fine-grained control over how the schema changes are executed - for example, [renaming a column instead of dropping it and creating a new one](/orm/v6/prisma-migrate/workflows/customizing-migrations#example-rename-a-field).
- You want to keep track of changes made to the database schema over time. `db push` does not create any artifacts that allow you to keep track of these changes.
- You want the schema changes to be reversible. You can use `db push` again to revert to the original state, but this might result in data loss.
## Can I use Prisma Migrate and `db push` together?
-Yes, you can [use `db push` and Prisma Migrate together in your development workflow](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) . For example, you can:
+Yes, you can [use `db push` and Prisma Migrate together in your development workflow](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) . For example, you can:
- Use `db push` to prototype a schema at the start of a project and initialize a migration history when you are happy with the first draft
- Use `db push` to prototype a change to an existing schema, then run `prisma migrate dev` to generate a migration from your changes (you will be asked to reset)
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/seeding.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/seeding.mdx
similarity index 99%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/seeding.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/seeding.mdx
index 6dc419a9a3..0b606f8a43 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/seeding.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/seeding.mdx
@@ -1,7 +1,7 @@
---
title: Seeding
description: Learn how to seed your database using Prisma ORM's integrated seeding functionality and Prisma Client
-url: /v6/orm/prisma-migrate/workflows/seeding
+url: /orm/v6/prisma-migrate/workflows/seeding
metaTitle: Seeding
metaDescription: Learn how to seed your database using Prisma ORM's integrated seeding functionality and Prisma Client
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/squashing-migrations.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/squashing-migrations.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/squashing-migrations.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/squashing-migrations.mdx
index 67d2d0931a..bb993ab562 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/squashing-migrations.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/squashing-migrations.mdx
@@ -1,12 +1,12 @@
---
title: Squashing migrations
description: How to squash multiple migration files into a single migration
-url: /v6/orm/prisma-migrate/workflows/squashing-migrations
+url: /orm/v6/prisma-migrate/workflows/squashing-migrations
metaTitle: Squashing migrations
metaDescription: How to squash multiple migration files into a single migration
---
-This guide describes how to squash multiple [migration files](/v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories) into a single migration.
+This guide describes how to squash multiple [migration files](/orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories) into a single migration.
## About squashing migrations
@@ -15,7 +15,7 @@ It is sometimes useful to squash either some or all migration files into a singl
- [Migrating cleanly from a development environment](#migrating-cleanly-from-a-development-environment) by squashing your local migrations into one before merging
- [Creating a clean history in a production environment](#creating-a-clean-history-in-a-production-environment) by squashing all migrations into a single file
-In both cases, Prisma Migrate provides the tools for doing this, by using the [`migrate diff`](/v6/orm/reference/prisma-cli-reference#migrate-diff) command to compare two database schemas and output a single SQL file that takes you from one to the other. The rest of this guide gives detailed instructions on how to carry this out in these two scenarios.
+In both cases, Prisma Migrate provides the tools for doing this, by using the [`migrate diff`](/orm/v6/reference/prisma-cli-reference#migrate-diff) command to compare two database schemas and output a single SQL file that takes you from one to the other. The rest of this guide gives detailed instructions on how to carry this out in these two scenarios.
### Migrating cleanly from a development environment
@@ -113,7 +113,7 @@ Then follow these steps, either on your `main` branch or on a newly checked out
4. Mark this migration as having been applied on production, to prevent it from being run there:
- You can do this using the [`migrate resolve`](/v6/orm/reference/prisma-cli-reference#migrate-resolve) command to mark the migration in the `000000000000_squashed_migrations` directory as already applied:
+ You can do this using the [`migrate resolve`](/orm/v6/reference/prisma-cli-reference#migrate-resolve) command to mark the migration in the `000000000000_squashed_migrations` directory as already applied:
```bash
npx prisma migrate resolve \
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/team-development.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/team-development.mdx
similarity index 56%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/team-development.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/team-development.mdx
index bae510cd0a..c3f71f0b7a 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/team-development.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/team-development.mdx
@@ -1,9 +1,9 @@
---
title: Team development
description: How to use Prisma Migrate when collaborating on a project as a team.
-url: /v6/orm/prisma-migrate/workflows/team-development
+url: /orm/v6/prisma-migrate/workflows/team-development
metaTitle: Team development
metaDescription: How to use Prisma Migrate when collaborating on a project as a team.
---
-This guide has been moved to the [guides section](/v6/guides/implementing-schema-changes). You can find the guide there.
+This guide has been moved to the [guides section](/guides/database/schema-changes). You can find the guide there.
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/troubleshooting.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/troubleshooting.mdx
similarity index 88%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/troubleshooting.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/troubleshooting.mdx
index 277b7c5baf..3c43a45c4b 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/troubleshooting.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/troubleshooting.mdx
@@ -1,20 +1,20 @@
---
title: Troubleshooting
description: Troubleshooting issues with Prisma Migrate in a development environment.
-url: /v6/orm/prisma-migrate/workflows/troubleshooting
+url: /orm/v6/prisma-migrate/workflows/troubleshooting
metaTitle: Troubleshooting
metaDescription: Troubleshooting issues with Prisma Migrate in a development environment.
---
This guide describes how to resolve issues with Prisma Migrate in a development environment, which often involves resetting your database. For production-focused troubleshooting, see:
-- [Production troubleshooting](/v6/orm/prisma-migrate/workflows/patching-and-hotfixing)
-- [Patching / hotfixing production databases](/v6/orm/prisma-migrate/workflows/patching-and-hotfixing)
+- [Production troubleshooting](/orm/v6/prisma-migrate/workflows/patching-and-hotfixing)
+- [Patching / hotfixing production databases](/orm/v6/prisma-migrate/workflows/patching-and-hotfixing)
:::warning
This guide **does not apply for MongoDB**.
-Instead of `migrate dev`, [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/v6/orm/overview/databases/mongodb).
+Instead of `migrate dev`, [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/orm/v6/overview/databases/mongodb).
:::
@@ -29,7 +29,7 @@ A migration history conflict occurs when there are discrepancies between the **m
In a development environment, switching between feature branches can result in a history conflict because the `_prisma_migrations` table contains migrations from `branch-1`, and switching to `branch-2` might cause some of those migrations to disappear.
-> **Note**: You should [never purposefully delete or edit a migration](/v6/orm/prisma-migrate/understanding-prisma-migrate/migration-histories#do-not-edit-or-delete-migrations-that-have-been-applied), as this might result in discrepancies between development and production.
+> **Note**: You should [never purposefully delete or edit a migration](/orm/v6/prisma-migrate/understanding-prisma-migrate/migration-histories#do-not-edit-or-delete-migrations-that-have-been-applied), as this might result in discrepancies between development and production.
#### Fixing a migration history conflict in a development environment
@@ -43,9 +43,9 @@ Database schema drift occurs when your database schema is out of sync with your
Schema drift can occur if:
-- The database schema was changed _without_ using migrations - for example, by using [`prisma db push`](/v6/orm/reference/prisma-cli-reference#db-push) or manually changing the database schema.
+- The database schema was changed _without_ using migrations - for example, by using [`prisma db push`](/orm/v6/reference/prisma-cli-reference#db-push) or manually changing the database schema.
-> **Note**: The [shadow database](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database) is required to detect schema drift, and can therefore only be done in a development environment.
+> **Note**: The [shadow database](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database) is required to detect schema drift, and can therefore only be done in a development environment.
#### Fixing schema drift in a development environment
@@ -87,7 +87,7 @@ If you made manual changes to the database that you want to keep, you can:
A migration might fail if:
-- You [modify a migration before running it](/v6/orm/prisma-migrate/workflows/customizing-migrations) and introduce a syntax error
+- You [modify a migration before running it](/orm/v6/prisma-migrate/workflows/customizing-migrations) and introduce a syntax error
- You add a mandatory (`NOT NULL`) column to a table that already has data
- The migration process stopped unexpectedly
- The database shut down in the middle of the migration process
@@ -132,4 +132,4 @@ Error: undefined: Database error
Error querying the database: db error: ERROR: prepared statement "s0" already exists
```
-See [Prisma Migrate and PgBouncer workaround](/v6/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer) for further information and a workaround.
+See [Prisma Migrate and PgBouncer workaround](/orm/v6/prisma-client/setup-and-configuration/databases-connections/pgbouncer) for further information and a workaround.
diff --git a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/unsupported-database-features.mdx b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/unsupported-database-features.mdx
similarity index 77%
rename from apps/docs/content/docs.v6/orm/prisma-migrate/workflows/unsupported-database-features.mdx
rename to apps/docs/content/docs/orm/v6/prisma-migrate/workflows/unsupported-database-features.mdx
index e2b9fd81f2..2cd3241ea5 100644
--- a/apps/docs/content/docs.v6/orm/prisma-migrate/workflows/unsupported-database-features.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-migrate/workflows/unsupported-database-features.mdx
@@ -1,30 +1,30 @@
---
title: Unsupported database features (Prisma Migrate)
description: How to include unsupported database features for projects that use Prisma Migrate.
-url: /v6/orm/prisma-migrate/workflows/unsupported-database-features
+url: /orm/v6/prisma-migrate/workflows/unsupported-database-features
metaTitle: 'Prisma Migrate: Unsupported database features'
metaDescription: How to include unsupported database features for projects that use Prisma Migrate.
---
-Prisma Migrate uses the Prisma schema to determine what features to create in the database. However, some database features [cannot be represented in the Prisma schema](/v6/orm/prisma-schema/data-model/unsupported-database-features) , including but not limited to:
+Prisma Migrate uses the Prisma schema to determine what features to create in the database. However, some database features [cannot be represented in the Prisma schema](/orm/v6/prisma-schema/data-model/unsupported-database-features) , including but not limited to:
- Stored procedures
- Triggers
- Views
- Partial indexes
-To add an unsupported feature to your database, you must [customize a migration](/v6/orm/prisma-migrate/workflows/customizing-migrations) to include that feature before you apply it.
+To add an unsupported feature to your database, you must [customize a migration](/orm/v6/prisma-migrate/workflows/customizing-migrations) to include that feature before you apply it.
:::tip
-The Prisma schema is able to represent [unsupported field types](/v6/orm/prisma-schema/data-model/unsupported-database-features#unsupported-field-types) and [native database functions](/v6/orm/prisma-migrate/workflows/native-database-functions).
+The Prisma schema is able to represent [unsupported field types](/orm/v6/prisma-schema/data-model/unsupported-database-features#unsupported-field-types) and [native database functions](/orm/v6/prisma-migrate/workflows/native-database-functions).
:::
:::warning
This guide **does not apply for MongoDB**.
-Instead of `migrate dev`, [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/v6/orm/overview/databases/mongodb).
+Instead of `migrate dev`, [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/orm/v6/overview/databases/mongodb).
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/database-mapping.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/database-mapping.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/database-mapping.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/database-mapping.mdx
index 59eb7d8ce0..c2d1b65cda 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/database-mapping.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/database-mapping.mdx
@@ -1,12 +1,12 @@
---
title: Database mapping
description: Database mapping in Prisma schema
-url: /v6/orm/prisma-schema/data-model/database-mapping
+url: /orm/v6/prisma-schema/data-model/database-mapping
metaTitle: Database mapping
metaDescription: Database mapping in Prisma schema
---
-The [Prisma schema](/v6/orm/prisma-schema/overview) includes mechanisms that allow you to define names of certain database objects. You can:
+The [Prisma schema](/orm/v6/prisma-schema/overview) includes mechanisms that allow you to define names of certain database objects. You can:
- [Map model and field names to different collection/table and field/column names](#mapping-collectiontable-and-fieldcolumn-names)
- [Define constraint and index names](#constraint-and-index-names)
@@ -15,13 +15,13 @@ The [Prisma schema](/v6/orm/prisma-schema/overview) includes mechanisms that all
Sometimes the names used to describe entities in your database might not match the names you would prefer in your generated API. Mapping names in the Prisma schema allows you to influence the naming in your Client API without having to change the underlying database names.
-A common approach for naming tables/collections in databases for example is to use plural form and [snake_case](https://en.wikipedia.org/wiki/Snake_case) notation. However, we recommended a different [naming convention (singular form, PascalCase)](/v6/orm/reference/prisma-schema-reference#naming-conventions).
+A common approach for naming tables/collections in databases for example is to use plural form and [snake_case](https://en.wikipedia.org/wiki/Snake_case) notation. However, we recommended a different [naming convention (singular form, PascalCase)](/orm/v6/reference/prisma-schema-reference#naming-conventions).
-`@map` and `@@map` allow you to [tune the shape of your Prisma Client API](/v6/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) by decoupling model and field names from table and column names in the underlying database.
+`@map` and `@@map` allow you to [tune the shape of your Prisma Client API](/orm/v6/prisma-client/setup-and-configuration/custom-model-and-field-names) by decoupling model and field names from table and column names in the underlying database.
### Map collection / table names
-As an example, when you [introspect](/v6/orm/prisma-schema/introspection) a database with a table named `comments`, the resulting Prisma model will look like this:
+As an example, when you [introspect](/orm/v6/prisma-schema/introspection) a database with a table named `comments`, the resulting Prisma model will look like this:
```prisma
model comments {
@@ -29,7 +29,7 @@ model comments {
}
```
-However, you can still choose `Comment` as the name of the model (e.g. to follow the naming convention) without renaming the underlying `comments` table in the database by using the [`@@map`](/v6/orm/reference/prisma-schema-reference#map-1) attribute:
+However, you can still choose `Comment` as the name of the model (e.g. to follow the naming convention) without renaming the underlying `comments` table in the database by using the [`@@map`](/orm/v6/reference/prisma-schema-reference#map-1) attribute:
```prisma highlight=4;normal
model Comment {
@@ -43,7 +43,7 @@ With this modified model definition, Prisma Client automatically maps the `Comme
### Map field / column names
-You can also [`@map`](/v6/orm/reference/prisma-schema-reference#map) a column/field name:
+You can also [`@map`](/orm/v6/reference/prisma-schema-reference#map) a column/field name:
```prisma highlight=2-4;normal
model Comment {
@@ -99,19 +99,19 @@ This means `Status.PENDING` evaluates to `"pending"`, not `"PENDING"`.
:::warning
-There is currently a known bug in Prisma ORM v7 where using mapped enum values with Prisma Client operations causes runtime errors. See the [Prisma 7 upgrade guide](/v6/orm/more/upgrades/to-v7#mapped-enum-values-in-generated-typescript) for workarounds and details.
+There is currently a known bug in Prisma ORM v7 where using mapped enum values with Prisma Client operations causes runtime errors. See the [Prisma 7 upgrade guide](/orm/v6/more/upgrades/to-v7#mapped-enum-values-in-generated-typescript) for workarounds and details.
:::
## Constraint and index names
-You can optionally use the `map` argument to explicitly define the **underlying constraint and index names** in the Prisma schema for the attributes [`@id`](/v6/orm/reference/prisma-schema-reference#id), [`@@id`](/v6/orm/reference/prisma-schema-reference#id-1), [`@unique`](/v6/orm/reference/prisma-schema-reference#unique), [`@@unique`](/v6/orm/reference/prisma-schema-reference#unique-1), [`@@index`](/v6/orm/reference/prisma-schema-reference#index) and [`@relation`](/v6/orm/reference/prisma-schema-reference#relation). (This is available in Prisma ORM version [2.29.0](https://github.com/prisma/prisma/releases/tag/2.29.0) and later.)
+You can optionally use the `map` argument to explicitly define the **underlying constraint and index names** in the Prisma schema for the attributes [`@id`](/orm/v6/reference/prisma-schema-reference#id), [`@@id`](/orm/v6/reference/prisma-schema-reference#id-1), [`@unique`](/orm/v6/reference/prisma-schema-reference#unique), [`@@unique`](/orm/v6/reference/prisma-schema-reference#unique-1), [`@@index`](/orm/v6/reference/prisma-schema-reference#index) and [`@relation`](/orm/v6/reference/prisma-schema-reference#relation). (This is available in Prisma ORM version [2.29.0](https://github.com/prisma/prisma/releases/tag/2.29.0) and later.)
When introspecting a database, the `map` argument will _only_ be rendered in the schema if the name _differs_ from Prisma ORM's [default constraint naming convention for indexes and constraints](#prisma-orms-default-naming-conventions-for-indexes-and-constraints).
:::danger
-If you use Prisma Migrate in a version earlier than 2.29.0 and want to maintain your existing constraint and index names after upgrading to a newer version, **do not** immediately run `prisma migrate` or `prisma db push`. This will **change any underlying constraint name that does not follow Prisma ORM's convention**. Follow the [upgrade path that allows you to maintain existing constraint and index names](/v6/orm/more/upgrades/older-versions#named-constraints).
+If you use Prisma Migrate in a version earlier than 2.29.0 and want to maintain your existing constraint and index names after upgrading to a newer version, **do not** immediately run `prisma migrate` or `prisma db push`. This will **change any underlying constraint name that does not follow Prisma ORM's convention**. Follow the [upgrade path that allows you to maintain existing constraint and index names](/orm/v6/more/upgrades/older-versions#named-constraints).
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/externally-managed-tables.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/externally-managed-tables.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/externally-managed-tables.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/externally-managed-tables.mdx
index 052565bef5..5cf475f651 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/externally-managed-tables.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/externally-managed-tables.mdx
@@ -2,7 +2,7 @@
title: External tables
description: How to declare and use externally managed tables in Prisma ORM
badge: preview
-url: /v6/orm/prisma-schema/data-model/externally-managed-tables
+url: /orm/v6/prisma-schema/data-model/externally-managed-tables
metaTitle: Externally managed tables
metaDescription: How to declare and use externally managed tables in Prisma ORM
---
@@ -22,11 +22,11 @@ Some concrete use cases for this are:
There may be many other scenarios based on custom organizational constraints or preferences where you may not want Prisma ORM to manage specific tables.
:::warning
-Externally managed tables are currently in [Preview](/v6/orm/more/releases#preview).
+Externally managed tables are currently in [Preview](/orm/v6/more/releases#preview).
:::
:::note
-Externally managed tables are frequently used in combination with [multi-schema](/v6/orm/prisma-schema/data-model/multi-schema) database setups. However, this is not a hard requirement. You can have only a single schema in your database and also declare externally managed tables within it.
+Externally managed tables are frequently used in combination with [multi-schema](/orm/v6/prisma-schema/data-model/multi-schema) database setups. However, this is not a hard requirement. You can have only a single schema in your database and also declare externally managed tables within it.
:::
:::warning
@@ -39,7 +39,7 @@ On the other hand, this flexibility enables you to represent only part of the un
If you want to use external tables, here's the main workflow:
-1. Declare the name of the external tables in your [Prisma Config file](/v6/orm/reference/prisma-config-reference)
+1. Declare the name of the external tables in your [Prisma Config file](/orm/v6/reference/prisma-config-reference)
1. Update your Prisma schema (e.g. via `npx prisma db pull`)
1. Re-generate Prisma Client with `npx prisma generate`
1. You can now query the external table using Prisma Client but it will be ignored by Prisma Migrate
@@ -49,7 +49,7 @@ If you want to use external tables, here's the main workflow:
## Prisma Config syntax
-You can specify externally managed tables in your [Prisma Config](/v6/orm/reference/prisma-config-reference) file via the `tables.external` property:
+You can specify externally managed tables in your [Prisma Config](/orm/v6/reference/prisma-config-reference) file via the `tables.external` property:
```ts title="prisma.config.ts"
import "dotenv/config";
@@ -88,7 +88,7 @@ export default defineConfig({
Prisma can create and update relationships from tables it manages to externally managed tables.
However, for this Prisma needs to be aware of the structure of those externally managed tables during migration creation.
-You can provide a SQL script that Prisma will run on its [shadow database](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database) ahead of all migrations to emulate the external tables and enums during migration creation.
+You can provide a SQL script that Prisma will run on its [shadow database](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database) ahead of all migrations to emulate the external tables and enums during migration creation.
The created placeholder table does not need to have the full structure of the actual table but primary keys need to be present.
@@ -212,7 +212,7 @@ export default defineConfig({
Next, you need to update your Prisma schema. You can do this either:
- by manually creating the models
-- or by using [introspection](/v6/orm/prisma-schema/introspection):
+- or by using [introspection](/orm/v6/prisma-schema/introspection):
```npm
npx prisma db pull
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/indexes.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/indexes.mdx
similarity index 99%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/indexes.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/indexes.mdx
index 06443bb343..86761feb26 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/indexes.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/indexes.mdx
@@ -1,7 +1,7 @@
---
title: Indexes
description: How to configure index functionality and add full text indexes
-url: /v6/orm/prisma-schema/data-model/indexes
+url: /orm/v6/prisma-schema/data-model/indexes
metaTitle: Indexes
metaDescription: How to configure index functionality and add full text indexes
---
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/meta.json b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/models.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/models.mdx
similarity index 84%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/models.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/models.mdx
index ec728818dd..dd2f4bea53 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/models.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/models.mdx
@@ -1,17 +1,17 @@
---
title: Models
description: 'Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more.'
-url: /v6/orm/prisma-schema/data-model/models
+url: /orm/v6/prisma-schema/data-model/models
metaTitle: Models
metaDescription: 'Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more.'
---
-The data model definition part of the [Prisma schema](/v6/orm/prisma-schema/overview) defines your application models (also called **Prisma models**). Models:
+The data model definition part of the [Prisma schema](/orm/v6/prisma-schema/overview) defines your application models (also called **Prisma models**). Models:
- Represent the **entities** of your application domain
- Map to the **tables** (relational databases like PostgreSQL) or **collections** (MongoDB) in your database
-- Form the foundation of the **queries** available in the generated [Prisma Client API](/v6/orm/prisma-client/setup-and-configuration/introduction)
-- When used with TypeScript, Prisma Client provides generated **type definitions** for your models and any [variations](/v6/orm/prisma-client/type-safety/operating-against-partial-structures-of-model-types) of them to make database access entirely type safe.
+- Form the foundation of the **queries** available in the generated [Prisma Client API](/orm/v6/prisma-client/setup-and-configuration/introduction)
+- When used with TypeScript, Prisma Client provides generated **type definitions** for your models and any [variations](/orm/v6/prisma-client/type-safety/operating-against-partial-structures-of-model-types) of them to make database access entirely type safe.
The following schema describes a blogging platform - the data model definition is highlighted:
@@ -116,8 +116,8 @@ enum Role { // [!code highlight]
The data model definition is made up of:
-- [Models](#defining-models) ([`model`](/v6/orm/reference/prisma-schema-reference#model) primitives) that define a number of fields, including [relations between models](#relation-fields)
-- [Enums](#defining-enums) ([`enum`](/v6/orm/reference/prisma-schema-reference#enum) primitives) (if your connector supports Enums)
+- [Models](#defining-models) ([`model`](/orm/v6/reference/prisma-schema-reference#model) primitives) that define a number of fields, including [relations between models](#relation-fields)
+- [Enums](#defining-enums) ([`enum`](/orm/v6/reference/prisma-schema-reference#enum) primitives) (if your connector supports Enums)
- [Attributes](#defining-attributes) and [functions](#using-functions) that change the behavior of fields and models
The corresponding database looks like this:
@@ -230,12 +230,12 @@ Your data model reflects _your_ application domain. For example:
There are two ways to define a data model:
-- **Write the data model manually and use Prisma Migrate**: You can write your data model manually and map it to your database using [Prisma Migrate](/v6/orm/prisma-migrate/getting-started). In this case, the data model is the single source of truth for the models of your application.
-- **Generate the data model via introspection**: When you have an existing database or prefer migrating your database schema with SQL, you generate the data model by [introspecting](/v6/orm/prisma-schema/introspection) your database. In this case, the database schema is the single source of truth for the models of your application.
+- **Write the data model manually and use Prisma Migrate**: You can write your data model manually and map it to your database using [Prisma Migrate](/orm/v6/prisma-migrate/getting-started). In this case, the data model is the single source of truth for the models of your application.
+- **Generate the data model via introspection**: When you have an existing database or prefer migrating your database schema with SQL, you generate the data model by [introspecting](/orm/v6/prisma-schema/introspection) your database. In this case, the database schema is the single source of truth for the models of your application.
## Defining models
-Models represent the entities of your application domain. Models are represented by [`model`](/v6/orm/reference/prisma-schema-reference#model) blocks and define a number of [fields](/v6/orm/reference/prisma-schema-reference#model-fields). In the example data model above, `User`, `Profile`, `Post` and `Category` are models.
+Models represent the entities of your application domain. Models are represented by [`model`](/orm/v6/reference/prisma-schema-reference#model) blocks and define a number of [fields](/orm/v6/reference/prisma-schema-reference#model-fields). In the example data model above, `User`, `Profile`, `Post` and `Category` are models.
A blogging platform can be extended with the following models:
@@ -251,7 +251,7 @@ model Tag {
### Mapping model names to tables or collections
-Prisma model [naming conventions (singular form, PascalCase)](/v6/orm/reference/prisma-schema-reference#naming-conventions) do not always match table names in the database. A common approach for naming tables/collections in databases is to use plural form and [snake_case](https://en.wikipedia.org/wiki/Snake_case) notation - for example: `comments`. When you introspect a database with a table named `comments`, the result Prisma model will look like this:
+Prisma model [naming conventions (singular form, PascalCase)](/orm/v6/reference/prisma-schema-reference#naming-conventions) do not always match table names in the database. A common approach for naming tables/collections in databases is to use plural form and [snake_case](https://en.wikipedia.org/wiki/Snake_case) notation - for example: `comments`. When you introspect a database with a table named `comments`, the result Prisma model will look like this:
```prisma
model comments {
@@ -259,7 +259,7 @@ model comments {
}
```
-However, you can still adhere to the naming convention without renaming the underlying `comments` table in the database by using the [`@@map`](/v6/orm/reference/prisma-schema-reference#map-1) attribute:
+However, you can still adhere to the naming convention without renaming the underlying `comments` table in the database by using the [`@@map`](/orm/v6/reference/prisma-schema-reference#map-1) attribute:
```prisma
model Comment {
@@ -271,36 +271,26 @@ model Comment {
With this model definition, Prisma ORM automatically maps the `Comment` model to the `comments` table in the underlying database.
-> **Note**: You can also [`@map`](/v6/orm/reference/prisma-schema-reference#map) a column name or enum value, and `@@map` an enum name.
+> **Note**: You can also [`@map`](/orm/v6/reference/prisma-schema-reference#map) a column name or enum value, and `@@map` an enum name.
-`@map` and `@@map` allow you to [tune the shape of your Prisma Client API](/v6/orm/prisma-client/setup-and-configuration/custom-model-and-field-names#using-map-and-map-to-rename-fields-and-models-in-the-prisma-client-api) by decoupling model and field names from table and column names in the underlying database.
+`@map` and `@@map` allow you to [tune the shape of your Prisma Client API](/orm/v6/prisma-client/setup-and-configuration/custom-model-and-field-names#using-map-and-map-to-rename-fields-and-models-in-the-prisma-client-api) by decoupling model and field names from table and column names in the underlying database.
-
+
-
-
-
## Defining fields
The properties of a model are called _fields_, which consist of:
-- A **[field name](/v6/orm/reference/prisma-schema-reference#model-fields)**
-- A **[field type](/v6/orm/reference/prisma-schema-reference#model-fields)**
+- A **[field name](/orm/v6/reference/prisma-schema-reference#model-fields)**
+- A **[field type](/orm/v6/reference/prisma-schema-reference#model-fields)**
- Optional **[type modifiers](#type-modifiers)**
- Optional **[attributes](#defining-attributes)**, including [native database type attributes](#native-types-mapping)
A field's type determines its _structure_, and fits into one of two categories:
-- [Scalar types](#scalar-fields) (includes [enums](#defining-enums)) that map to columns (relational databases) or document fields (MongoDB) in the database - for example, [`String`](/v6/orm/reference/prisma-schema-reference#string) or [`Int`](/v6/orm/reference/prisma-schema-reference#int)
-- Model types (the field is then called [relation field](/v6/orm/prisma-schema/data-model/relations#relation-fields)) - for example `Post` or `Comment[]`.
+- [Scalar types](#scalar-fields) (includes [enums](#defining-enums)) that map to columns (relational databases) or document fields (MongoDB) in the database - for example, [`String`](/orm/v6/reference/prisma-schema-reference#string) or [`Int`](/orm/v6/reference/prisma-schema-reference#int)
+- Model types (the field is then called [relation field](/orm/v6/prisma-schema/data-model/relations#relation-fields)) - for example `Post` or `Comment[]`.
The following table describes `User` model's fields from the sample schema:
@@ -347,7 +337,7 @@ model Tag {
}
```
-See [complete list of scalar field types](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types) .
+See [complete list of scalar field types](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types) .
### Relation fields
@@ -383,7 +373,7 @@ model Comment {
}
```
-Refer to the [relations documentation](/v6/orm/prisma-schema/data-model/relations) for more examples and information about relationships between models.
+Refer to the [relations documentation](/orm/v6/prisma-schema/data-model/relations) for more examples and information about relationships between models.
### Native types mapping
@@ -403,21 +393,21 @@ Type attributes are:
- Written in PascalCase (for example, `VarChar` or `Text`)
- Prefixed by `@db`, where `db` is the name of the `datasource` block in your schema
-Furthermore, during [Introspection](/v6/orm/prisma-schema/introspection) type attributes are _only_ added to the schema if the underlying native type is **not the default type**. For example, if you are using the PostgreSQL provider, `String` fields where the underlying native type is `text` will not have a type attribute.
+Furthermore, during [Introspection](/orm/v6/prisma-schema/introspection) type attributes are _only_ added to the schema if the underlying native type is **not the default type**. For example, if you are using the PostgreSQL provider, `String` fields where the underlying native type is `text` will not have a type attribute.
-See [complete list of native database type attributes per scalar type and provider](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types) .
+See [complete list of native database type attributes per scalar type and provider](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types) .
#### Benefits and workflows
-- Control **the exact native type** that [Prisma Migrate](/v6/orm/prisma-migrate/getting-started) creates in the database - for example, a `String` can be `@db.VarChar(200)` or `@db.Char(50)`
+- Control **the exact native type** that [Prisma Migrate](/orm/v6/prisma-migrate/getting-started) creates in the database - for example, a `String` can be `@db.VarChar(200)` or `@db.Char(50)`
- See an **enriched schema** when you introspect
### Type modifiers
The type of a field can be modified by appending either of two modifiers:
-- [`[]`](/v6/orm/reference/prisma-schema-reference#-modifier) Make a field a list
-- [`?`](/v6/orm/reference/prisma-schema-reference#-modifier-1) Make a field optional
+- [`[]`](/orm/v6/reference/prisma-schema-reference#-modifier) Make a field a list
+- [`?`](/orm/v6/reference/prisma-schema-reference#-modifier-1) Make a field optional
> **Note**: You **cannot** combine type modifiers - optional lists are not supported.
@@ -482,7 +472,7 @@ When **not** annotating a field with the `?` type modifier, the field will be _r
### Unsupported types
-When you introspect a relational database, unsupported data types are added as [`Unsupported`](/v6/orm/reference/prisma-schema-reference#unsupported) :
+When you introspect a relational database, unsupported data types are added as [`Unsupported`](/orm/v6/reference/prisma-schema-reference#unsupported) :
```prisma
location Unsupported("POLYGON")?
@@ -490,7 +480,7 @@ location Unsupported("POLYGON")?
The `Unsupported` type allows you to define fields in the Prisma schema for database types that are not yet supported by Prisma ORM. For example, MySQL's `POLYGON` type is not currently supported by Prisma ORM, but can now be added to the Prisma schema using the `Unsupported("POLYGON")` type.
-Fields of type `Unsupported` do not appear in the generated Prisma Client API, but you can still use Prisma ORM’s [raw database access feature](/v6/orm/prisma-client/using-raw-sql/raw-queries) to query these fields.
+Fields of type `Unsupported` do not appear in the generated Prisma Client API, but you can still use Prisma ORM’s [raw database access feature](/orm/v6/prisma-client/using-raw-sql/raw-queries) to query these fields.
> **Note**: If a model has **mandatory `Unsupported` fields**, the generated client will not include `create` or `update` methods for that model.
@@ -498,7 +488,7 @@ Fields of type `Unsupported` do not appear in the generated Prisma Client API, b
## Defining attributes
-Attributes modify the behavior of fields or model blocks. The following example includes three field attributes ([`@id`](/v6/orm/reference/prisma-schema-reference#id) , [`@default`](/v6/orm/reference/prisma-schema-reference#default) , and [`@unique`](/v6/orm/reference/prisma-schema-reference#unique) ) and one block attribute ([`@@unique`](/v6/orm/reference/prisma-schema-reference#unique-1)):
+Attributes modify the behavior of fields or model blocks. The following example includes three field attributes ([`@id`](/orm/v6/reference/prisma-schema-reference#id) , [`@default`](/orm/v6/reference/prisma-schema-reference#default) , and [`@unique`](/orm/v6/reference/prisma-schema-reference#unique) ) and one block attribute ([`@@unique`](/orm/v6/reference/prisma-schema-reference#unique-1)):
```prisma tab="Relational databases"
model User {
@@ -524,13 +514,13 @@ model User {
}
```
-Some attributes accept [arguments](/v6/orm/reference/prisma-schema-reference#attribute-argument-types) - for example, `@default` accepts `true` or `false`:
+Some attributes accept [arguments](/orm/v6/reference/prisma-schema-reference#attribute-argument-types) - for example, `@default` accepts `true` or `false`:
```prisma
isAdmin Boolean @default(false) // short form of @default(value: false)
```
-See [complete list of field and block attributes](/v6/orm/reference/prisma-schema-reference#attributes)
+See [complete list of field and block attributes](/orm/v6/reference/prisma-schema-reference#attributes)
### Defining an ID field
@@ -541,7 +531,7 @@ An ID uniquely identifies individual records of a model. A model can only have _
#### Defining IDs in relational databases
-In relational databases, an ID can be defined by a single field using the [`@id`](/v6/orm/reference/prisma-schema-reference#id) attribute, or multiple fields using the [`@@id`](/v6/orm/reference/prisma-schema-reference#id-1) attribute.
+In relational databases, an ID can be defined by a single field using the [`@id`](/orm/v6/reference/prisma-schema-reference#id) attribute, or multiple fields using the [`@@id`](/orm/v6/reference/prisma-schema-reference#id-1) attribute.
##### Single field IDs
@@ -575,7 +565,7 @@ model User {
By default, the name of this field in Prisma Client queries will be `firstName_lastName`.
-You can also provide your own name for the composite ID using the [`@@id`](/v6/orm/reference/prisma-schema-reference#id-1) attribute's `name` field:
+You can also provide your own name for the composite ID using the [`@@id`](/orm/v6/reference/prisma-schema-reference#id-1) attribute's `name` field:
```prisma highlight=7;normal
model User {
@@ -592,7 +582,7 @@ The `firstName_lastName` field will now be named `fullName` instead.
:::info
-Refer to the documentation on [working with composite IDs](/v6/orm/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints) to learn how to interact with a composite ID in Prisma Client.
+Refer to the documentation on [working with composite IDs](/orm/v6/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints) to learn how to interact with a composite ID in Prisma Client.
:::
@@ -613,13 +603,13 @@ model User {
:::info
**Constraint names in relational databases**
-You can optionally define a [custom primary key constraint name](/v6/orm/prisma-schema/data-model/database-mapping#constraint-and-index-names) in the underlying database.
+You can optionally define a [custom primary key constraint name](/orm/v6/prisma-schema/data-model/database-mapping#constraint-and-index-names) in the underlying database.
:::
#### Defining IDs in MongoDB
-The MongoDB connector has [specific rules for defining an ID field](/v6/orm/reference/prisma-schema-reference#mongodb) that differs from relational databases. An ID must be defined by a single field using the [`@id`](/v6/orm/reference/prisma-schema-reference#id) attribute and must include `@map("_id")`.
+The MongoDB connector has [specific rules for defining an ID field](/orm/v6/reference/prisma-schema-reference#mongodb) that differs from relational databases. An ID must be defined by a single field using the [`@id`](/orm/v6/reference/prisma-schema-reference#id) attribute and must include `@map("_id")`.
In the following example, the `User` ID is represented by the `id` string field that accepts an auto-generated `ObjectId`:
@@ -656,7 +646,7 @@ MongoDB does not support composite IDs, which means you cannot identify a model
### Defining a default value
-You can define default values for scalar fields of your models using the [`@default`](/v6/orm/reference/prisma-schema-reference#default) attribute:
+You can define default values for scalar fields of your models using the [`@default`](/orm/v6/reference/prisma-schema-reference#default) attribute:
```prisma highlight=3,5;normal tab="Relational databases"
model Post {
@@ -686,24 +676,24 @@ model Post {
`@default` attributes either:
- Represent `DEFAULT` values in the underlying database (relational databases only) _or_
-- Use a Prisma ORM-level function. For example, `cuid()` and `uuid()` are provided by Prisma Client's [query engine](/v6/orm/more/internals/engines) for all connectors.
+- Use a Prisma ORM-level function. For example, `cuid()` and `uuid()` are provided by Prisma Client's [query engine](/orm/v6/more/internals/engines) for all connectors.
Default values can be:
- Static values that correspond to the field type, such as `5` (`Int`), `Hello` (`String`), or `false` (`Boolean`)
-- [Lists](/v6/orm/reference/prisma-schema-reference#-modifier) of static values, such as `[5, 6, 8]` (`Int[]`) or `["Hello", "Goodbye"]` (`String`[]). These are available in Prisma ORM versions `4.0.0` and later, when using supported databases (PostgreSQL, CockroachDB and MongoDB)
-- [Functions](#using-functions), such as [`now()`](/v6/orm/reference/prisma-schema-reference#now) or [`uuid()`](/v6/orm/reference/prisma-schema-reference#uuid)
+- [Lists](/orm/v6/reference/prisma-schema-reference#-modifier) of static values, such as `[5, 6, 8]` (`Int[]`) or `["Hello", "Goodbye"]` (`String`[]). These are available in Prisma ORM versions `4.0.0` and later, when using supported databases (PostgreSQL, CockroachDB and MongoDB)
+- [Functions](#using-functions), such as [`now()`](/orm/v6/reference/prisma-schema-reference#now) or [`uuid()`](/orm/v6/reference/prisma-schema-reference#uuid)
- JSON data. Note that JSON needs to be enclosed with double-quotes inside the `@default` attribute, e.g.: `@default("[]")`. If you want to provide a JSON object, you need to enclose it with double-quotes and then escape any internal double quotes using a backslash, e.g.: `@default("{ \"hello\": \"world\" }")`.
:::info
-Refer to the [attribute function reference documentation](/v6/orm/reference/prisma-schema-reference#attribute-functions) for information about connector support for functions.
+Refer to the [attribute function reference documentation](/orm/v6/reference/prisma-schema-reference#attribute-functions) for information about connector support for functions.
:::
### Defining a unique field
-You can add unique attributes to your models to be able to uniquely identify individual records of that model. Unique attributes can be defined on a single field using [`@unique`](/v6/orm/reference/prisma-schema-reference#unique) attribute, or on multiple fields (also called composite or compound unique constraints) using the [`@@unique`](/v6/orm/reference/prisma-schema-reference#unique-1) attribute.
+You can add unique attributes to your models to be able to uniquely identify individual records of that model. Unique attributes can be defined on a single field using [`@unique`](/orm/v6/reference/prisma-schema-reference#unique) attribute, or on multiple fields (also called composite or compound unique constraints) using the [`@@unique`](/orm/v6/reference/prisma-schema-reference#unique-1) attribute.
In the following example, the value of the `email` field must be unique:
@@ -756,13 +746,13 @@ model Post {
:::info
**Constraint names in relational databases**
-You can optionally define a [custom unique constraint name](/v6/orm/prisma-schema/data-model/database-mapping#constraint-and-index-names) in the underlying database.
+You can optionally define a [custom unique constraint name](/orm/v6/prisma-schema/data-model/database-mapping#constraint-and-index-names) in the underlying database.
:::
By default, the name of this field in Prisma Client queries will be `authorId_title`.
-You can also provide your own name for the composite unique constraint using the [`@@unique`](/v6/orm/prisma-schema/data-model/database-mapping#constraint-and-index-names) attribute's `name` field:
+You can also provide your own name for the composite unique constraint using the [`@@unique`](/orm/v6/prisma-schema/data-model/database-mapping#constraint-and-index-names) attribute's `name` field:
```prisma highlight=10;normal
model Post {
@@ -782,7 +772,7 @@ The `authorId_title` field will now be named `authorTitle` instead.
:::info
-Refer to the documentation on [working with composite unique identifiers](/v6/orm/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints) to learn how to interact with a composite unique constraints in Prisma Client.
+Refer to the documentation on [working with composite unique identifiers](/orm/v6/prisma-client/special-fields-and-types/working-with-composite-ids-and-constraints) to learn how to interact with a composite unique constraints in Prisma Client.
:::
@@ -829,7 +819,7 @@ model User {
### Defining an index
-You can define indexes on one or multiple fields of your models via the [`@@index`](/v6/orm/reference/prisma-schema-reference#index) on a model. The following example defines a multi-column index based on the `title` and `content` field:
+You can define indexes on one or multiple fields of your models via the [`@@index`](/orm/v6/reference/prisma-schema-reference#index) on a model. The following example defines a multi-column index based on the `title` and `content` field:
```prisma
model Post {
@@ -844,7 +834,7 @@ model Post {
:::info
**Index names in relational databases**
-You can optionally define a [custom index name](/v6/orm/prisma-schema/data-model/database-mapping#constraint-and-index-names) in the underlying database.
+You can optionally define a [custom index name](/orm/v6/prisma-schema/data-model/database-mapping#constraint-and-index-names) in the underlying database.
:::
@@ -891,11 +881,11 @@ model User {
## Defining enums
-You can define enums in your data model [if enums are supported for your database connector](/v6/orm/reference/database-features#misc), either natively or at Prisma ORM level.
+You can define enums in your data model [if enums are supported for your database connector](/orm/v6/reference/database-features#misc), either natively or at Prisma ORM level.
-Enums are considered [scalar](#scalar-fields) types in the Prisma schema data model. They're therefore [by default](/v6/orm/prisma-client/queries/select-fields#return-the-default-fields) included as return values in [Prisma Client queries](/v6/orm/prisma-client/queries/crud).
+Enums are considered [scalar](#scalar-fields) types in the Prisma schema data model. They're therefore [by default](/orm/v6/prisma-client/queries/select-fields#return-the-default-fields) included as return values in [Prisma Client queries](/orm/v6/prisma-client/queries/crud).
-Enums are defined via the [`enum`](/v6/orm/reference/prisma-schema-reference#enum) block. For example, a `User` has a `Role`:
+Enums are defined via the [`enum`](/orm/v6/reference/prisma-schema-reference#enum) block. For example, a `User` has a `Role`:
```prisma highlight=5,8-11;normal tab="Relational databases"
model User {
@@ -961,11 +951,11 @@ In this case, the `Product` model has a list of `Photo` composite types stored i
### Considerations when using composite types
-Composite types only support a limited set of [attributes](/v6/orm/reference/prisma-schema-reference#attributes). The following attributes are supported:
+Composite types only support a limited set of [attributes](/orm/v6/reference/prisma-schema-reference#attributes). The following attributes are supported:
- `@default`
- `@map`
-- [Native types](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types), such as `@db.ObjectId`
+- [Native types](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types), such as `@db.ObjectId`
The following attributes are not supported inside composite types:
@@ -981,9 +971,9 @@ Indexes can be defined by using the `@@index` attribute on the level of the mode
## Using functions
-The Prisma schema supports a number of [functions](/v6/orm/reference/prisma-schema-reference#attribute-functions) . These can be used to specify [default values](/v6/orm/reference/prisma-schema-reference#default) on fields of a model.
+The Prisma schema supports a number of [functions](/orm/v6/reference/prisma-schema-reference#attribute-functions) . These can be used to specify [default values](/orm/v6/reference/prisma-schema-reference#default) on fields of a model.
-For example, the default value of `createdAt` is [`now()`](/v6/orm/reference/prisma-schema-reference#now) :
+For example, the default value of `createdAt` is [`now()`](/orm/v6/reference/prisma-schema-reference#now) :
```prisma tab="Relational databases"
model Post {
@@ -999,36 +989,36 @@ model Post {
}
```
-[`cuid()`](/v6/orm/reference/prisma-schema-reference#cuid) and [`uuid()`](/v6/orm/reference/prisma-schema-reference#uuid) are implemented by Prisma ORM and therefore are not "visible" in the underlying database schema. You can still use them when using [introspection](/v6/orm/prisma-schema/introspection) by [manually changing your Prisma schema](/v6/orm/prisma-client/setup-and-configuration/custom-model-and-field-names) and [generating Prisma Client](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client), in that case the values will be generated by Prisma Client's [query engine](/v6/orm/more/internals/engines)
+[`cuid()`](/orm/v6/reference/prisma-schema-reference#cuid) and [`uuid()`](/orm/v6/reference/prisma-schema-reference#uuid) are implemented by Prisma ORM and therefore are not "visible" in the underlying database schema. You can still use them when using [introspection](/orm/v6/prisma-schema/introspection) by [manually changing your Prisma schema](/orm/v6/prisma-client/setup-and-configuration/custom-model-and-field-names) and [generating Prisma Client](/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client), in that case the values will be generated by Prisma Client's [query engine](/orm/v6/more/internals/engines)
-Support for [`autoincrement()`](/v6/orm/reference/prisma-schema-reference#autoincrement), [`now()`](/v6/orm/reference/prisma-schema-reference#now), and [`dbgenerated(...)`](/v6/orm/reference/prisma-schema-reference#dbgenerated) differ between databases.
+Support for [`autoincrement()`](/orm/v6/reference/prisma-schema-reference#autoincrement), [`now()`](/orm/v6/reference/prisma-schema-reference#now), and [`dbgenerated(...)`](/orm/v6/reference/prisma-schema-reference#dbgenerated) differ between databases.
-**Relational database connectors** implement `autoincrement()`, `dbgenerated(...)`, and `now()` at database level. The **MongoDB connector** does not support `autoincrement()` or `dbgenerated(...)`, and `now()` is implemented at the Prisma ORM level. The [`auto()`](/v6/orm/reference/prisma-schema-reference#auto) function is used to generate an `ObjectId`.
+**Relational database connectors** implement `autoincrement()`, `dbgenerated(...)`, and `now()` at database level. The **MongoDB connector** does not support `autoincrement()` or `dbgenerated(...)`, and `now()` is implemented at the Prisma ORM level. The [`auto()`](/orm/v6/reference/prisma-schema-reference#auto) function is used to generate an `ObjectId`.
## Relations
-Refer to the [relations documentation](/v6/orm/prisma-schema/data-model/relations) for more examples and information about relationships between models.
+Refer to the [relations documentation](/orm/v6/prisma-schema/data-model/relations) for more examples and information about relationships between models.
## Models in Prisma Client
### Queries (CRUD)
-Every model in the data model definition will result in a number of CRUD queries in the generated [Prisma Client API](/v6/orm/prisma-client/setup-and-configuration/introduction):
-
-- [`findMany()`](/v6/orm/reference/prisma-client-reference#findmany)
-- [`findFirst()`](/v6/orm/reference/prisma-client-reference#findfirst)
-- [`findFirstOrThrow()`](/v6/orm/reference/prisma-client-reference#findfirstorthrow)
-- [`findUnique()`](/v6/orm/reference/prisma-client-reference#findunique)
-- [`findUniqueOrThrow()`](/v6/orm/reference/prisma-client-reference#finduniqueorthrow)
-- [`create()`](/v6/orm/reference/prisma-client-reference#create)
-- [`update()`](/v6/orm/reference/prisma-client-reference#update)
-- [`upsert()`](/v6/orm/reference/prisma-client-reference#upsert)
-- [`delete()`](/v6/orm/reference/prisma-client-reference#delete)
-- [`createMany()`](/v6/orm/reference/prisma-client-reference#createmany)
-- [`createManyAndReturn()`](/v6/orm/reference/prisma-client-reference#createmanyandreturn)
-- [`updateMany()`](/v6/orm/reference/prisma-client-reference#updatemany)
-- [`updateManyAndReturn()`](/v6/orm/reference/prisma-client-reference#updatemanyandreturn)
-- [`deleteMany()`](/v6/orm/reference/prisma-client-reference#deletemany)
+Every model in the data model definition will result in a number of CRUD queries in the generated [Prisma Client API](/orm/v6/prisma-client/setup-and-configuration/introduction):
+
+- [`findMany()`](/orm/v6/reference/prisma-client-reference#findmany)
+- [`findFirst()`](/orm/v6/reference/prisma-client-reference#findfirst)
+- [`findFirstOrThrow()`](/orm/v6/reference/prisma-client-reference#findfirstorthrow)
+- [`findUnique()`](/orm/v6/reference/prisma-client-reference#findunique)
+- [`findUniqueOrThrow()`](/orm/v6/reference/prisma-client-reference#finduniqueorthrow)
+- [`create()`](/orm/v6/reference/prisma-client-reference#create)
+- [`update()`](/orm/v6/reference/prisma-client-reference#update)
+- [`upsert()`](/orm/v6/reference/prisma-client-reference#upsert)
+- [`delete()`](/orm/v6/reference/prisma-client-reference#delete)
+- [`createMany()`](/orm/v6/reference/prisma-client-reference#createmany)
+- [`createManyAndReturn()`](/orm/v6/reference/prisma-client-reference#createmanyandreturn)
+- [`updateMany()`](/orm/v6/reference/prisma-client-reference#updatemany)
+- [`updateManyAndReturn()`](/orm/v6/reference/prisma-client-reference#updatemanyandreturn)
+- [`deleteMany()`](/orm/v6/reference/prisma-client-reference#deletemany)
The operations are accessible via a generated property on the Prisma Client instance. By default the name of the property is the lowercase form of the model name, e.g. `user` for a `User` model or `post` for a `Post` model.
@@ -1045,9 +1035,9 @@ const allUsers = await prisma.user.findMany();
### Type definitions
-Prisma Client also generates **type definitions** that reflect your model structures. These are part of the generated [`@prisma/client`](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#the-prismaclient-npm-package) node module.
+Prisma Client also generates **type definitions** that reflect your model structures. These are part of the generated [`@prisma/client`](/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client#the-prismaclient-npm-package) node module.
-When using TypeScript, these type definitions ensure that all your database queries are entirely type safe and validated at compile-time (even partial queries using [`select`](/v6/orm/reference/prisma-client-reference#select) or [`include`](/v6/orm/reference/prisma-client-reference#include) ).
+When using TypeScript, these type definitions ensure that all your database queries are entirely type safe and validated at compile-time (even partial queries using [`select`](/orm/v6/reference/prisma-client-reference#select) or [`include`](/orm/v6/reference/prisma-client-reference#include) ).
Even when using plain JavaScript, the type definitions are still included in the `@prisma/client` node module, enabling features like [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense)/autocompletion in your editor.
@@ -1064,7 +1054,7 @@ export type User = {
};
```
-Note that the relation fields `posts` and `profile` are not included in the type definition by default. However, if you need variations of the `User` type you can still define them using some of [Prisma Client's generated helper types](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client) (in this case, these helper types would be called `UserGetIncludePayload` and `UserGetSelectPayload`).
+Note that the relation fields `posts` and `profile` are not included in the type definition by default. However, if you need variations of the `User` type you can still define them using some of [Prisma Client's generated helper types](/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client) (in this case, these helper types would be called `UserGetIncludePayload` and `UserGetSelectPayload`).
## Limitations
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/multi-schema.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/multi-schema.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/multi-schema.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/multi-schema.mdx
index af60a2c30f..e9842756e7 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/multi-schema.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/multi-schema.mdx
@@ -1,7 +1,7 @@
---
title: Multi-schema
description: How to use Prisma ORM with multiple database schemas
-url: /v6/orm/prisma-schema/data-model/multi-schema
+url: /orm/v6/prisma-schema/data-model/multi-schema
metaTitle: How to use Prisma ORM with multiple database schemas
metaDescription: How to use Prisma ORM with multiple database schemas
---
@@ -167,4 +167,4 @@ const orders = await prisma.order.findMany({
### Externally managed tables
-Sometimes, you might not want Prisma ORM to manage specific tables, such as ones handled by another team or service (e.g., Auth0 or Clerk tables). In such cases, you can mark these as **externally managed tables** using the `tables.external` configuration option in your [Prisma Config file](/v6/orm/reference/prisma-config-reference#tablesexternal-and-enumsexternal). Learn more about [externally managed tables](/v6/orm/prisma-schema/data-model/externally-managed-tables).
+Sometimes, you might not want Prisma ORM to manage specific tables, such as ones handled by another team or service (e.g., Auth0 or Clerk tables). In such cases, you can mark these as **externally managed tables** using the `tables.external` configuration option in your [Prisma Config file](/orm/v6/reference/prisma-config-reference#tablesexternal-and-enumsexternal). Learn more about [externally managed tables](/orm/v6/prisma-schema/data-model/externally-managed-tables).
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/index.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/index.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/index.mdx
index 397d82887b..1d437fb912 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/index.mdx
@@ -1,7 +1,7 @@
---
title: Relations
description: 'A relation is a connection between two models in the Prisma schema. This page explains how you can define one-to-one, one-to-many and many-to-many relations in Prisma.'
-url: /v6/orm/prisma-schema/data-model/relations
+url: /orm/v6/prisma-schema/data-model/relations
metaTitle: Relations
metaDescription: 'A relation is a connection between two models in the Prisma schema. This page explains how you can define one-to-one, one-to-many and many-to-many relations in Prisma.'
---
@@ -47,18 +47,7 @@ At a Prisma ORM level, the `User` / `Post` relation is made up of:
At a Prisma ORM level, a connection between two models is **always** represented by a [relation field](#relation-fields) on **each side** of the relation.
-
-
-
-
-
+
## Relations in the database
@@ -194,7 +183,7 @@ const updateAuthor = await prisma.user.update({
});
```
-In the underlying database, this query uses a [nested `connect` query](/v6/orm/reference/prisma-client-reference#connect) to link the post with an `id` of 4 to the user with an `id` of 20. The query does this with the following steps:
+In the underlying database, this query uses a [nested `connect` query](/orm/v6/reference/prisma-client-reference#connect) to link the post with an `id` of 4 to the user with an `id` of 20. The query does this with the following steps:
- The query first looks for the user with an `id` of `20`.
- The query then sets the `authorID` foreign key to `20`. This links the post with an `id` of `4` to the user with an `id` of `20`.
@@ -205,9 +194,9 @@ In this query, the current value of `authorID` does not matter. The query change
There are three different types (or [cardinalities]()) of relations in Prisma ORM:
-- [One-to-one](/v6/orm/prisma-schema/data-model/relations/one-to-one-relations) (also called 1-1 relations)
-- [One-to-many](/v6/orm/prisma-schema/data-model/relations/one-to-many-relations) (also called 1-n relations)
-- [Many-to-many](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations) (also called m-n relations)
+- [One-to-one](/orm/v6/prisma-schema/data-model/relations/one-to-one-relations) (also called 1-1 relations)
+- [One-to-many](/orm/v6/prisma-schema/data-model/relations/one-to-many-relations) (also called 1-n relations)
+- [Many-to-many](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations) (also called m-n relations)
The following Prisma schema includes every type of relation:
@@ -271,17 +260,17 @@ model Category {
:::info
-This schema is the same as the [example data model](/v6/orm/prisma-schema/data-model/models) but has all [scalar fields](/v6/orm/prisma-schema/data-model/models#scalar-fields) removed (except for the required [relation scalar fields](/v6/orm/prisma-schema/data-model/relations#relation-scalar-fields)) so you can focus on the [relation fields](#relation-fields).
+This schema is the same as the [example data model](/orm/v6/prisma-schema/data-model/models) but has all [scalar fields](/orm/v6/prisma-schema/data-model/models#scalar-fields) removed (except for the required [relation scalar fields](/orm/v6/prisma-schema/data-model/relations#relation-scalar-fields)) so you can focus on the [relation fields](#relation-fields).
:::
:::info
-This example uses [implicit many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations). These relations do not require the `@relation` attribute unless you need to [disambiguate relations](#disambiguating-relations).
+This example uses [implicit many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations). These relations do not require the `@relation` attribute unless you need to [disambiguate relations](#disambiguating-relations).
:::
-Notice that the syntax is slightly different between relational databases and MongoDB - particularly for [many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations).
+Notice that the syntax is slightly different between relational databases and MongoDB - particularly for [many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations).
For relational databases, the following entity relationship diagram represents the database that corresponds to the sample Prisma schema:
@@ -293,25 +282,25 @@ For MongoDB, Prisma ORM uses a [normalized data model design](https://www.mongod
Many-to-many relations in relational databases can be modelled in two ways:
-- [explicit many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations), where the relation table is represented as an explicit model in your Prisma schema
-- [implicit many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations), where Prisma ORM manages the relation table and it does not appear in the Prisma schema.
+- [explicit many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations), where the relation table is represented as an explicit model in your Prisma schema
+- [implicit many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations), where Prisma ORM manages the relation table and it does not appear in the Prisma schema.
Implicit many-to-many relations require both models to have a single `@id`. Be aware of the following:
-- You cannot use a [multi-field ID](/v6/orm/reference/prisma-schema-reference#id-1)
+- You cannot use a [multi-field ID](/orm/v6/reference/prisma-schema-reference#id-1)
- You cannot use a `@unique` in place of an `@id`
To use either of these features, you must set up an explicit many-to-many instead.
The implicit many-to-many relation still manifests in a relation table in the underlying database. However, Prisma ORM manages this relation table.
-If you use an implicit many-to-many relation instead of an explicit one, it makes the [Prisma Client API](/v6/orm/prisma-client/setup-and-configuration/introduction) simpler (because, for example, you have one fewer level of nesting inside of [nested writes](/v6/orm/prisma-client/queries/relation-queries#nested-writes)).
+If you use an implicit many-to-many relation instead of an explicit one, it makes the [Prisma Client API](/orm/v6/prisma-client/setup-and-configuration/introduction) simpler (because, for example, you have one fewer level of nesting inside of [nested writes](/orm/v6/prisma-client/queries/relation-queries#nested-writes)).
-If you're not using Prisma Migrate but obtain your data model from [introspection](/v6/orm/prisma-schema/introspection), you can still make use of implicit many-to-many relations by following Prisma ORM's [conventions for relation tables](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#conventions-for-relation-tables-in-implicit-m-n-relations).
+If you're not using Prisma Migrate but obtain your data model from [introspection](/orm/v6/prisma-schema/introspection), you can still make use of implicit many-to-many relations by following Prisma ORM's [conventions for relation tables](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#conventions-for-relation-tables-in-implicit-m-n-relations).
## Relation fields
-Relation [fields](/v6/orm/prisma-schema/data-model/models#defining-fields) are fields on a Prisma [model](/v6/orm/prisma-schema/data-model/models#defining-models) that do _not_ have a [scalar type](/v6/orm/prisma-schema/data-model/models#scalar-fields). Instead, their type is another model.
+Relation [fields](/orm/v6/prisma-schema/data-model/models#defining-fields) are fields on a Prisma [model](/orm/v6/prisma-schema/data-model/models#defining-models) that do _not_ have a [scalar type](/orm/v6/prisma-schema/data-model/models#scalar-fields). Instead, their type is another model.
Every relation must have exactly two relation fields, one on each model. In the case of one-to-one and one-to-many relations, an additional _relation scalar field_ is required which gets linked by one of the two relation fields in the `@relation` attribute. This relation scalar field is the direct representation of the _foreign key_ in the underlying database.
@@ -386,17 +375,17 @@ Because a relation scalar field always _belongs_ to a relation field, the follow
## The `@relation` attribute
-The [`@relation`](/v6/orm/reference/prisma-schema-reference#relation) attribute can only be applied to the [relation fields](#relation-fields), not to [scalar fields](/v6/orm/prisma-schema/data-model/models#scalar-fields).
+The [`@relation`](/orm/v6/reference/prisma-schema-reference#relation) attribute can only be applied to the [relation fields](#relation-fields), not to [scalar fields](/orm/v6/prisma-schema/data-model/models#scalar-fields).
The `@relation` attribute is required when:
- you define a one-to-one or one-to-many relation, it is required on _one side_ of the relation (with the corresponding relation scalar field)
- you need to disambiguate a relation (that's e.g. the case when you have two relations between the same models)
-- you define a [self-relation](/v6/orm/prisma-schema/data-model/relations/self-relations)
-- you define [a many-to-many relation for MongoDB](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#mongodb)
+- you define a [self-relation](/orm/v6/prisma-schema/data-model/relations/self-relations)
+- you define [a many-to-many relation for MongoDB](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#mongodb)
- you need to control how the relation table is represented in the underlying database (e.g. use a specific name for a relation table)
-> **Note**: [Implicit many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations) in relational databases do not require the `@relation` attribute.
+> **Note**: [Implicit many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations) in relational databases do not require the `@relation` attribute.
## Disambiguating relations
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/many-to-many-relations.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/many-to-many-relations.mdx
similarity index 96%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/many-to-many-relations.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/many-to-many-relations.mdx
index 07c53b337a..49a74f3486 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/many-to-many-relations.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/many-to-many-relations.mdx
@@ -1,7 +1,7 @@
---
title: Many-to-many relations
description: How to define and work with many-to-many relations in Prisma.
-url: /v6/orm/prisma-schema/data-model/relations/many-to-many-relations
+url: /orm/v6/prisma-schema/data-model/relations/many-to-many-relations
metaTitle: Many-to-many relations
metaDescription: How to define and work with many-to-many relations in Prisma.
---
@@ -25,7 +25,7 @@ Prisma schema syntax and the implementation in the underlying database differs b
## Relational databases
-In relational databases, m-n-relations are typically modelled via [relation tables](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#relation-tables). m-n-relations can be either [explicit](#explicit-many-to-many-relations) or [implicit](#implicit-many-to-many-relations) in the Prisma schema. We recommend using [implicit](#implicit-many-to-many-relations) m-n-relations if you do not need to store any additional meta-data in the relation table itself. You can always migrate to an [explicit](#explicit-many-to-many-relations) m-n-relation later if needed.
+In relational databases, m-n-relations are typically modelled via [relation tables](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#relation-tables). m-n-relations can be either [explicit](#explicit-many-to-many-relations) or [implicit](#implicit-many-to-many-relations) in the Prisma schema. We recommend using [implicit](#implicit-many-to-many-relations) m-n-relations if you do not need to store any additional meta-data in the relation table itself. You can always migrate to an [explicit](#explicit-many-to-many-relations) m-n-relation later if needed.
### Explicit many-to-many relations
@@ -94,9 +94,9 @@ ALTER TABLE "CategoriesOnPosts" ADD CONSTRAINT "CategoriesOnPosts_postId_fkey" F
ALTER TABLE "CategoriesOnPosts" ADD CONSTRAINT "CategoriesOnPosts_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
```
-Note that the same rules as for [1-n relations](/v6/orm/prisma-schema/data-model/relations/one-to-many-relations) apply (because `Post`↔ `CategoriesOnPosts` and `Category` ↔ `CategoriesOnPosts` are both in fact 1-n relations), which means one side of the relation needs to be annotated with the `@relation` attribute.
+Note that the same rules as for [1-n relations](/orm/v6/prisma-schema/data-model/relations/one-to-many-relations) apply (because `Post`↔ `CategoriesOnPosts` and `Category` ↔ `CategoriesOnPosts` are both in fact 1-n relations), which means one side of the relation needs to be annotated with the `@relation` attribute.
-When you don't need to attach additional information to the relation, you can model m-n-relations as [implicit m-n-relations](#implicit-many-to-many-relations). If you're not using Prisma Migrate but obtain your data model from [introspection](/v6/orm/prisma-schema/introspection), you can still make use of implicit m-n-relations by following Prisma ORM's [conventions for relation tables](#conventions-for-relation-tables-in-implicit-m-n-relations).
+When you don't need to attach additional information to the relation, you can model m-n-relations as [implicit m-n-relations](#implicit-many-to-many-relations). If you're not using Prisma Migrate but obtain your data model from [introspection](/orm/v6/prisma-schema/introspection), you can still make use of implicit m-n-relations by following Prisma ORM's [conventions for relation tables](#conventions-for-relation-tables-in-implicit-m-n-relations).
#### Querying an explicit many-to-many
@@ -252,7 +252,7 @@ const getAssignments = await prisma.categoriesOnPosts.findMany({
Implicit m-n relations define relation fields as lists on both sides of the relation. Although the relation table exists in the underlying database, **it is managed by Prisma ORM and does not manifest in the Prisma schema**. Implicit relation tables follow a [specific convention](#conventions-for-relation-tables-in-implicit-m-n-relations).
-Implicit m-n-relations makes the [Prisma Client API](/v6/orm/prisma-client/setup-and-configuration/introduction) for m-n-relations a bit simpler (since you have one fewer level of nesting inside of [nested writes](/v6/orm/prisma-client/queries/relation-queries#nested-writes)).
+Implicit m-n-relations makes the [Prisma Client API](/orm/v6/prisma-client/setup-and-configuration/introduction) for m-n-relations a bit simpler (since you have one fewer level of nesting inside of [nested writes](/orm/v6/prisma-client/queries/relation-queries#nested-writes)).
In the example below, there's one _implicit_ m-n-relation between `Post` and `Category`:
@@ -330,10 +330,10 @@ const getPostsAndCategories = await prisma.post.findMany({
Implicit m-n relations:
- Use a specific [convention for relation tables](#conventions-for-relation-tables-in-implicit-m-n-relations)
-- Do **not** require the `@relation` attribute unless you need to [disambiguate relations](/v6/orm/prisma-schema/data-model/relations#disambiguating-relations) with a name, e.g. `@relation("MyRelation")` or `@relation(name: "MyRelation")`.
+- Do **not** require the `@relation` attribute unless you need to [disambiguate relations](/orm/v6/prisma-schema/data-model/relations#disambiguating-relations) with a name, e.g. `@relation("MyRelation")` or `@relation(name: "MyRelation")`.
- If you do use the `@relation` attribute, you cannot use the `references`, `fields`, `onUpdate` or `onDelete` arguments. This is because these take a fixed value for implicit m-n-relations and cannot be changed.
- Require both models to have a single `@id`. Be aware that:
- - You cannot use a [multi-field ID](/v6/orm/reference/prisma-schema-reference#id-1)
+ - You cannot use a [multi-field ID](/orm/v6/reference/prisma-schema-reference#id-1)
- You cannot use a `@unique` in place of an `@id`
:::info
@@ -344,7 +344,7 @@ Implicit m-n relations:
#### Conventions for relation tables in implicit m-n relations
-If you obtain your data model from [introspection](/v6/orm/prisma-schema/introspection), you can still use implicit m-n-relations by following Prisma ORM's [conventions for relation tables](#conventions-for-relation-tables-in-implicit-m-n-relations). The following example assumes you want to create a relation table to get an implicit m-n-relation for two models called `Post` and `Category`.
+If you obtain your data model from [introspection](/orm/v6/prisma-schema/introspection), you can still use implicit m-n-relations by following Prisma ORM's [conventions for relation tables](#conventions-for-relation-tables-in-implicit-m-n-relations). The following example assumes you want to create a relation table to get an implicit m-n-relation for two models called `Post` and `Category`.
##### Relation table
@@ -361,7 +361,7 @@ When creating an implicit m-n-relation yourself in the Prisma schema file, you c
###### Multi-schema
-If your implicit many-to-many relationship spans multiple database schemas (using the [`multiSchema` feature](/v6/orm/prisma-schema/data-model/multi-schema)), the relation table (with the name defined directly above, in the example `_CategoryToPost`) must be present in the same database schema as the first model in alphabetical order (in this case `Category`).
+If your implicit many-to-many relationship spans multiple database schemas (using the [`multiSchema` feature](/orm/v6/prisma-schema/data-model/multi-schema)), the relation table (with the name defined directly above, in the example `_CategoryToPost`) must be present in the same database schema as the first model in alphabetical order (in this case `Category`).
##### Columns
@@ -505,9 +505,9 @@ Prisma ORM validates m-n-relations in MongoDB with the following rules:
- The `fields` argument must have only one scalar field defined, which must be of a list type
- The `references` argument must have only one scalar field defined. This scalar field must exist on the referenced model and must be of the same type as the scalar field in the `fields` argument, but singular (no list)
- The scalar field to which `references` points must have the `@id` attribute
-- No [referential actions](/v6/orm/prisma-schema/data-model/relations/referential-actions) are allowed in `@relation`
+- No [referential actions](/orm/v6/prisma-schema/data-model/relations/referential-actions) are allowed in `@relation`
-The implicit m-n-relations [used in relational databases](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations) are not supported on MongoDB.
+The implicit m-n-relations [used in relational databases](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations) are not supported on MongoDB.
### Querying MongoDB many-to-many relations
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/meta.json b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/one-to-many-relations.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/one-to-many-relations.mdx
similarity index 96%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/one-to-many-relations.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/one-to-many-relations.mdx
index ce2453bf82..d2f0b2e8a9 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/one-to-many-relations.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/one-to-many-relations.mdx
@@ -1,7 +1,7 @@
---
title: One-to-many relations
description: How to define and work with one-to-many relations in Prisma.
-url: /v6/orm/prisma-schema/data-model/relations/one-to-many-relations
+url: /orm/v6/prisma-schema/data-model/relations/one-to-many-relations
metaTitle: One-to-many relations
metaDescription: How to define and work with one-to-many relations in Prisma.
---
@@ -47,7 +47,7 @@ model Post {
}
```
-> **Note** The `posts` field does not "manifest" in the underlying database schema. On the other side of the relation, the [annotated relation field](/v6/orm/prisma-schema/data-model/relations#relation-fields) `author` and its relation scalar `authorId` represent the side of the relation that stores the foreign key in the underlying database.
+> **Note** The `posts` field does not "manifest" in the underlying database schema. On the other side of the relation, the [annotated relation field](/orm/v6/prisma-schema/data-model/relations#relation-fields) `author` and its relation scalar `authorId` represent the side of the relation that stores the foreign key in the underlying database.
This one-to-many relation expresses the following:
@@ -92,7 +92,7 @@ In MySQL, you can create a foreign key with only an index on the referenced side
## Multi-field relations in relational databases
-In **relational databases only**, you can also define this relation using [multi-field IDs](/v6/orm/reference/prisma-schema-reference#id-1)/composite key:
+In **relational databases only**, you can also define this relation using [multi-field IDs](/orm/v6/reference/prisma-schema-reference#id-1)/composite key:
```prisma
model User {
@@ -185,8 +185,8 @@ In MongoDB, the only difference between a 1-1 and a 1-n is the number of documen
A 1-n-relation always has two relation fields:
-- a [list](/v6/orm/prisma-schema/data-model/models#type-modifiers) relation field which is _not_ annotated with `@relation`
-- the [annotated relation field](/v6/orm/prisma-schema/data-model/relations#annotated-relation-fields) (including its relation scalar)
+- a [list](/orm/v6/prisma-schema/data-model/models#type-modifiers) relation field which is _not_ annotated with `@relation`
+- the [annotated relation field](/orm/v6/prisma-schema/data-model/relations#annotated-relation-fields) (including its relation scalar)
The annotated relation field and relation scalar of a 1-n relation can either _both_ be optional, or _both_ be mandatory. On the other side of the relation, the list is **always mandatory**.
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/one-to-one-relations.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/one-to-one-relations.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/one-to-one-relations.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/one-to-one-relations.mdx
index 9ae61504ee..6beb3e2a01 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/one-to-one-relations.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/one-to-one-relations.mdx
@@ -1,7 +1,7 @@
---
title: One-to-one relations
description: How to define and work with one-to-one relations in Prisma.
-url: /v6/orm/prisma-schema/data-model/relations/one-to-one-relations
+url: /orm/v6/prisma-schema/data-model/relations/one-to-one-relations
metaTitle: One-to-one relations
metaDescription: How to define and work with one-to-one relations in Prisma.
---
@@ -53,7 +53,7 @@ model Profile {
The `userId` relation scalar is a direct representation of the foreign key in the underlying database. This one-to-one relation expresses the following:
-- "a user can have zero profiles or one profile" (because the `profile` field is [optional](/v6/orm/prisma-schema/data-model/models#type-modifiers) on `User`)
+- "a user can have zero profiles or one profile" (because the `profile` field is [optional](/orm/v6/prisma-schema/data-model/models#type-modifiers) on `User`)
- "a profile must always be connected to one user"
In the previous example, the `user` relation field of the `Profile` model references the `id` field of the `User` model. You can also reference a different field. In this case, you need to mark the field with the `@unique` attribute, to guarantee that there is only a single `User` connected to each `Profile`. In the following example, the `user` field references an `email` field in the `User` model, which is marked with the `@unique` attribute:
@@ -94,7 +94,7 @@ In MySQL, you can create a foreign key with only an index on the referenced side
## Multi-field relations in relational databases
-In **relational databases only**, you can also use [multi-field IDs](/v6/orm/reference/prisma-schema-reference#id-1) to define a 1-1 relation:
+In **relational databases only**, you can also use [multi-field IDs](/orm/v6/reference/prisma-schema-reference#id-1) to define a 1-1 relation:
```prisma
model User {
@@ -132,7 +132,7 @@ CREATE TABLE "Profile" (
);
```
-Notice that there is a `UNIQUE` constraint on the foreign key `userId`. If this `UNIQUE` constraint was missing, the relation would be considered a [1-n relation](/v6/orm/prisma-schema/data-model/relations/one-to-many-relations).
+Notice that there is a `UNIQUE` constraint on the foreign key `userId`. If this `UNIQUE` constraint was missing, the relation would be considered a [1-n relation](/orm/v6/prisma-schema/data-model/relations/one-to-many-relations).
The following example demonstrates how to create a 1-1 relation in SQL using a composite key (`firstName` and `lastName`):
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/quick-fix-index.snagx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/quick-fix-index.snagx
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/quick-fix-index.snagx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/quick-fix-index.snagx
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/referential-actions/index.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/referential-actions/index.mdx
similarity index 92%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/referential-actions/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/referential-actions/index.mdx
index 3962f08b92..42ebe8dcc7 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/referential-actions/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/referential-actions/index.mdx
@@ -1,7 +1,7 @@
---
title: Referential actions
description: Referential actions let you define the update and delete behavior of related models on the database level
-url: /v6/orm/prisma-schema/data-model/relations/referential-actions
+url: /orm/v6/prisma-schema/data-model/relations/referential-actions
metaTitle: Referential actions
metaDescription: Referential actions let you define the update and delete behavior of related models on the database level
---
@@ -15,7 +15,7 @@ From version 2.26.0, you can define referential actions on the relation fields i
**Version differences**
- If you use version 3.0.1 or later, you can use referential actions as described on this page.
-- If you use a version between 2.26.0 and 3.0.0, you can use referential actions as described on this page, but you must [enable the preview feature flag](/v6/orm/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature) `referentialActions`.
+- If you use a version between 2.26.0 and 3.0.0, you can use referential actions as described on this page, but you must [enable the preview feature flag](/orm/v6/reference/preview-features/client-preview-features#enabling-a-prisma-client-preview-feature) `referentialActions`.
- If you use version 2.25.0 or earlier, you can configure cascading deletes manually in your database.
:::
@@ -50,13 +50,13 @@ If you do not specify a referential action, Prisma ORM [uses a default](#referen
:::danger
If you upgrade from a version earlier than 2.26.0:
-It is extremely important that you check the [upgrade paths for referential actions](/v6/orm/more/upgrades/older-versions#referential-actions) section. Prisma ORM's support of referential actions **removes the safety net in Prisma Client that prevents cascading deletes at runtime**. If you use the feature _without upgrading your database_, the [old default action](/v6/orm/more/upgrades/older-versions#referential-actions) - `ON DELETE CASCADE` - becomes active. This might result in cascading deletes that you did not expect.
+It is extremely important that you check the [upgrade paths for referential actions](/orm/v6/more/upgrades/older-versions#referential-actions) section. Prisma ORM's support of referential actions **removes the safety net in Prisma Client that prevents cascading deletes at runtime**. If you use the feature _without upgrading your database_, the [old default action](/orm/v6/more/upgrades/older-versions#referential-actions) - `ON DELETE CASCADE` - becomes active. This might result in cascading deletes that you did not expect.
:::
## What are referential actions?
-Referential actions are policies that define how a referenced record is handled by the database when you run an [`update`](/v6/orm/prisma-client/queries/crud#update) or [`delete`](/v6/orm/prisma-client/queries/crud#delete) query.
+Referential actions are policies that define how a referenced record is handled by the database when you run an [`update`](/orm/v6/prisma-client/queries/crud#update) or [`delete`](/orm/v6/prisma-client/queries/crud#delete) query.
@@ -64,7 +64,7 @@ Referential actions are policies that define how a referenced record is handled
Referential actions are features of foreign key constraints that exist to preserve referential integrity in your database.
-When you define relationships between data models in your Prisma schema, you use [relation fields](/v6/orm/prisma-schema/data-model/relations#relation-fields), **which do not exist on the database**, and [scalar fields](/v6/orm/prisma-schema/data-model/models#scalar-fields), **which do exist on the database**. These foreign keys connect the models on the database level.
+When you define relationships between data models in your Prisma schema, you use [relation fields](/orm/v6/prisma-schema/data-model/relations#relation-fields), **which do not exist on the database**, and [scalar fields](/orm/v6/prisma-schema/data-model/models#scalar-fields), **which do exist on the database**. These foreign keys connect the models on the database level.
Referential integrity states that these foreign keys must reference an existing primary key value in the related database table. In your Prisma schema, this is generally represented by the `id` field on the related model.
@@ -74,7 +74,7 @@ By default a database will reject any operation that violates the referential in
### How to use referential actions
-Referential actions are defined in the [`@relation`](/v6/orm/reference/prisma-schema-reference#relation) attribute and map to the actions on the **foreign key constraint** in the underlying database. If you do not specify a referential action, [Prisma ORM falls back to a default](#referential-action-defaults).
+Referential actions are defined in the [`@relation`](/orm/v6/reference/prisma-schema-reference#relation) attribute and map to the actions on the **foreign key constraint** in the underlying database. If you do not specify a referential action, [Prisma ORM falls back to a default](#referential-action-defaults).
The following model defines a one-to-many relation between `User` and `Post` and a many-to-many relation between `Post` and `Tag`, with explicitly defined referential actions:
@@ -151,7 +151,7 @@ The schema does not explicitly define referential actions on the mandatory `auth
The following caveats apply:
-- Referential actions are **not** supported on [implicit many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations). To use referential actions, you must define an explicit many-to-many relation and define your referential actions on the [join table](/v6/orm/prisma-schema/data-model/relations/troubleshooting-relations#how-to-use-a-relation-table-with-a-many-to-many-relationship).
+- Referential actions are **not** supported on [implicit many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations). To use referential actions, you must define an explicit many-to-many relation and define your referential actions on the [join table](/orm/v6/prisma-schema/data-model/relations/troubleshooting-relations#how-to-use-a-relation-table-with-a-many-to-many-relationship).
- Certain combinations of referential actions and required/optional relations are incompatible. For example, using `SetNull` on a required relation will lead to database errors when deleting referenced records because the non-nullable constraint would be violated. See [this GitHub issue](https://github.com/prisma/prisma/issues/7909) for more information.
## Types of referential actions
@@ -222,17 +222,7 @@ If a `User` record is deleted, then their posts are deleted too. If the user's `
##### How to use cascading deletes
-
-
-
+
### `Restrict`
@@ -261,7 +251,7 @@ model User {
:::warning
-The `Restrict` action is **not** available on [Microsoft SQL Server](/v6/orm/overview/databases/sql-server) and triggers a schema validation error. Instead, you can use [`NoAction`](#noaction), which produces the same result and is compatible with SQL Server.
+The `Restrict` action is **not** available on [Microsoft SQL Server](/orm/v6/overview/databases/sql-server) and triggers a schema validation error. Instead, you can use [`NoAction`](#noaction), which produces the same result and is compatible with SQL Server.
:::
@@ -277,7 +267,7 @@ The `NoAction` action is similar to `Restrict`, the difference between the two i
:::warning
-If you are [managing relations in Prisma Client](/v6/orm/prisma-schema/data-model/relations/relation-mode#emulate-relations-in-prisma-orm-with-the-prisma-relation-mode) rather than using foreign keys in the database, you should be aware that currently Prisma ORM only implements the referential actions. Foreign keys also create constraints, which make it impossible to manipulate data in a way that would violate these constraints: instead of executing the query, the database responds with an error. These constraints will not be created if you emulate referential integrity in Prisma Client, so if you set the referential action to `NoAction` there will be no checks to prevent you from breaking the referential integrity.
+If you are [managing relations in Prisma Client](/orm/v6/prisma-schema/data-model/relations/relation-mode#emulate-relations-in-prisma-orm-with-the-prisma-relation-mode) rather than using foreign keys in the database, you should be aware that currently Prisma ORM only implements the referential actions. Foreign keys also create constraints, which make it impossible to manipulate data in a way that would violate these constraints: instead of executing the query, the database responds with an error. These constraints will not be created if you emulate referential integrity in Prisma Client, so if you set the referential action to `NoAction` there will be no checks to prevent you from breaking the referential integrity.
:::
@@ -335,7 +325,7 @@ When changing a `User`'s `id`, the `authorId` will be set to `NULL` for all its
- `onUpdate: SetDefault` The scalar field of the referencing object will be set to the fields default value.
-These require setting a default for the relation scalar field with [`@default`](/v6/orm/reference/prisma-schema-reference#default). If no defaults are provided for any of the scalar fields, a runtime error will be thrown.
+These require setting a default for the relation scalar field with [`@default`](/orm/v6/reference/prisma-schema-reference#default). If no defaults are provided for any of the scalar fields, a runtime error will be thrown.
```prisma title="schema.prisma" highlight=4,5;add showLineNumbers
model Post {
@@ -359,7 +349,7 @@ When the `username` of a `User` changes, its existing posts' `authorUsername` fi
### Database-specific requirements
-MongoDB and SQL Server have specific requirements for referential actions if you have [self-relations](/v6/orm/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions#self-relation-sql-server-and-mongodb) or [cyclic relations](/v6/orm/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions#cyclic-relation-between-three-tables-sql-server-and-mongodb) in your data model. SQL Server also has specific requirements if you have relations with [multiple cascade paths](/v6/orm/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions#multiple-cascade-paths-between-two-models-sql-server-only).
+MongoDB and SQL Server have specific requirements for referential actions if you have [self-relations](/orm/v6/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions#self-relation-sql-server-and-mongodb) or [cyclic relations](/orm/v6/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions#cyclic-relation-between-three-tables-sql-server-and-mongodb) in your data model. SQL Server also has specific requirements if you have relations with [multiple cascade paths](/orm/v6/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions#multiple-cascade-paths-between-two-models-sql-server-only).
## Upgrade paths from versions 2.25.0 and earlier
@@ -373,7 +363,7 @@ The following assumes you have upgraded to 2.26.0 or newer and enabled the previ
### Using Introspection
-If you [Introspect](/v6/orm/prisma-schema/introspection) your database, the referential actions configured at the database level will be reflected in your Prisma Schema. If you have been using Prisma Migrate or `prisma db push` to manage the database schema, these are likely to be the [default values](#referential-action-defaults) from 2.25.0 and earlier.
+If you [Introspect](/orm/v6/prisma-schema/introspection) your database, the referential actions configured at the database level will be reflected in your Prisma Schema. If you have been using Prisma Migrate or `prisma db push` to manage the database schema, these are likely to be the [default values](#referential-action-defaults) from 2.25.0 and earlier.
When you run an Introspection, Prisma ORM compares all the foreign keys in the database with the schema, if the SQL statements `ON DELETE` and `ON UPDATE` do **not** match the default values, they will be explicitly set in the schema file.
@@ -381,7 +371,7 @@ After introspecting, you can review the non-default clauses in your schema. The
:::warning
-If you are using either the [`delete()`](/v6/orm/prisma-client/queries/crud#delete-a-single-record) or [`deleteMany()`](/v6/orm/prisma-client/queries/crud#delete-all-records) methods, **[cascading deletes](#how-to-use-cascading-deletes) will now be performed** as the `referentialActions` preview feature **removed the safety net in Prisma Client that previously prevented cascading deletes at runtime**. Be sure to check your code and make any adjustments accordingly.
+If you are using either the [`delete()`](/orm/v6/prisma-client/queries/crud#delete-a-single-record) or [`deleteMany()`](/orm/v6/prisma-client/queries/crud#delete-all-records) methods, **[cascading deletes](#how-to-use-cascading-deletes) will now be performed** as the `referentialActions` preview feature **removed the safety net in Prisma Client that previously prevented cascading deletes at runtime**. Be sure to check your code and make any adjustments accordingly.
:::
@@ -413,7 +403,7 @@ model User {
### Using Migration
-When running a [Migration](/v6/orm/prisma-migrate/getting-started) (or the [`prisma db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) command) the [new defaults](#referential-action-defaults) will be applied to your database.
+When running a [Migration](/orm/v6/prisma-migrate/getting-started) (or the [`prisma db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) command) the [new defaults](#referential-action-defaults) will be applied to your database.
:::info
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/referential-actions/meta.json b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/referential-actions/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/referential-actions/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/referential-actions/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions.mdx
index 9b3ae2896f..97a871fd73 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions.mdx
@@ -1,7 +1,7 @@
---
title: Special rules for referential actions in SQL Server and MongoDB
description: 'Circular references or multiple cascade paths can cause validation errors on Microsoft SQL Server and MongoDB. Since the database does not handle these situations out of the box, learn how to solve this problem.'
-url: /v6/orm/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions
+url: /orm/v6/prisma-schema/data-model/relations/referential-actions/special-rules-for-referential-actions
metaTitle: Special rules for referential actions in SQL Server and MongoDB
metaDescription: 'Circular references or multiple cascade paths can cause validation errors on Microsoft SQL Server and MongoDB. Since the database does not handle these situations out of the box, learn how to solve this problem.'
---
@@ -14,7 +14,7 @@ Some databases have specific requirements that you should consider if you are us
- Microsoft SQL Server doesn't allow cascading referential actions on a foreign key, if the relation chain causes a cycle or multiple cascade paths. If the referential actions on the foreign key are set to something other than `NO ACTION` (or `NoAction` if Prisma ORM is managing referential integrity), the server will check for cycles or multiple cascade paths and return an error when executing the SQL.
-- With MongoDB, using referential actions in Prisma ORM requires that for any data model with self-referential relations or cycles between three models, you must set the referential action of `NoAction` to prevent the referential action emulations from looping infinitely. Be aware that by default, the `relationMode = "prisma"` mode is used for MongoDB, which means that Prisma ORM manages [referential integrity](/v6/orm/prisma-schema/data-model/relations/relation-mode).
+- With MongoDB, using referential actions in Prisma ORM requires that for any data model with self-referential relations or cycles between three models, you must set the referential action of `NoAction` to prevent the referential action emulations from looping infinitely. Be aware that by default, the `relationMode = "prisma"` mode is used for MongoDB, which means that Prisma ORM manages [referential integrity](/orm/v6/prisma-schema/data-model/relations/relation-mode).
Given the SQL:
@@ -67,7 +67,7 @@ This will result in the following error:
Error parsing attribute "@relation": A self-relation must have `onDelete` and `onUpdate` referential actions set to `NoAction` in one of the @relation attributes. (Implicit default `onDelete`: `SetNull`, and `onUpdate`: `Cascade`)
```
-By not defining any actions, Prisma ORM will use the following default values depending if the underlying [scalar fields](/v6/orm/prisma-schema/data-model/models#scalar-fields) are set to be optional or required.
+By not defining any actions, Prisma ORM will use the following default values depending if the underlying [scalar fields](/orm/v6/prisma-schema/data-model/models#scalar-fields) are set to be optional or required.
| Clause | All of the scalar fields are optional | At least one scalar field is required |
| :--------- | :------------------------------------ | :------------------------------------ |
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/relation-mode.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/relation-mode.mdx
similarity index 94%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/relation-mode.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/relation-mode.mdx
index 367436bafd..4d91e5a218 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/relation-mode.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/relation-mode.mdx
@@ -1,7 +1,7 @@
---
title: Relation mode
description: Manage relations between records with relation modes in Prisma
-url: /v6/orm/prisma-schema/data-model/relations/relation-mode
+url: /orm/v6/prisma-schema/data-model/relations/relation-mode
metaTitle: Manage relations between records with relation modes in Prisma
metaDescription: Manage relations between records with relation modes in Prisma
---
@@ -15,7 +15,7 @@ metaDescription: Manage relations between records with relation modes in Prisma
-In Prisma schema, relations between records are defined with the [`@relation`](/v6/orm/reference/prisma-schema-reference#relation) attribute. For example, in the following schema there is a one-to-many relation between the `User` and `Post` models:
+In Prisma schema, relations between records are defined with the [`@relation`](/orm/v6/reference/prisma-schema-reference#relation) attribute. For example, in the following schema there is a one-to-many relation between the `User` and `Post` models:
```prisma title="schema.prisma" highlight=4,5,10;normal showLineNumbers
model Post {
@@ -36,7 +36,7 @@ Prisma ORM has two _relation modes_, `foreignKeys` and `prisma`, that specify ho
If you use Prisma ORM with a relational database, then by default Prisma ORM uses the [`foreignKeys` relation mode](#handle-relations-in-your-relational-database-with-the-foreignkeys-relation-mode), which enforces relations between records at the database level with foreign keys. A foreign key is a column or group of columns in one table that take values based on the primary key in another table. Foreign keys allow you to:
- set constraints that prevent you from making changes that break references
-- set [referential actions](/v6/orm/prisma-schema/data-model/relations/referential-actions) that define how changes to records are handled
+- set [referential actions](/orm/v6/prisma-schema/data-model/relations/referential-actions) that define how changes to records are handled
Together these constraints and referential actions guarantee the _referential integrity_ of the data.
@@ -69,7 +69,7 @@ ALTER TABLE "Post" -- [!code highlight]
In this case, the foreign key constraint on the `authorId` column of the `Post` table references the `id` column of the `User` table, and guarantees that a post must have an author that exists. If you update or delete a user then the `ON DELETE` and `ON UPDATE` referential actions specify the `CASCADE` option, which will also delete or update all posts belonging to the user.
-Some databases, such as MongoDB or [PlanetScale](/v6/orm/overview/databases/planetscale#differences-to-consider), do not support foreign keys. Additionally, in some cases developers may prefer not to use foreign keys in their relational database that usually does support foreign keys. For these situations, Prisma ORM offers [the `prisma` relation mode](#emulate-relations-in-prisma-orm-with-the-prisma-relation-mode), which emulates some properties of relations in relational databases. When you use Prisma Client with the `prisma` relation mode enabled, the behavior of queries is identical or similar, but referential actions and some constraints are handled by the Prisma engine rather than in the database.
+Some databases, such as MongoDB or [PlanetScale](/orm/v6/overview/databases/planetscale#differences-to-consider), do not support foreign keys. Additionally, in some cases developers may prefer not to use foreign keys in their relational database that usually does support foreign keys. For these situations, Prisma ORM offers [the `prisma` relation mode](#emulate-relations-in-prisma-orm-with-the-prisma-relation-mode), which emulates some properties of relations in relational databases. When you use Prisma Client with the `prisma` relation mode enabled, the behavior of queries is identical or similar, but referential actions and some constraints are handled by the Prisma engine rather than in the database.
:::warning
There are performance implications to emulation of referential integrity and
@@ -97,7 +97,7 @@ The ability to set the relation mode was introduced as part of the `referentialI
For relational databases, the available options are:
- `foreignKeys`: this handles relations in the database with foreign keys. This is the default option for all relational database connectors and is active if no `relationMode` is explicitly set in the `datasource` block.
-- `prisma`: this emulates relations in Prisma Client. You should also [enable this option](/v6/orm/overview/databases/planetscale#option-1-emulate-relations-in-prisma-client) when you use the MySQL connector with a PlanetScale database and don't have native foreign key constraints enabled in your PlanetScale database settings.
+- `prisma`: this emulates relations in Prisma Client. You should also [enable this option](/orm/v6/overview/databases/planetscale#option-1-emulate-relations-in-prisma-client) when you use the MySQL connector with a PlanetScale database and don't have native foreign key constraints enabled in your PlanetScale database settings.
For MongoDB, the only available option is the `prisma` relation mode. This mode is also active if no `relationMode` is explicitly set in the `datasource` block.
@@ -111,7 +111,7 @@ If you switch between relation modes, Prisma ORM will add or remove foreign keys
The `foreignKeys` relation mode handles relations in your relational database with foreign keys. This is the default option when you use a relational database connector (PostgreSQL, MySQL, SQLite, SQL Server, CockroachDB).
-The `foreignKeys` relation mode is not available when you use the MongoDB connector. Some relational databases, [such as PlanetScale](/v6/orm/overview/databases/planetscale#option-1-emulate-relations-in-prisma-client), also forbid the use of foreign keys. In these cases, you should instead [emulate relations in Prisma ORM with the `prisma` relation mode](#emulate-relations-in-prisma-orm-with-the-prisma-relation-mode).
+The `foreignKeys` relation mode is not available when you use the MongoDB connector. Some relational databases, [such as PlanetScale](/orm/v6/overview/databases/planetscale#option-1-emulate-relations-in-prisma-client), also forbid the use of foreign keys. In these cases, you should instead [emulate relations in Prisma ORM with the `prisma` relation mode](#emulate-relations-in-prisma-orm-with-the-prisma-relation-mode).
### Referential integrity
@@ -125,7 +125,7 @@ When you _create_ or _update_ a record with a relation to another record, the re
When you _update_ or _delete_ a record with a relation to another record, referential actions are triggered in the database. To maintain referential integrity in related records, referential actions prevent changes that would break referential integrity, cascade changes through to related records, or set the value of fields that reference the updated or deleted records to a `null` or default value.
-For more information, see the [referential actions](/v6/orm/prisma-schema/data-model/relations/referential-actions) page.
+For more information, see the [referential actions](/orm/v6/prisma-schema/data-model/relations/referential-actions) page.
### Introspection
@@ -139,7 +139,7 @@ When you apply changes to your Prisma schema with Prisma Migrate or `db push` wi
The `prisma` relation mode emulates some foreign key constraints and referential actions for each Prisma Client query to maintain referential integrity, using some additional database queries and logic.
-The `prisma` relation mode is the default option for the MongoDB connector. It should also be set if you use a relational database that does not support foreign keys. For example, [if you use PlanetScale](/v6/orm/overview/databases/planetscale#option-1-emulate-relations-in-prisma-client) without foreign key constraints, you should use the `prisma` relation mode.
+The `prisma` relation mode is the default option for the MongoDB connector. It should also be set if you use a relational database that does not support foreign keys. For example, [if you use PlanetScale](/orm/v6/overview/databases/planetscale#option-1-emulate-relations-in-prisma-client) without foreign key constraints, you should use the `prisma` relation mode.
:::warning
There are performance implications to emulation of referential integrity in
@@ -198,7 +198,7 @@ When you apply changes to your Prisma schema with Prisma Migrate or `db push` wi
In relational databases that use foreign key constraints, the database usually also implicitly creates an index for the foreign key columns. For example, [MySQL will create an index on all foreign key columns](https://dev.mysql.com/doc/refman/8.0/en/constraint-foreign-key.html#:~:text=MySQL%20requires%20that%20foreign%20key%20columns%20be%20indexed%3B%20if%20you%20create%20a%20table%20with%20a%20foreign%20key%20constraint%20but%20no%20index%20on%20a%20given%20column%2C%20an%20index%20is%20created.). This is to allow foreign key checks to run fast and not require a table scan.
-The `prisma` relation mode does not use foreign keys, so no indexes are created when you use Prisma Migrate or `db push` to apply changes to your database. You instead need to manually add an index on your relation scalar fields with the [`@@index`](/v6/orm/reference/prisma-schema-reference#index) attribute (or the [`@unique`](/v6/orm/reference/prisma-schema-reference#unique), [`@@unique`](/v6/orm/reference/prisma-schema-reference#unique-1) or [`@@id`](/v6/orm/reference/prisma-schema-reference#id-1) attributes, if applicable).
+The `prisma` relation mode does not use foreign keys, so no indexes are created when you use Prisma Migrate or `db push` to apply changes to your database. You instead need to manually add an index on your relation scalar fields with the [`@@index`](/orm/v6/reference/prisma-schema-reference#index) attribute (or the [`@unique`](/orm/v6/reference/prisma-schema-reference#unique), [`@@unique`](/orm/v6/reference/prisma-schema-reference#unique-1) or [`@@id`](/orm/v6/reference/prisma-schema-reference#id-1) attributes, if applicable).
#### Index validation
@@ -240,7 +240,7 @@ model Post {
}
```
-If you use the [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) (or our [language server in another editor](/v6/orm/more/dev-environment/editor-setup)), the warning is augmented with a Quick Fix that adds the required index for you:
+If you use the [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) (or our [language server in another editor](/orm/v6/more/dev-environment/editor-setup)), the warning is augmented with a Quick Fix that adds the required index for you:

@@ -254,7 +254,7 @@ The default relation mode if you use a relational database and do not include th
When you switch the relation mode from `foreignKeys` to `prisma`, after you first apply changes to your schema with Prisma Migrate or `db push` Prisma ORM will remove all previously created foreign keys in the next migration.
-If you keep the same database, you can then continue to work as normal. If you switch to a database that does not support foreign keys at all, your existing migration history contains SQL DDL that creates foreign keys, which might trigger errors if you ever have to rerun these migrations. In this case, we recommend that you delete the `migrations` directory. (If you use PlanetScale, which does not support foreign keys, we generally recommend that you [use `db push` rather than Prisma Migrate](/v6/orm/overview/databases/planetscale#differences-to-consider).)
+If you keep the same database, you can then continue to work as normal. If you switch to a database that does not support foreign keys at all, your existing migration history contains SQL DDL that creates foreign keys, which might trigger errors if you ever have to rerun these migrations. In this case, we recommend that you delete the `migrations` directory. (If you use PlanetScale, which does not support foreign keys, we generally recommend that you [use `db push` rather than Prisma Migrate](/orm/v6/overview/databases/planetscale#differences-to-consider).)
### Switch from `prisma` to `foreignKeys`
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/self-relations.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/self-relations.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/self-relations.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/self-relations.mdx
index eb7dd168ef..eb944eed84 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/self-relations.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/self-relations.mdx
@@ -1,7 +1,7 @@
---
title: Self-relations
description: How to define and work with self-relations in Prisma.
-url: /v6/orm/prisma-schema/data-model/relations/self-relations
+url: /orm/v6/prisma-schema/data-model/relations/self-relations
metaTitle: Self-relations
metaDescription: How to define and work with self-relations in Prisma.
---
@@ -53,7 +53,7 @@ This relation expresses the following:
To create a one-to-one self-relation:
- Both sides of the relation must define a `@relation` attribute that share the same name - in this case, **BlogOwnerHistory**.
-- One relation field must be a [fully annotated](/v6/orm/prisma-schema/data-model/relations#relation-fields). In this example, the `successor` field defines both the `field` and `references` arguments.
+- One relation field must be a [fully annotated](/orm/v6/prisma-schema/data-model/relations#relation-fields). In this example, the `successor` field defines both the `field` and `references` arguments.
- One relation field must be backed by a foreign key. The `successor` field is backed by the `successorId` foreign key, which references a value in the `id` field. The `successorId` scalar relation field also requires a `@unique` attribute to guarantee a one-to-one relation.
> **Note**: One-to-one self relations require two sides even if both sides are equal in the relationship. For example, to model a 'best friends' relation, you would need to create two relation fields: `bestfriend1` and a `bestfriend2`.
@@ -189,7 +189,7 @@ This relation expresses the following:
- "a user has zero or one _teachers_ "
- "a user can have zero or more _students_"
-Note that you can also require each user to have a teacher by making the `teacher` field [required](/v6/orm/prisma-schema/data-model/models#optional-and-mandatory-fields).
+Note that you can also require each user to have a teacher by making the `teacher` field [required](/orm/v6/prisma-schema/data-model/models#optional-and-mandatory-fields).
### One-to-many self-relations in the database
@@ -267,9 +267,9 @@ This relation expresses the following:
- "a user can be followed by zero or more users"
- "a user can follow zero or more users"
-Note that for relational databases, this many-to-many-relation is [implicit](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations). This means Prisma ORM maintains a [relation table](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#relation-tables) for it in the underlying database.
+Note that for relational databases, this many-to-many-relation is [implicit](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations). This means Prisma ORM maintains a [relation table](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#relation-tables) for it in the underlying database.
-If you need the relation to hold other fields, you can create an [explicit](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations) many-to-many self relation as well. The explicit version of the self relation shown previously is as follows:
+If you need the relation to hold other fields, you can create an [explicit](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations) many-to-many self relation as well. The explicit version of the self relation shown previously is as follows:
```prisma
model User {
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/troubleshooting-relations.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/troubleshooting-relations.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/troubleshooting-relations.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/troubleshooting-relations.mdx
index ced271dda0..374eef1e6a 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/relations/troubleshooting-relations.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/relations/troubleshooting-relations.mdx
@@ -1,7 +1,7 @@
---
title: Troubleshooting relations
description: 'Common problems and solutions when defining relations in the Prisma schema, including self-relations and implicit many-to-many relations.'
-url: /v6/orm/prisma-schema/data-model/relations/troubleshooting-relations
+url: /orm/v6/prisma-schema/data-model/relations/troubleshooting-relations
metaTitle: Troubleshooting relations
metaDescription: Common problems and solutions when defining relations in the Prisma schema.
---
@@ -120,9 +120,9 @@ If you rename relation fields in an implicit many-to-many self-relations, make s
## How to use a relation table with a many-to-many relationship
-There are a couple of ways to define an m-n relationship, implicitly or explicitly. Implicitly means letting Prisma ORM handle the relation table (JOIN table) under the hood, all you have to do is define an array/list for the non scalar types on each model, see [implicit many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations).
+There are a couple of ways to define an m-n relationship, implicitly or explicitly. Implicitly means letting Prisma ORM handle the relation table (JOIN table) under the hood, all you have to do is define an array/list for the non scalar types on each model, see [implicit many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations).
-Where you might run into trouble is when creating an [explicit m-n relationship](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations), that is, to create and handle the relation table yourself. **It can be overlooked that Prisma ORM requires both sides of the relation to be present**.
+Where you might run into trouble is when creating an [explicit m-n relationship](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations), that is, to create and handle the relation table yourself. **It can be overlooked that Prisma ORM requires both sides of the relation to be present**.
Take the following example, here a relation table is created to act as the JOIN between the `Post` and `Category` tables. This will not work however as the relation table (`PostCategories`) must form a 1-to-many relationship with the other two models respectively.
@@ -203,7 +203,7 @@ model Category {
}
```
-This however tells Prisma ORM to expect **two** separate one-to-many relationships. See [disambiguating relations](/v6/orm/prisma-schema/data-model/relations#disambiguating-relations) for more information on using the `@relation` attribute.
+This however tells Prisma ORM to expect **two** separate one-to-many relationships. See [disambiguating relations](/orm/v6/prisma-schema/data-model/relations#disambiguating-relations) for more information on using the `@relation` attribute.
The following example is the correct way to define an implicit many-to-many relationship.
@@ -223,7 +223,7 @@ model Category {
}
```
-The `@relation` annotation can also be used to [name the underlying relation table](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#configuring-the-name-of-the-relation-table-in-implicit-many-to-many-relations) created on a implicit many-to-many relationship.
+The `@relation` annotation can also be used to [name the underlying relation table](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#configuring-the-name-of-the-relation-table-in-implicit-many-to-many-relations) created on a implicit many-to-many relationship.
```prisma
model Post {
@@ -247,4 +247,4 @@ Some cloud providers enforce the existence of primary keys in all tables. Howeve
### Solution
-You need to use [explicit relation syntax](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations), manually create the join model, and verify that this join model has a primary key.
+You need to use [explicit relation syntax](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations), manually create the join model, and verify that this join model has a primary key.
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/table-inheritance.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/table-inheritance.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/table-inheritance.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/table-inheritance.mdx
index aeefb03c33..c600ff4001 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/table-inheritance.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/table-inheritance.mdx
@@ -1,7 +1,7 @@
---
title: Table inheritance
description: Learn about the use cases and patterns for table inheritance in Prisma ORM that enable usage of union types or polymorphic structures in your application.
-url: /v6/orm/prisma-schema/data-model/table-inheritance
+url: /orm/v6/prisma-schema/data-model/table-inheritance
metaTitle: Table inheritance
metaDescription: Learn about the use cases and patterns for table inheritance in Prisma ORM that enable usage of union types or polymorphic structures in your application.
---
@@ -179,7 +179,7 @@ const videos: Video[] = videoActivities.map(activityToVideo);
#### Using Prisma Client extension for a more convenient API
-You can use [Prisma Client extensions](/v6/orm/prisma-client/client-extensions) to create a more convenient API for the table structures in your database.
+You can use [Prisma Client extensions](/orm/v6/prisma-client/client-extensions) to create a more convenient API for the table structures in your database.
## Multi-table inheritance (MTI)
@@ -311,7 +311,7 @@ const videos: Video[] = videoWithActivities.map(toVideo);
#### Using Prisma Client extension for a more convenient API
-You can use [Prisma Client extensions](/v6/orm/prisma-client/client-extensions) to create a more convenient API for the table structures in your database.
+You can use [Prisma Client extensions](/orm/v6/prisma-client/client-extensions) to create a more convenient API for the table structures in your database.
## Tradeoffs between STI and MTI
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/unsupported-database-features.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/unsupported-database-features.mdx
similarity index 86%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/unsupported-database-features.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/unsupported-database-features.mdx
index 6696a78881..ee46b52b7e 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/unsupported-database-features.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/unsupported-database-features.mdx
@@ -1,16 +1,16 @@
---
title: Unsupported database features (Prisma Schema)
description: How to support database features that do not have an equivalent syntax in Prisma Schema Language.
-url: /v6/orm/prisma-schema/data-model/unsupported-database-features
+url: /orm/v6/prisma-schema/data-model/unsupported-database-features
metaTitle: 'Prisma schema: Unsupported database features'
metaDescription: How to support database features that do not have an equivalent syntax in Prisma Schema Language.
---
-Not all database functions and features of Prisma ORM's supported databases have a Prisma Schema Language equivalent. Refer to the [database features matrix](/v6/orm/reference/database-features) for a complete list of supported features.
+Not all database functions and features of Prisma ORM's supported databases have a Prisma Schema Language equivalent. Refer to the [database features matrix](/orm/v6/reference/database-features) for a complete list of supported features.
## Native database functions
-Prisma Schema Language supports several [functions](/v6/orm/reference/prisma-schema-reference#attribute-functions) that you can use to set the default value of a field. The following example uses the Prisma ORM-level `uuid()` function to set the value of the `id` field:
+Prisma Schema Language supports several [functions](/orm/v6/reference/prisma-schema-reference#attribute-functions) that you can use to set the default value of a field. The following example uses the Prisma ORM-level `uuid()` function to set the value of the `id` field:
```prisma
model Post {
@@ -18,7 +18,7 @@ model Post {
}
```
-However, you can also use **native database functions** to define default values with [`dbgenerated(...)`](/v6/orm/reference/prisma-schema-reference#dbgenerated) on relational databases (MongoDB does not have the concept of database-level functions). The following example uses the PostgreSQL `gen_random_uuid()` function to populate the `id` field:
+However, you can also use **native database functions** to define default values with [`dbgenerated(...)`](/orm/v6/reference/prisma-schema-reference#dbgenerated) on relational databases (MongoDB does not have the concept of database-level functions). The following example uses the PostgreSQL `gen_random_uuid()` function to populate the `id` field:
```prisma
model User {
@@ -49,7 +49,7 @@ In PostgreSQL, some native database functions are part of an extension. For exam
To use a PostgreSQL extension, you must first install it on the file system of your database server.
-In Prisma ORM versions 4.5.0 and later, you can then activate the extension by declaring it in your Prisma schema with the [`postgresqlExtensions` preview feature](/v6/orm/prisma-schema/postgresql-extensions):
+In Prisma ORM versions 4.5.0 and later, you can then activate the extension by declaring it in your Prisma schema with the [`postgresqlExtensions` preview feature](/orm/v6/prisma-schema/postgresql-extensions):
```prisma title="schema.prisma" highlight=3,9;add showLineNumbers
generator client {
@@ -72,7 +72,7 @@ In earlier versions of Prisma ORM, you must instead run a SQL command to activat
CREATE EXTENSION IF NOT EXISTS pgcrypto;
````
-If your project uses [Prisma Migrate](/v6/orm/prisma-migrate/getting-started), you must [install the extension as part of a migration](/v6/orm/prisma-migrate/workflows/native-database-functions) . Do not install the extension manually, because it is also required by the shadow database.
+If your project uses [Prisma Migrate](/orm/v6/prisma-migrate/getting-started), you must [install the extension as part of a migration](/orm/v6/prisma-migrate/workflows/native-database-functions) . Do not install the extension manually, because it is also required by the shadow database.
Prisma Migrate returns the following error if the extension is not available:
@@ -83,7 +83,7 @@ Database error: Error querying the database: db error: ERROR: type "pgcrypto" do
## Unsupported field types
-Some database types of relational databases, such as `polygon` or `geometry`, do not have a Prisma Schema Language equivalent. Use the [`Unsupported`](/v6/orm/reference/prisma-schema-reference#unsupported) field type to represent the field in your Prisma schema:
+Some database types of relational databases, such as `polygon` or `geometry`, do not have a Prisma Schema Language equivalent. Use the [`Unsupported`](/orm/v6/reference/prisma-schema-reference#unsupported) field type to represent the field in your Prisma schema:
```prisma highlight=3;normal
model Star {
@@ -96,4 +96,4 @@ The `prisma migrate dev` and `prisma db push` command will both create a `positi
## Unsupported database features
-Some features, like SQL views or partial indexes, cannot be represented in the Prisma schema. If your project uses [Prisma Migrate](/v6/orm/prisma-migrate/getting-started), you must [include unsupported features as part of a migration](/v6/orm/prisma-migrate/workflows/unsupported-database-features) .
+Some features, like SQL views or partial indexes, cannot be represented in the Prisma schema. If your project uses [Prisma Migrate](/orm/v6/prisma-migrate/getting-started), you must [include unsupported features as part of a migration](/orm/v6/prisma-migrate/workflows/unsupported-database-features) .
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/views.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/views.mdx
similarity index 98%
rename from apps/docs/content/docs.v6/orm/prisma-schema/data-model/views.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/data-model/views.mdx
index 7d366351b2..aa3cf1f260 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/data-model/views.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/data-model/views.mdx
@@ -2,7 +2,7 @@
title: Views
description: How to include views in your Prisma schema
badge: preview
-url: /v6/orm/prisma-schema/data-model/views
+url: /orm/v6/prisma-schema/data-model/views
metaTitle: How to include views in your Prisma schema
metaDescription: How to include views in your Prisma schema
---
@@ -18,7 +18,7 @@ The `views` preview feature allows you to represent views in your Prisma schema
:::warning
-Support for views is currently a [Preview](/v6/orm/more/releases#preview) feature. You can add a view to your Prisma schema with the `view` keyword or introspect the views in your database schema with `db pull`. You cannot yet apply views in your schema to your database with Prisma Migrate and `db push` unless the changes are added manually to your migration file using the `--create-only` flag.
For updates on progress with this feature, follow [our GitHub issue](https://github.com/prisma/prisma/issues/17335).
+Support for views is currently a [Preview](/orm/v6/more/releases#preview) feature. You can add a view to your Prisma schema with the `view` keyword or introspect the views in your database schema with `db pull`. You cannot yet apply views in your schema to your database with Prisma Migrate and `db push` unless the changes are added manually to your migration file using the `--create-only` flag.
For updates on progress with this feature, follow [our GitHub issue](https://github.com/prisma/prisma/issues/17335).
:::
@@ -193,7 +193,7 @@ Each _field_ of a `view` block represents a column in the query results of the v
Currently views can only be introspected with PostgreSQL, MySQL, SQL Server and CockroachDB databases. If you are using another database provider, your views must be added manually.
:::
-If you have an existing view or views defined in your database, [introspection](/v6/orm/prisma-schema/introspection) will automatically generate `view` blocks in your Prisma schema that represent those views.
+If you have an existing view or views defined in your database, [introspection](/orm/v6/prisma-schema/introspection) will automatically generate `view` blocks in your Prisma schema that represent those views.
Assuming the example `UserInfo` view exists in your underlying database, running the following command will generate a `view` block in your Prisma schema representing that view:
@@ -277,7 +277,7 @@ Some databases support materialized views, e.g. [PostgreSQL](https://www.postgre
Materialized views persist the result of the view query for faster access and only update it on demand.
-Currently, Prisma ORM does not support materialized views. However, when you [manually create a view](#create-a-view-in-the-underlying-database), you can also create a materialized view with the corresponding command in the underlying database. You can then use Prisma Client's [TypedSQL functionality](/v6/orm/prisma-client/using-raw-sql) to execute the command and refresh the view manually.
+Currently, Prisma ORM does not support materialized views. However, when you [manually create a view](#create-a-view-in-the-underlying-database), you can also create a materialized view with the corresponding command in the underlying database. You can then use Prisma Client's [TypedSQL functionality](/orm/v6/prisma-client/using-raw-sql) to execute the command and refresh the view manually.
In the future Prisma Client might support marking individual views as materialized and add a Prisma Client method to refresh the materialized view. Please comment on our [`views` feedback issue](https://github.com/prisma/prisma/issues/17335) with your use case.
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/introspection.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/introspection.mdx
similarity index 83%
rename from apps/docs/content/docs.v6/orm/prisma-schema/introspection.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/introspection.mdx
index 762a2cd817..4ca126928b 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/introspection.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/introspection.mdx
@@ -1,16 +1,16 @@
---
title: What is introspection?
description: Learn how you can introspect your database to generate a data model into your Prisma schema.
-url: /v6/orm/prisma-schema/introspection
+url: /orm/v6/prisma-schema/introspection
metaTitle: What is introspection? (Reference)
metaDescription: Learn how you can introspect your database to generate a data model into your Prisma schema.
---
-You can introspect your database using the Prisma CLI in order to generate the [data model](/v6/orm/prisma-schema/data-model/models) in your [Prisma schema](/v6/orm/prisma-schema/overview). The data model is needed to [generate Prisma Client](/v6/orm/prisma-client/setup-and-configuration/custom-model-and-field-names).
+You can introspect your database using the Prisma CLI in order to generate the [data model](/orm/v6/prisma-schema/data-model/models) in your [Prisma schema](/orm/v6/prisma-schema/overview). The data model is needed to [generate Prisma Client](/orm/v6/prisma-client/setup-and-configuration/custom-model-and-field-names).
-Introspection is often used to generate an _initial_ version of the data model when [adding Prisma ORM to an existing project](/v6/prisma-orm/add-to-existing-project/postgresql).
+Introspection is often used to generate an _initial_ version of the data model when [adding Prisma ORM to an existing project](/prisma-orm/add-to-existing-project/postgresql).
-However, it can also be [used _repeatedly_ in an application](#introspection-with-an-existing-schema). This is most commonly the case when you're _not_ using [Prisma Migrate](/v6/orm/prisma-migrate/getting-started) but perform schema migrations using plain SQL or another migration tool. In that case, you also need to re-introspect your database and subsequently re-generate Prisma Client to reflect the schema changes in your [Prisma Client API](/v6/orm/prisma-client/setup-and-configuration/introduction).
+However, it can also be [used _repeatedly_ in an application](#introspection-with-an-existing-schema). This is most commonly the case when you're _not_ using [Prisma Migrate](/orm/v6/prisma-migrate/getting-started) but perform schema migrations using plain SQL or another migration tool. In that case, you also need to re-introspect your database and subsequently re-generate Prisma Client to reflect the schema changes in your [Prisma Client API](/orm/v6/prisma-client/setup-and-configuration/introduction).
## What does introspection do?
@@ -20,30 +20,30 @@ Introspection has one main function: Populate your Prisma schema with a data mod
Here's an overview of its main functions on SQL databases:
-- Map _tables_ in the database to [Prisma models](/v6/orm/prisma-schema/data-model/models#defining-models)
-- Map _columns_ in the database to the [fields](/v6/orm/prisma-schema/data-model/models#defining-fields) of Prisma models
-- Map _indexes_ in the database to [indexes](/v6/orm/prisma-schema/data-model/models#defining-an-index) in the Prisma schema
-- Map _database constraints_ to [attributes](/v6/orm/prisma-schema/data-model/models#defining-attributes) or [type modifiers](/v6/orm/prisma-schema/data-model/models#type-modifiers) in the Prisma schema
+- Map _tables_ in the database to [Prisma models](/orm/v6/prisma-schema/data-model/models#defining-models)
+- Map _columns_ in the database to the [fields](/orm/v6/prisma-schema/data-model/models#defining-fields) of Prisma models
+- Map _indexes_ in the database to [indexes](/orm/v6/prisma-schema/data-model/models#defining-an-index) in the Prisma schema
+- Map _database constraints_ to [attributes](/orm/v6/prisma-schema/data-model/models#defining-attributes) or [type modifiers](/orm/v6/prisma-schema/data-model/models#type-modifiers) in the Prisma schema
On MongoDB, the main functions are the following:
-- Map _collections_ in the database to [Prisma models](/v6/orm/prisma-schema/data-model/models#defining-models). Because a _collection_ in MongoDB doesn't have a predefined structure, Prisma ORM _samples_ the _documents_ in the collection and derives the model structure accordingly (i.e. it maps the fields of the _document_ to the [fields](/v6/orm/prisma-schema/data-model/models#defining-fields) of the Prisma model). If _embedded types_ are detected in a collection, these will be mapped to [composite types](/v6/orm/prisma-schema/data-model/models#defining-composite-types) in the Prisma schema.
-- Map _indexes_ in the database to [indexes](/v6/orm/prisma-schema/data-model/models#defining-an-index) in the Prisma schema, if the collection contains at least one document contains a field included in the index
+- Map _collections_ in the database to [Prisma models](/orm/v6/prisma-schema/data-model/models#defining-models). Because a _collection_ in MongoDB doesn't have a predefined structure, Prisma ORM _samples_ the _documents_ in the collection and derives the model structure accordingly (i.e. it maps the fields of the _document_ to the [fields](/orm/v6/prisma-schema/data-model/models#defining-fields) of the Prisma model). If _embedded types_ are detected in a collection, these will be mapped to [composite types](/orm/v6/prisma-schema/data-model/models#defining-composite-types) in the Prisma schema.
+- Map _indexes_ in the database to [indexes](/orm/v6/prisma-schema/data-model/models#defining-an-index) in the Prisma schema, if the collection contains at least one document contains a field included in the index
You can learn more about how Prisma ORM maps types from the database to the types available in the Prisma schema on the respective docs page for the data source connector:
-- [PostgreSQL](/v6/orm/overview/databases/postgresql#type-mapping-between-postgresql-and-prisma-schema)
-- [MySQL](/v6/orm/overview/databases/mysql#type-mapping-between-mysql-to-prisma-schema)
-- [SQLite](/v6/orm/overview/databases/sqlite#type-mapping-between-sqlite-to-prisma-schema)
-- [Microsoft SQL Server](/v6/orm/overview/databases/sql-server#type-mapping-between-microsoft-sql-server-to-prisma-schema)
+- [PostgreSQL](/orm/v6/overview/databases/postgresql#type-mapping-between-postgresql-and-prisma-schema)
+- [MySQL](/orm/v6/overview/databases/mysql#type-mapping-between-mysql-to-prisma-schema)
+- [SQLite](/orm/v6/overview/databases/sqlite#type-mapping-between-sqlite-to-prisma-schema)
+- [Microsoft SQL Server](/orm/v6/overview/databases/sql-server#type-mapping-between-microsoft-sql-server-to-prisma-schema)
## The `prisma db pull` command
-You can introspect your database using the `prisma db pull` command of the [Prisma CLI](/v6/orm/tools/prisma-cli#installation). Note that using this command requires your [connection URL](/v6/orm/reference/connection-urls) to be set in your Prisma config [`datasource`](/v6/orm/reference/prisma-config-reference#datasourceurl).
+You can introspect your database using the `prisma db pull` command of the [Prisma CLI](/orm/v6/tools/prisma-cli#installation). Note that using this command requires your [connection URL](/orm/v6/reference/connection-urls) to be set in your Prisma config [`datasource`](/orm/v6/reference/prisma-config-reference#datasourceurl).
Here's a high-level overview of the steps that `prisma db pull` performs internally:
-1. Read the [connection URL](/v6/orm/reference/connection-urls) from the `datasource` configuration in the Prisma config
+1. Read the [connection URL](/orm/v6/reference/connection-urls) from the `datasource` configuration in the Prisma config
1. Open a connection to the database
1. Introspect database schema (i.e. read tables, columns and other structures ...)
1. Transform database schema into Prisma schema data model
@@ -70,9 +70,9 @@ Prisma ORM employs a number of conventions for translating a database schema int
Field, model and enum names (identifiers) must start with a letter and generally must only contain underscores, letters and digits. You can find the naming rules and conventions for each of these identifiers on the respective docs page:
-- [Naming models](/v6/orm/reference/prisma-schema-reference#naming-conventions)
-- [Naming fields](/v6/orm/reference/prisma-schema-reference#naming-conventions-1)
-- [Naming enums](/v6/orm/reference/prisma-schema-reference#naming-conventions-2)
+- [Naming models](/orm/v6/reference/prisma-schema-reference#naming-conventions)
+- [Naming fields](/orm/v6/reference/prisma-schema-reference#naming-conventions-1)
+- [Naming enums](/orm/v6/reference/prisma-schema-reference#naming-conventions-2)
The general rule for identifiers is that they need to adhere to this regular expression:
@@ -177,11 +177,11 @@ Introspection adds attributes in the following order (this order is mirrored by
### Relations
-Prisma ORM translates foreign keys that are defined on your database tables into [relations](/v6/orm/prisma-schema/data-model/relations).
+Prisma ORM translates foreign keys that are defined on your database tables into [relations](/orm/v6/prisma-schema/data-model/relations).
#### One-to-one relations
-Prisma ORM adds a [one-to-one](/v6/orm/prisma-schema/data-model/relations/one-to-one-relations) relation to your data model when the foreign key on a table has a `UNIQUE` constraint, e.g.:
+Prisma ORM adds a [one-to-one](/orm/v6/prisma-schema/data-model/relations/one-to-one-relations) relation to your data model when the foreign key on a table has a `UNIQUE` constraint, e.g.:
```sql
CREATE TABLE "User" (
@@ -211,7 +211,7 @@ model Profile {
#### One-to-many relations
-By default, Prisma ORM adds a [one-to-many](/v6/orm/prisma-schema/data-model/relations/one-to-many-relations) relation to your data model for a foreign key it finds in your database schema:
+By default, Prisma ORM adds a [one-to-many](/orm/v6/prisma-schema/data-model/relations/one-to-many-relations) relation to your data model for a foreign key it finds in your database schema:
```sql
CREATE TABLE "User" (
@@ -241,20 +241,20 @@ model Post {
#### Many-to-many relations
-[Many-to-many](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations) relations are commonly represented as [relation tables](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#relation-tables) in relational databases.
+[Many-to-many](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations) relations are commonly represented as [relation tables](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#relation-tables) in relational databases.
Prisma ORM supports two ways for defining many-to-many relations in the Prisma schema:
-- [Implicit many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations) (Prisma ORM manages the relation table under the hood)
-- [Explicit many-to-many relations](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations) (the relation table is present as a [model](/v6/orm/prisma-schema/data-model/models#defining-models))
+- [Implicit many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations) (Prisma ORM manages the relation table under the hood)
+- [Explicit many-to-many relations](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#explicit-many-to-many-relations) (the relation table is present as a [model](/orm/v6/prisma-schema/data-model/models#defining-models))
-_Implicit_ many-to-many relations are recognized if they adhere to Prisma ORM's [conventions for relation tables](/v6/orm/prisma-schema/data-model/relations/many-to-many-relations#conventions-for-relation-tables-in-implicit-m-n-relations). Otherwise the relation table is rendered in the Prisma schema as a model (therefore making it an _explicit_ many-to-many relation).
+_Implicit_ many-to-many relations are recognized if they adhere to Prisma ORM's [conventions for relation tables](/orm/v6/prisma-schema/data-model/relations/many-to-many-relations#conventions-for-relation-tables-in-implicit-m-n-relations). Otherwise the relation table is rendered in the Prisma schema as a model (therefore making it an _explicit_ many-to-many relation).
-This topic is covered extensively on the docs page about [Relations](/v6/orm/prisma-schema/data-model/relations).
+This topic is covered extensively on the docs page about [Relations](/orm/v6/prisma-schema/data-model/relations).
#### Disambiguating relations
-Prisma ORM generally omits the `name` argument on the [`@relation`](/v6/orm/prisma-schema/data-model/relations#the-relation-attribute) attribute if it's not needed. Consider the `User` ↔ `Post` example from the previous section. The `@relation` attribute only has the `references` argument, `name` is omitted because it's not needed in this case:
+Prisma ORM generally omits the `name` argument on the [`@relation`](/orm/v6/prisma-schema/data-model/relations#the-relation-attribute) attribute if it's not needed. Consider the `User` ↔ `Post` example from the previous section. The `@relation` attribute only has the `references` argument, `name` is omitted because it's not needed in this case:
```prisma
model Post {
@@ -279,7 +279,7 @@ CREATE TABLE "Post" (
);
```
-In this case, Prisma ORM needs to [disambiguate the relation](/v6/orm/prisma-schema/data-model/relations#disambiguating-relations) using a dedicated relation name:
+In this case, Prisma ORM needs to [disambiguate the relation](/orm/v6/prisma-schema/data-model/relations#disambiguating-relations) using a dedicated relation name:
```prisma
model Post {
@@ -297,7 +297,7 @@ model User {
}
```
-Note that you can rename the [Prisma-ORM level](/v6/orm/prisma-schema/data-model/relations#relation-fields) relation field to anything you like so that it looks friendlier in the generated Prisma Client API.
+Note that you can rename the [Prisma-ORM level](/orm/v6/prisma-schema/data-model/relations#relation-fields) relation field to anything you like so that it looks friendlier in the generated Prisma Client API.
## Introspection with an existing schema
@@ -342,11 +342,11 @@ Introspecting only a subset of your database schema is [not yet officially suppo
However, you can achieve this by creating a new database user that only has access to the tables which you'd like to see represented in your Prisma schema, and then perform the introspection using that user. The introspection will then only include the tables the new user has access to.
-If your goal is to exclude certain models from the [Prisma Client generation](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client), you can add the [`@@ignore` attribute](/v6/orm/reference/prisma-schema-reference#ignore-1) to the model definition in your Prisma schema. Ignored models are excluded from the generated Prisma Client.
+If your goal is to exclude certain models from the [Prisma Client generation](/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client), you can add the [`@@ignore` attribute](/orm/v6/reference/prisma-schema-reference#ignore-1) to the model definition in your Prisma schema. Ignored models are excluded from the generated Prisma Client.
## Introspection warnings for unsupported features
-The Prisma Schema Language (PSL) can express a majority of the database features of the [target databases](/v6/orm/reference/supported-databases) Prisma ORM supports. However, there are features and functionality the Prisma Schema Language still needs to express.
+The Prisma Schema Language (PSL) can express a majority of the database features of the [target databases](/orm/v6/reference/supported-databases) Prisma ORM supports. However, there are features and functionality the Prisma Schema Language still needs to express.
For these features, the Prisma CLI will surface detect usage of the feature in your database and return a warning. The Prisma CLI will also add a comment in the models and fields the features are in use in the Prisma schema. The warnings will also contain a workaround suggestion.
diff --git a/apps/docs/content/docs/orm/v6/prisma-schema/meta.json b/apps/docs/content/docs/orm/v6/prisma-schema/meta.json
new file mode 100644
index 0000000000..5b12d19340
--- /dev/null
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/meta.json
@@ -0,0 +1,10 @@
+{
+ "title": "Prisma Schema",
+ "defaultOpen": true,
+ "pages": [
+ "overview",
+ "data-model",
+ "introspection",
+ "postgresql-extensions"
+ ]
+}
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/overview/data-sources.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/overview/data-sources.mdx
similarity index 78%
rename from apps/docs/content/docs.v6/orm/prisma-schema/overview/data-sources.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/overview/data-sources.mdx
index dd556a6eac..a323d87e75 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/overview/data-sources.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/overview/data-sources.mdx
@@ -1,15 +1,15 @@
---
title: Data sources
description: Data sources enable Prisma to connect to your database. This page explains how to configure data sources in your Prisma schema.
-url: /v6/orm/prisma-schema/overview/data-sources
+url: /orm/v6/prisma-schema/overview/data-sources
metaTitle: Data sources (Reference)
metaDescription: Data sources enable Prisma to connect to your database. This page explains how to configure data sources in your Prisma schema.
---
-A data source determines how Prisma ORM connects to your database, and is represented by the [`datasource`](/v6/orm/reference/prisma-schema-reference#datasource) block in the Prisma schema. The following data source uses the `postgresql` provider and includes a connection URL:
+A data source determines how Prisma ORM connects to your database, and is represented by the [`datasource`](/orm/v6/reference/prisma-schema-reference#datasource) block in the Prisma schema. The following data source uses the `postgresql` provider and includes a connection URL:
::::note
-As of Prisma ORM v7, the `url`, `directUrl`, and `shadowDatabaseUrl` fields in the Prisma schema `datasource` block are deprecated. Configure these fields in [Prisma Config](/v6/orm/reference/prisma-config-reference) instead.
+As of Prisma ORM v7, the `url`, `directUrl`, and `shadowDatabaseUrl` fields in the Prisma schema `datasource` block are deprecated. Configure these fields in [Prisma Config](/orm/v6/reference/prisma-config-reference) instead.
::::
```prisma
@@ -21,8 +21,8 @@ datasource db {
A Prisma schema can only have _one_ data source. However, you can:
-- [Programmatically override a data source `url` when creating your `PrismaClient`](/v6/orm/reference/prisma-client-reference#programmatically-override-a-datasource-url)
-- [Specify a different URL for Prisma Migrate's shadow database if you are working with cloud-hosted development databases](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database#cloud-hosted-shadow-databases-must-be-created-manually)
+- [Programmatically override a data source `url` when creating your `PrismaClient`](/orm/v6/reference/prisma-client-reference#programmatically-override-a-datasource-url)
+- [Specify a different URL for Prisma Migrate's shadow database if you are working with cloud-hosted development databases](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database#cloud-hosted-shadow-databases-must-be-created-manually)
> **Note**: Multiple provider support was removed in 2.22.0. Please see [Deprecation of provider array notation](https://github.com/prisma/prisma/issues/3834) for more information.
@@ -30,14 +30,14 @@ A Prisma schema can only have _one_ data source. However, you can:
Some data source `provider`s allow you to configure your connection with SSL/TLS, and provide parameters for the `url` to specify the location of certificates.
-- [Configuring an SSL connection with PostgreSQL](/v6/orm/overview/databases/postgresql#configuring-an-ssl-connection)
-- [Configuring an SSL connection with MySQL](/v6/orm/overview/databases/mysql#configuring-an-ssl-connection)
-- [Configure a TLS connection with Microsoft SQL Server](/v6/orm/overview/databases/sql-server#connection-details)
+- [Configuring an SSL connection with PostgreSQL](/orm/v6/overview/databases/postgresql#configuring-an-ssl-connection)
+- [Configuring an SSL connection with MySQL](/orm/v6/overview/databases/mysql#configuring-an-ssl-connection)
+- [Configure a TLS connection with Microsoft SQL Server](/orm/v6/overview/databases/sql-server#connection-details)
Prisma ORM resolves SSL certificates relative to the `./prisma` directory. If your certificate files are located outside that directory, e.g. your project root directory, use relative paths for certificates:
:::note
-When you're using a [multi-file Prisma schema](/v6/orm/prisma-schema/overview/location#multi-file-prisma-schema), Prisma ORM resolves SSL certificates relative to the `./prisma/schema` directory.
+When you're using a [multi-file Prisma schema](/orm/v6/prisma-schema/overview/location#multi-file-prisma-schema), Prisma ORM resolves SSL certificates relative to the `./prisma/schema` directory.
:::
```prisma
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/overview/generators.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/overview/generators.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/prisma-schema/overview/generators.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/overview/generators.mdx
index 0e59f83bdb..35be2873ec 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/overview/generators.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/overview/generators.mdx
@@ -1,12 +1,12 @@
---
title: Generators
description: Generators in your Prisma schema specify what assets are generated when the `prisma generate` command is invoked. This page explains how to configure generators.
-url: /v6/orm/prisma-schema/overview/generators
+url: /orm/v6/prisma-schema/overview/generators
metaTitle: Generators (Reference)
metaDescription: Generators in your Prisma schema specify what assets are generated when the `prisma generate` command is invoked. This page explains how to configure generators.
---
-A Prisma schema can have one or more generators, represented by the [`generator`](/v6/orm/reference/prisma-schema-reference#generator) block:
+A Prisma schema can have one or more generators, represented by the [`generator`](/orm/v6/reference/prisma-schema-reference#generator) block:
```prisma
generator client {
@@ -45,7 +45,7 @@ Follow these steps to use the new `prisma-client` generator in your project.
#### 1. Configure the `prisma-client` generator in `schema.prisma`
-Update your [`generator`](/v6/orm/prisma-schema/overview/generators) block:
+Update your [`generator`](/orm/v6/prisma-schema/overview/generators) block:
```prisma title="prisma/schema.prisma"
generator client {
@@ -80,7 +80,7 @@ This generates the code for Prisma Client (including the query engine binary) in
#### 3. Exclude the generated directory from version control
-The new generator includes both the TypeScript client code _and_ the [query engine](/v6/orm/more/internals/engines#the-query-engine-file). Including the query engine in version control can cause compatibility issues on different machines. To avoid this, add the generated directory to `.gitignore`:
+The new generator includes both the TypeScript client code _and_ the [query engine](/orm/v6/more/internals/engines#the-query-engine-file). Including the query engine in version control can cause compatibility issues on different machines. To avoid this, add the generated directory to `.gitignore`:
```bash title=".gitignore"
# Keep the generated Prisma Client + query engine out of version control
@@ -344,7 +344,7 @@ The `prisma-client-js` generator requires the `@prisma/client` npm package and g
The generator for Prisma's JavaScript Client accepts multiple additional properties:
-- `previewFeatures`: [Preview features](/v6/orm/reference/preview-features) to include
+- `previewFeatures`: [Preview features](/orm/v6/reference/preview-features) to include
- `binaryTargets`: Engine binary targets for `prisma-client-js` (for example, `debian-openssl-1.1.x` if you are deploying to Ubuntu 18+, or `native` if you are working locally)
```prisma
@@ -359,7 +359,7 @@ generator client {
:::note
-As of [v6.16.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+As of [v6.16.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
@@ -371,7 +371,7 @@ generator client {
}
```
-Note that [driver adapters](/v6/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines.
+Note that [driver adapters](/orm/v6/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines.
When using Prisma ORM without Rust, the `binaryTargets` field is obsolete and not needed.
@@ -381,7 +381,7 @@ You can [read about the performance and DX improvements](https://www.prisma.io/b
The `prisma-client-js` generator uses several [engines](https://github.com/prisma/prisma-engines). Engines are implemented in Rust and are used by Prisma Client in the form of executable, platform-dependent engine files. Depending on which platform you are executing your code on, you need the correct file. "Binary targets" are used to define which files should be present for the target platform(s).
-The correct file is particularly important when [deploying](/v6/orm/prisma-client/deployment/deploy-prisma) your application to production, which often differs from your local development environment.
+The correct file is particularly important when [deploying](/orm/v6/prisma-client/deployment/deploy-prisma) your application to production, which often differs from your local development environment.
#### The `native` binary target
@@ -396,17 +396,17 @@ generator client {
}
```
-In that case, Prisma Client detects your operating system and finds the right binary file for it based on the [list of supported operating systems](/v6/orm/reference/prisma-schema-reference#binarytargets-options) .
+In that case, Prisma Client detects your operating system and finds the right binary file for it based on the [list of supported operating systems](/orm/v6/reference/prisma-schema-reference#binarytargets-options) .
If you use macOS Intel x86 (`darwin`), then the binary file that was compiled for `darwin` will be selected.
If you use macOS ARM64 (`darwin-arm64`), then the binary file that was compiled for `darwin-arm64` will be selected.
-> **Note**: The `native` binary target is the default. You can set it explicitly if you wish to include additional [binary targets](/v6/orm/reference/prisma-schema-reference#binarytargets-options) for deployment to different environments.
+> **Note**: The `native` binary target is the default. You can set it explicitly if you wish to include additional [binary targets](/orm/v6/reference/prisma-schema-reference#binarytargets-options) for deployment to different environments.
## Community generators
:::note
-Existing generators or new ones should not be affected if you are using a [multi-file Prisma schema](/v6/orm/prisma-schema/overview/location#multi-file-prisma-schema), unless a generator reads the schema manually.
+Existing generators or new ones should not be affected if you are using a [multi-file Prisma schema](/orm/v6/prisma-schema/overview/location#multi-file-prisma-schema), unless a generator reads the schema manually.
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/overview/index.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/overview/index.mdx
similarity index 87%
rename from apps/docs/content/docs.v6/orm/prisma-schema/overview/index.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/overview/index.mdx
index a31d4cd3d3..74530a896c 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/overview/index.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/overview/index.mdx
@@ -1,20 +1,20 @@
---
title: Overview on Prisma Schema
description: The Prisma schema is the main method of configuration when using Prisma. It is typically called schema.prisma and contains your database connection and data model.
-url: /v6/orm/prisma-schema/overview
+url: /orm/v6/prisma-schema/overview
metaTitle: Prisma schema
metaDescription: Learn everything you need to know about the Prisma schema.
---
The Prisma Schema (or _schema_ for short) is the main method of configuration for your Prisma ORM setup. It consists of the following parts:
-- [**Data sources**](/v6/orm/prisma-schema/overview/data-sources): Specify the details of the data sources Prisma ORM should connect to (e.g. a PostgreSQL database)
-- [**Generators**](/v6/orm/prisma-schema/overview/generators): Specifies what clients should be generated based on the data model (e.g. Prisma Client)
-- [**Data model definition**](/v6/orm/prisma-schema/data-model/models): Specifies your application [models](/v6/orm/prisma-schema/data-model/models#defining-models) (the shape of the data per data source) and their [relations](/v6/orm/prisma-schema/data-model/relations)
+- [**Data sources**](/orm/v6/prisma-schema/overview/data-sources): Specify the details of the data sources Prisma ORM should connect to (e.g. a PostgreSQL database)
+- [**Generators**](/orm/v6/prisma-schema/overview/generators): Specifies what clients should be generated based on the data model (e.g. Prisma Client)
+- [**Data model definition**](/orm/v6/prisma-schema/data-model/models): Specifies your application [models](/orm/v6/prisma-schema/data-model/models#defining-models) (the shape of the data per data source) and their [relations](/orm/v6/prisma-schema/data-model/relations)
-It is typically a single file called `schema.prisma` (or multiple files with `.prisma` file extension) that is stored in a defined but customizable [location](/v6/orm/prisma-schema/overview/location). You can also [organize your Prisma schema in multiple files](/v6/orm/prisma-schema/overview/location#multi-file-prisma-schema) if you prefer that.
+It is typically a single file called `schema.prisma` (or multiple files with `.prisma` file extension) that is stored in a defined but customizable [location](/orm/v6/prisma-schema/overview/location). You can also [organize your Prisma schema in multiple files](/orm/v6/prisma-schema/overview/location#multi-file-prisma-schema) if you prefer that.
-See the [Prisma schema API reference](/v6/orm/reference/prisma-schema-reference) for detailed information about each section of the schema.
+See the [Prisma schema API reference](/orm/v6/reference/prisma-schema-reference) for detailed information about each section of the schema.
Whenever a `prisma` command is invoked, the CLI typically reads some information from the schema, e.g.:
@@ -30,7 +30,7 @@ The following is an example of a Prisma Schema that specifies:
- A data source (PostgreSQL or MongoDB)
- A generator (Prisma Client)
- A data model definition with two models (with one relation) and one `enum`
-- Several [native data type attributes](/v6/orm/prisma-schema/data-model/models#native-types-mapping) (`@db.VarChar(255)`, `@db.ObjectId`)
+- Several [native data type attributes](/orm/v6/prisma-schema/data-model/models#native-types-mapping) (`@db.VarChar(255)`, `@db.ObjectId`)
```prisma tab="Relational databases"
datasource db {
@@ -104,11 +104,11 @@ enum Role {
## Syntax
-Prisma Schema files are written in Prisma Schema Language (PSL). See the [data sources](/v6/orm/prisma-schema/overview/data-sources), [generators](/v6/orm/prisma-schema/overview/generators), [data model definition](/v6/orm/prisma-schema/data-model/models) and of course [Prisma Schema API reference](/v6/orm/reference/prisma-schema-reference) pages for details and examples.
+Prisma Schema files are written in Prisma Schema Language (PSL). See the [data sources](/orm/v6/prisma-schema/overview/data-sources), [generators](/orm/v6/prisma-schema/overview/generators), [data model definition](/orm/v6/prisma-schema/data-model/models) and of course [Prisma Schema API reference](/orm/v6/reference/prisma-schema-reference) pages for details and examples.
### VS Code
-Syntax highlighting for PSL is available via a [VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) (which also lets you auto-format the contents of your Prisma schema and indicates syntax errors with red squiggly lines). Learn more about [setting up Prisma ORM in your editor](/v6/orm/more/dev-environment/editor-setup).
+Syntax highlighting for PSL is available via a [VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) (which also lets you auto-format the contents of your Prisma schema and indicates syntax errors with red squiggly lines). Learn more about [setting up Prisma ORM in your editor](/orm/v6/more/dev-environment/editor-setup).
### GitHub
@@ -144,7 +144,7 @@ You can use the `env()` function in the following places:
- A datasource url
- Generator binary targets
-See [Environment variables](/v6/orm/more/dev-environment/environment-variables) for more information about how to use an `.env` file during development.
+See [Environment variables](/orm/v6/more/dev-environment/environment-variables) for more information about how to use an `.env` file during development.
## Comments
@@ -181,7 +181,7 @@ model Customer {
Prisma ORM supports formatting `.prisma` files automatically. There are two ways to format `.prisma` files:
-- Run the [`prisma format`](/v6/orm/reference/prisma-cli-reference#format) command.
+- Run the [`prisma format`](/orm/v6/reference/prisma-cli-reference#format) command.
- Install the [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) and invoke the [VS Code format action](https://code.visualstudio.com/docs/editor/codebasics#_formatting) - manually or on save.
There are no configuration options - [formatting rules](#formatting-rules) are fixed (similar to Golang's `gofmt` but unlike Javascript's `prettier`):
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/overview/location.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/overview/location.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/prisma-schema/overview/location.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/overview/location.mdx
index 82c035ef1d..bfcd232a17 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/overview/location.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/overview/location.mdx
@@ -1,7 +1,7 @@
---
title: Schema location
description: Documentation regarding proper location of Prisma Schema including default naming and multiple files.
-url: /v6/orm/prisma-schema/overview/location
+url: /orm/v6/prisma-schema/overview/location
metaTitle: Prisma Schema Location and Configuration
metaDescription: Documentation regarding proper location of Prisma Schema including default naming and multiple files.
---
@@ -12,7 +12,7 @@ The default name for the Prisma Schema is a single file `schema.prisma` in your
The Prisma CLI looks for the Prisma Schema in the following locations, in the following order:
-1. The location specified by the [`--schema` flag](/v6/orm/reference/prisma-cli-reference), which is available when you `introspect`, `generate`, `migrate`, and `studio`:
+1. The location specified by the [`--schema` flag](/orm/v6/reference/prisma-cli-reference), which is available when you `introspect`, `generate`, `migrate`, and `studio`:
```bash
prisma generate --schema=./alternative/schema.prisma
@@ -79,7 +79,7 @@ You can do this in either of three ways:
},
}
```
-- set the `schema` property in [`prisma.config.ts`](/v6/orm/reference/prisma-config-reference#schema) ( for Prisma ORM v7):
+- set the `schema` property in [`prisma.config.ts`](/orm/v6/reference/prisma-config-reference#schema) ( for Prisma ORM v7):
```ts
import { defineConfig, env } from "prisma/config";
@@ -99,7 +99,7 @@ You can do this in either of three ways:
:::note
- We recommend using the [Prisma Config file](/v6/orm/reference/prisma-config-reference#schema) to specify the location of your Prisma schema. This is the most flexible way to specify the location of your Prisma schema alongside other configuration options.
+ We recommend using the [Prisma Config file](/orm/v6/reference/prisma-config-reference#schema) to specify the location of your Prisma schema. This is the most flexible way to specify the location of your Prisma schema alongside other configuration options.
:::
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/overview/meta.json b/apps/docs/content/docs/orm/v6/prisma-schema/overview/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/prisma-schema/overview/meta.json
rename to apps/docs/content/docs/orm/v6/prisma-schema/overview/meta.json
diff --git a/apps/docs/content/docs.v6/orm/prisma-schema/postgresql-extensions.mdx b/apps/docs/content/docs/orm/v6/prisma-schema/postgresql-extensions.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/prisma-schema/postgresql-extensions.mdx
rename to apps/docs/content/docs/orm/v6/prisma-schema/postgresql-extensions.mdx
index d850ab3ea2..89faa842bd 100644
--- a/apps/docs/content/docs.v6/orm/prisma-schema/postgresql-extensions.mdx
+++ b/apps/docs/content/docs/orm/v6/prisma-schema/postgresql-extensions.mdx
@@ -1,7 +1,7 @@
---
title: PostgreSQL extensions
description: 'How to install and manage PostgreSQL extensions with Prisma ORM using customized migrations, and how to use them in Prisma Client.'
-url: /v6/orm/prisma-schema/postgresql-extensions
+url: /orm/v6/prisma-schema/postgresql-extensions
metaTitle: How to use PostgreSQL extensions with Prisma ORM
metaDescription: 'How to install and manage PostgreSQL extensions with Prisma ORM using customized migrations, and how to use them in Prisma Client.'
---
@@ -10,7 +10,7 @@ This page is about [PostgreSQL extensions](https://www.postgresql.org/docs/curre
:::warning
-Between Prisma ORM v4.5.0 and v6.16.0, you could enable extensions in the Prisma schema via the `postgresqlExtensions` preview feature flag. This feature flag has been deprecated in v6.16.0 and the recommended approach for using PostgreSQL extensions now is to install them via [customized migrations](/v6/orm/prisma-migrate/workflows/customizing-migrations).
+Between Prisma ORM v4.5.0 and v6.16.0, you could enable extensions in the Prisma schema via the `postgresqlExtensions` preview feature flag. This feature flag has been deprecated in v6.16.0 and the recommended approach for using PostgreSQL extensions now is to install them via [customized migrations](/orm/v6/prisma-migrate/workflows/customizing-migrations).
:::
@@ -26,7 +26,7 @@ Let's walk through an example of installing the `citext` extension.
### 1. Create an empty migration
-Run the following command to create an empty migration that you can [customize](/v6/orm/prisma-migrate/workflows/customizing-migrations):
+Run the following command to create an empty migration that you can [customize](/orm/v6/prisma-migrate/workflows/customizing-migrations):
```npm
npx prisma migrate dev --create-only
@@ -50,4 +50,4 @@ npx prisma migrate deploy
### 4. Use the extension
-You can now use the extension in your queries with Prisma Client. If the extension has special data types that currently can't be natively represented in the Prisma schema, you can still define fields of that type on your models using the [`Unsupported`](/v6/orm/prisma-schema/data-model/models#unsupported-types) fallback type.
+You can now use the extension in your queries with Prisma Client. If the extension has special data types that currently can't be natively represented in the Prisma schema, you can still define fields of that type on your models using the [`Unsupported`](/orm/v6/prisma-schema/data-model/models#unsupported-types) fallback type.
diff --git a/apps/docs/content/docs.v6/orm/reference/connection-urls.mdx b/apps/docs/content/docs/orm/v6/reference/connection-urls.mdx
similarity index 86%
rename from apps/docs/content/docs.v6/orm/reference/connection-urls.mdx
rename to apps/docs/content/docs/orm/v6/reference/connection-urls.mdx
index d412187295..9c4d34f85f 100644
--- a/apps/docs/content/docs.v6/orm/reference/connection-urls.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/connection-urls.mdx
@@ -1,14 +1,14 @@
---
title: Connection URLs
description: 'Learn about the format and syntax Prisma ORM uses for defining database connection URLs for PostgreSQL, MySQL and SQLite.'
-url: /v6/orm/reference/connection-urls
+url: /orm/v6/reference/connection-urls
metaTitle: Connection URLs (Reference)
metaDescription: 'Learn about the format and syntax Prisma ORM uses for defining database connection URLs for PostgreSQL, MySQL and SQLite.'
---
-Prisma ORM needs a connection URL to be able to connect to your database, e.g. when sending queries with [Prisma Client](/v6/orm/prisma-client/setup-and-configuration/introduction) or when changing the database schema with [Prisma Migrate](/v6/orm/prisma-migrate/getting-started).
+Prisma ORM needs a connection URL to be able to connect to your database, e.g. when sending queries with [Prisma Client](/orm/v6/prisma-client/setup-and-configuration/introduction) or when changing the database schema with [Prisma Migrate](/orm/v6/prisma-migrate/getting-started).
-The connection URL is provided via the `url` field of a `datasource` block in your Prisma config (or Prisma schema if on version 6). It usually consists of the following components (except for SQLite and [Prisma Postgres](/v6/postgres)):
+The connection URL is provided via the `url` field of a `datasource` block in your Prisma config (or Prisma schema if on version 6). It usually consists of the following components (except for SQLite and [Prisma Postgres](/postgres)):
- **User**: The name of your database user
- **Password**: The password for your database user
@@ -16,24 +16,24 @@ The connection URL is provided via the `url` field of a `datasource` block in yo
- **Port**: The port on which your database server is running
- **Database name**: The name of the database you want to use
-Make sure you have this information at hand when getting started with Prisma ORM. If you don't have a database server running yet, you can either use a local SQLite database file (see the [Quickstart](/v6/prisma-orm/quickstart/sqlite)) or [setup a free PostgreSQL database with Prisma Postgres](/v6/postgres).
+Make sure you have this information at hand when getting started with Prisma ORM. If you don't have a database server running yet, you can either use a local SQLite database file (see the [Quickstart](/prisma-orm/quickstart/sqlite)) or [setup a free PostgreSQL database with Prisma Postgres](/postgres).
## Format
The format of the connection URL depends on the _database connector_ you're using. Prisma ORM generally supports the standard formats for each database. You can find out more about the connection URL of your database on the dedicated docs page:
-- [PostgreSQL](/v6/orm/overview/databases/postgresql)
-- [MySQL](/v6/orm/overview/databases/mysql)
-- [SQLite](/v6/orm/overview/databases/sqlite)
-- [MongoDB](/v6/orm/overview/databases/mongodb)
-- [Microsoft SQL Server](/v6/orm/overview/databases/sql-server)
-- [CockroachDB](/v6/orm/overview/databases/cockroachdb)
+- [PostgreSQL](/orm/v6/overview/databases/postgresql)
+- [MySQL](/orm/v6/overview/databases/mysql)
+- [SQLite](/orm/v6/overview/databases/sqlite)
+- [MongoDB](/orm/v6/overview/databases/mongodb)
+- [Microsoft SQL Server](/orm/v6/overview/databases/sql-server)
+- [CockroachDB](/orm/v6/overview/databases/cockroachdb)
### Special characters
For MySQL, PostgreSQL and CockroachDB you must [percentage-encode special characters](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding) in any part of your connection URL - including passwords. For example, `p@$$w0rd` becomes `p%40%24%24w0rd`.
-For Microsoft SQL Server, you must [escape special characters](/v6/orm/overview/databases/sql-server#connection-details) in any part of your connection string.
+For Microsoft SQL Server, you must [escape special characters](/orm/v6/overview/databases/sql-server#connection-details) in any part of your connection string.
## Examples
@@ -41,10 +41,10 @@ Here are examples for the connection URLs of the databases Prisma ORM supports:
### Prisma Postgres
-[Prisma Postgres](/v6/postgres) is a managed PostgreSQL service running on unikernels. There are several ways to connect to Prisma Postgres:
+[Prisma Postgres](/postgres) is a managed PostgreSQL service running on unikernels. There are several ways to connect to Prisma Postgres:
- via direct TCP connections (lets you connect via any ORM or database tool)
-- via [Prisma Accelerate](/v6/accelerate) (only supported with Prisma ORM)
+- via [Prisma Accelerate](/accelerate) (only supported with Prisma ORM)
- locally
The connection string formats of these are covered below.
@@ -101,7 +101,7 @@ datasource db {
#### Local Prisma Postgres
-The connection string for connecting to a [local Prisma Postgres](/v6/postgres/database/local-development) instance mirrors the structure of a remote instance via Accelerate:
+The connection string for connecting to a [local Prisma Postgres](/postgres/database/local-development) instance mirrors the structure of a remote instance via Accelerate:
```ts title="prisma.config.ts" tab="Prisma 7"
export default defineConfig({
@@ -118,7 +118,7 @@ datasource db {
}
```
-However, in this case the `API_KEY` doesn't provide authentication details. Instead, it encodes information about the local Prisma Postgres instance. You can obtain a local connection string via the [`prisma dev`](/v6/orm/reference/prisma-cli-reference#dev) command.
+However, in this case the `API_KEY` doesn't provide authentication details. Instead, it encodes information about the local Prisma Postgres instance. You can obtain a local connection string via the [`prisma dev`](/orm/v6/reference/prisma-cli-reference#dev) command.
### PostgreSQL
diff --git a/apps/docs/content/docs.v6/orm/reference/database-features.mdx b/apps/docs/content/docs/orm/v6/reference/database-features.mdx
similarity index 90%
rename from apps/docs/content/docs.v6/orm/reference/database-features.mdx
rename to apps/docs/content/docs/orm/v6/reference/database-features.mdx
index 18e3dd0458..ab2c7bf73c 100644
--- a/apps/docs/content/docs.v6/orm/reference/database-features.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/database-features.mdx
@@ -2,7 +2,7 @@
title: Database features matrix
description: Learn which database features are supported in Prisma ORM and how they map to the different Prisma ORM tools.
wide: true
-url: /v6/orm/reference/database-features
+url: /orm/v6/reference/database-features
metaTitle: Database features matrix
metaDescription: Learn which database features are supported in Prisma ORM and how they map to the different Prisma ORM tools.
---
@@ -11,7 +11,7 @@ This page gives an overview of the features which are provided by the databases
## Relational database features
-This section describes which database features exist on the relational databases that are currently supported by Prisma ORM. The **Prisma schema** column indicates how a certain feature can be represented in the [Prisma schema](/v6/orm/prisma-schema/overview) and links to its documentation. Note that database features can be used in **Prisma Client** even though they might not yet be representable in the Prisma schema.
+This section describes which database features exist on the relational databases that are currently supported by Prisma ORM. The **Prisma schema** column indicates how a certain feature can be represented in the [Prisma schema](/orm/v6/prisma-schema/overview) and links to its documentation. Note that database features can be used in **Prisma Client** even though they might not yet be representable in the Prisma schema.
:::note
@@ -23,15 +23,15 @@ These features are _only_ for relational databases. Supported features for NoSQL
| Constraint | Supported | Prisma schema | Prisma Client | Prisma Migrate |
| ------------- | :-------: | :----------------------------------------------------------------------------------------------: | :-----------: | :------------: |
-| `PRIMARY KEY` | ✔️ | [`@id` and `@@id`](/v6/orm/prisma-schema/data-model/models#defining-an-id-field) | ✔️ | ✔️ |
-| `FOREIGN KEY` | ✔️ | [Relation fields](/v6/orm/prisma-schema/data-model/relations#relation-fields) | ✔️ | ✔️ |
-| `UNIQUE` | ✔️\* | [`@unique` and `@@unique`](/v6/orm/prisma-schema/data-model/models#defining-a-unique-field) | ✔️ | ✔️ |
+| `PRIMARY KEY` | ✔️ | [`@id` and `@@id`](/orm/v6/prisma-schema/data-model/models#defining-an-id-field) | ✔️ | ✔️ |
+| `FOREIGN KEY` | ✔️ | [Relation fields](/orm/v6/prisma-schema/data-model/relations#relation-fields) | ✔️ | ✔️ |
+| `UNIQUE` | ✔️\* | [`@unique` and `@@unique`](/orm/v6/prisma-schema/data-model/models#defining-a-unique-field) | ✔️ | ✔️ |
| `CHECK` | ✔️† | Not yet | ✔️ | Not yet |
-| `NOT NULL` | ✔️ | [`?`](/v6/orm/prisma-schema/data-model/models#type-modifiers) | ✔️ | ✔️ |
-| `DEFAULT` | ✔️ | [`@default`](/v6/orm/prisma-schema/data-model/models#defining-a-default-value) | ✔️ | ✔️ |
+| `NOT NULL` | ✔️ | [`?`](/orm/v6/prisma-schema/data-model/models#type-modifiers) | ✔️ | ✔️ |
+| `DEFAULT` | ✔️ | [`@default`](/orm/v6/prisma-schema/data-model/models#defining-a-default-value) | ✔️ | ✔️ |
| `EXCLUDE` | ✔️‡ | Not yet | ✔️ | Not yet |
-> \* [Caveats apply when using the `UNIQUE` constraint with Microsoft SQL Server](/v6/orm/overview/databases/sql-server#data-model-limitations)
+> \* [Caveats apply when using the `UNIQUE` constraint with Microsoft SQL Server](/orm/v6/overview/databases/sql-server#data-model-limitations)
> † Only supported in MySQL in [version 8 and higher](https://dev.mysql.com/doc/refman/8.0/en/create-table-check-constraints.html).
> ‡ Only supported in PostgreSQL.
@@ -51,8 +51,8 @@ These features are _only_ for relational databases. Supported features for NoSQL
| Index | Supported | Prisma schema | Prisma Client | Prisma Migrate |
| -------------- | :--------------------------------------: | :-----------------------------------------------------------------------------------------------------------------: | :-----------: | :------------: |
-| `UNIQUE` | ✔️ | [`@unique` and `@@unique`](/v6/orm/prisma-schema/data-model/models#defining-a-unique-field) | ✔️ | ✔️ |
-| `USING` | PostgreSQL only | [`type`](/v6/orm/prisma-schema/data-model/indexes#configuring-the-access-type-of-indexes-with-type-postgresql) | ✔️ | ✔️ |
+| `UNIQUE` | ✔️ | [`@unique` and `@@unique`](/orm/v6/prisma-schema/data-model/models#defining-a-unique-field) | ✔️ | ✔️ |
+| `USING` | PostgreSQL only | [`type`](/orm/v6/prisma-schema/data-model/indexes#configuring-the-access-type-of-indexes-with-type-postgresql) | ✔️ | ✔️ |
| `WHERE` | ✔️ | Not yet | ✔️ | Not yet |
| `(expression)` | ✔️ | Not yet | ✔️ | Not yet |
| `INCLUDE` | PostgreSQL and Microsoft SQL Server only | Not yet | ✔️ | Not yet |
@@ -75,9 +75,9 @@ Algorithm specified via `USING`:
| Feature | Supported | Prisma schema | Prisma Client | Prisma Migrate |
| --------------------------------- | :--------------------------------------: | :----------------------------------------------------------------------------------------: | :-----------: | :------------: |
-| Autoincrementing IDs | ✔️ | [`autoincrement()`](/v6/orm/prisma-schema/data-model/models#defining-a-default-value) | ✔️ | ✔️ |
-| Arrays | PostgreSQL only | [`[]`](/v6/orm/prisma-schema/data-model/models#type-modifiers) | ✔️ | ✔️ |
-| Enums | ✔️\*† | [`enum`](/v6/orm/prisma-schema/data-model/models#defining-enums) | ✔️ | ✔️ |
+| Autoincrementing IDs | ✔️ | [`autoincrement()`](/orm/v6/prisma-schema/data-model/models#defining-a-default-value) | ✔️ | ✔️ |
+| Arrays | PostgreSQL only | [`[]`](/orm/v6/prisma-schema/data-model/models#type-modifiers) | ✔️ | ✔️ |
+| Enums | ✔️\*† | [`enum`](/orm/v6/prisma-schema/data-model/models#defining-enums) | ✔️ | ✔️ |
| Native database types | ✔️ | ✔️ | ✔️ | Not yet |
| SQL Views | ✔️ | Not yet | Not yet | Not yet |
| JSON support | ✔️† | ✔️ | ✔️ | ✔️ |
@@ -104,10 +104,10 @@ The following table lists common MongoDB features and describes the level of sup
| Indexes | ✔️ with caveats | Indexes can only be introspected if the field they refer to includes at least some data. |
| Autoincrementing IDs | No | |
| Compound IDs | No | MongoDB does not support composite IDs (`@@id`) |
-| Generated `ObjectId` | ✔️ | See: [Defining IDs for MongoDB](/v6/orm/prisma-schema/data-model/models#defining-ids-in-mongodb) |
+| Generated `ObjectId` | ✔️ | See: [Defining IDs for MongoDB](/orm/v6/prisma-schema/data-model/models#defining-ids-in-mongodb) |
| Arrays | ✔️ | |
| Enums | ✔️ | Implemented at Prisma ORM level |
-| Native database types | ✔️ | See: [Field mapping reference](/v6/orm/reference/prisma-schema-reference#model-field-scalar-types) |
+| Native database types | ✔️ | See: [Field mapping reference](/orm/v6/reference/prisma-schema-reference#model-field-scalar-types) |
| JSON support | ✔️ | Advanced `Json` field filtering is not yet supported. |
| DBrefs | No |
| Change streams | No |
diff --git a/apps/docs/content/docs.v6/orm/reference/environment-variables-reference.mdx b/apps/docs/content/docs/orm/v6/reference/environment-variables-reference.mdx
similarity index 93%
rename from apps/docs/content/docs.v6/orm/reference/environment-variables-reference.mdx
rename to apps/docs/content/docs/orm/v6/reference/environment-variables-reference.mdx
index d67cf3b168..5fa0552c16 100644
--- a/apps/docs/content/docs.v6/orm/reference/environment-variables-reference.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/environment-variables-reference.mdx
@@ -1,7 +1,7 @@
---
title: Environment variables reference
description: This page gives an overview of all environment variables available for use.
-url: /v6/orm/reference/environment-variables-reference
+url: /orm/v6/reference/environment-variables-reference
metaTitle: Prisma environment variables
metaDescription: This page gives an overview of all environment variables available for use.
---
@@ -21,13 +21,13 @@ Example setting Prisma Client level debugging output:
export DEBUG="prisma:client"
```
-See [Debugging](/v6/orm/prisma-client/debugging-and-troubleshooting/debugging) for more information.
+See [Debugging](/orm/v6/prisma-client/debugging-and-troubleshooting/debugging) for more information.
### `NO_COLOR`
`NO_COLOR` if [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) will activate the `colorless` setting for error formatting and strip colors from error messages.
-See [Formatting via environment variables](/v6/orm/prisma-client/setup-and-configuration/error-formatting#formatting-via-environment-variables) for more information.
+See [Formatting via environment variables](/orm/v6/prisma-client/setup-and-configuration/error-formatting#formatting-via-environment-variables) for more information.
## Prisma Studio
@@ -45,7 +45,7 @@ Alternatively you can set this when starting Studio from the CLI as well:
prisma studio --browser firefox
```
-See [Studio](/v6/orm/reference/prisma-cli-reference#studio) documentation for more information.
+See [Studio](/orm/v6/reference/prisma-cli-reference#studio) documentation for more information.
## Prisma CLI
@@ -95,7 +95,7 @@ This environment variable is available since version `5.2.0`
:::
-`PRISMA_GENERATE_NO_ENGINE` can be set to a truthy value to generate a Prisma Client without an included [query engine](/v6/orm/more/internals/engines) in order to reduce deployed application size when paired with [Prisma Accelerate](/v6/accelerate).
+`PRISMA_GENERATE_NO_ENGINE` can be set to a truthy value to generate a Prisma Client without an included [query engine](/orm/v6/more/internals/engines) in order to reduce deployed application size when paired with [Prisma Accelerate](/accelerate).
### `PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK`
@@ -105,11 +105,11 @@ This environment variable is available since version `5.3.0`
:::
-`PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK` can be set to a truthy value to disable the [advisory locking](/v6/orm/prisma-migrate/workflows/development-and-production#advisory-locking) used by Prisma Migrate. This might be needed, depending on the database configuration, for example, for a Percona-XtraDB-Cluster or MariaDB Galera Cluster.
+`PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK` can be set to a truthy value to disable the [advisory locking](/orm/v6/prisma-migrate/workflows/development-and-production#advisory-locking) used by Prisma Migrate. This might be needed, depending on the database configuration, for example, for a Percona-XtraDB-Cluster or MariaDB Galera Cluster.
## Proxy environment variables
-The Prisma CLI supports custom HTTP(S) proxies to download the Prisma engines. These can be helpful to use when working behind a corporate firewall. See [Using a HTTP proxy for the CLI](/v6/orm/reference/prisma-cli-reference#using-a-http-proxy-for-the-cli) for more information.
+The Prisma CLI supports custom HTTP(S) proxies to download the Prisma engines. These can be helpful to use when working behind a corporate firewall. See [Using a HTTP proxy for the CLI](/orm/v6/reference/prisma-cli-reference#using-a-http-proxy-for-the-cli) for more information.
### `NO_PROXY`
@@ -147,7 +147,7 @@ This environment variable is only supported in Prisma 6.19 and earlier. It will
:::
-`PRISMA_CLI_QUERY_ENGINE_TYPE` is used to [define the query engine type Prisma CLI downloads and uses](/v6/orm/more/internals/engines#configuring-the-query-engine). Defaults to `library`, but can be set to `binary`:
+`PRISMA_CLI_QUERY_ENGINE_TYPE` is used to [define the query engine type Prisma CLI downloads and uses](/orm/v6/more/internals/engines#configuring-the-query-engine). Defaults to `library`, but can be set to `binary`:
```text
PRISMA_CLI_QUERY_ENGINE_TYPE=binary
@@ -161,7 +161,7 @@ This environment variable is only supported in Prisma 6.19 and earlier. It will
:::
-`PRISMA_CLIENT_ENGINE_TYPE` is used to [define the query engine type Prisma Client downloads and uses](/v6/orm/more/internals/engines#configuring-the-query-engine). Defaults to `library`, but can be set to `binary`:
+`PRISMA_CLIENT_ENGINE_TYPE` is used to [define the query engine type Prisma Client downloads and uses](/orm/v6/more/internals/engines#configuring-the-query-engine). Defaults to `library`, but can be set to `binary`:
```text
PRISMA_CLIENT_ENGINE_TYPE=binary
@@ -169,7 +169,7 @@ PRISMA_CLIENT_ENGINE_TYPE=binary
Note: You need to generate your Prisma Client after setting this variable for the configuration to take effect and the libraries to be downloaded. Otherwise, Prisma Client will be missing the appropriate query engine library and you will _have to_ define their location using [`PRISMA_QUERY_ENGINE_LIBRARY`](#prisma_query_engine_library).
-It is the environment variable equivalent for the [`engineType` property of the `generator` block](/v6/orm/more/internals/engines#configuring-the-query-engine) which enables you to define the same setting in your Prisma Schema.
+It is the environment variable equivalent for the [`engineType` property of the `generator` block](/orm/v6/more/internals/engines#configuring-the-query-engine) which enables you to define the same setting in your Prisma Schema.
### Downloading Engines
@@ -181,7 +181,7 @@ It is the environment variable equivalent for the [`engineType` property of the
PRISMA_ENGINES_MIRROR=https://example.org/custom-engines/
```
-See [Prisma engines](/v6/orm/more/internals/engines#hosting-engines) for a conceptual overview of how to use this environment variable.
+See [Prisma engines](/orm/v6/more/internals/engines#hosting-engines) for a conceptual overview of how to use this environment variable.
Note: This environment variable used to be available as `PRISMA_BINARIES_MIRROR`, which was deprecated in Prisma ORM 3.0.1. It is discouraged to use anymore and will be removed in the future.
@@ -326,7 +326,7 @@ Use `PRISMA_CLI_BINARY_TARGETS` if you 1) deploy to a specific platform via an u
PRISMA_CLI_BINARY_TARGETS=darwin-arm64,rhel-openssl-3.0.x npm install
```
-This is the Prisma CLI equivalent for the [`binaryTargets` property of the `generator` block](/v6/orm/prisma-schema/overview/generators#binary-targets), which enables you to define the same setting for Prisma Client.
+This is the Prisma CLI equivalent for the [`binaryTargets` property of the `generator` block](/orm/v6/prisma-schema/overview/generators#binary-targets), which enables you to define the same setting for Prisma Client.
:::info[Note]
diff --git a/apps/docs/content/docs.v6/orm/reference/error-reference.mdx b/apps/docs/content/docs/orm/v6/reference/error-reference.mdx
similarity index 90%
rename from apps/docs/content/docs.v6/orm/reference/error-reference.mdx
rename to apps/docs/content/docs/orm/v6/reference/error-reference.mdx
index 6b37c1ac10..3f94405cb8 100644
--- a/apps/docs/content/docs.v6/orm/reference/error-reference.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/error-reference.mdx
@@ -1,12 +1,12 @@
---
title: Error message reference
description: 'Prisma Client, Migrate, Introspection error message reference'
-url: /v6/orm/reference/error-reference
+url: /orm/v6/reference/error-reference
metaTitle: Errors
metaDescription: 'Prisma Client, Migrate, Introspection error message reference'
---
-For more information about how to work with exceptions and error codes, see [Handling exceptions and errors](/v6/orm/prisma-client/debugging-and-troubleshooting/handling-exceptions-and-errors).
+For more information about how to work with exceptions and error codes, see [Handling exceptions and errors](/orm/v6/prisma-client/debugging-and-troubleshooting/handling-exceptions-and-errors).
## Prisma Client error types
@@ -116,7 +116,7 @@ Prisma Client throws a `PrismaClientValidationError` exception if validation fai
#### `P1012`
-**Note:** If you get error code P1012 after you upgrade Prisma ORM to version 4.0.0 or later, see the [version 4.0.0 upgrade guide](/v6/orm/more/upgrades/older-versions#upgrading-to-v4). A schema that was valid before version 4.0.0 might be invalid in version 4.0.0 and later. The upgrade guide explains how to update your schema to make it valid.
+**Note:** If you get error code P1012 after you upgrade Prisma ORM to version 4.0.0 or later, see the [version 4.0.0 upgrade guide](/orm/v6/more/upgrades/older-versions#upgrading-to-v4). A schema that was valid before version 4.0.0 might be invalid in version 4.0.0 and later. The upgrade guide explains how to update your schema to make it valid.
"\{full_error}"
@@ -278,7 +278,7 @@ Possible P1012 error messages:
#### `P2024`
-"Timed out fetching a new connection from the connection pool. (More info: [http://pris.ly/d/connection-pool](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool) (Current connection pool timeout: \{timeout}, connection limit: \{connection_limit})"
+"Timed out fetching a new connection from the connection pool. (More info: [http://pris.ly/d/connection-pool](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool) (Current connection pool timeout: \{timeout}, connection limit: \{connection_limit})"
#### `P2025`
@@ -306,7 +306,7 @@ Possible P1012 error messages:
#### `P2031`
-"Prisma needs to perform transactions, which requires your MongoDB server to be run as a replica set. See details: [https://pris.ly/d/mongodb-replica-set](/v6/orm/overview/databases/mongodb#replica-set-configuration)"
+"Prisma needs to perform transactions, which requires your MongoDB server to be run as a replica set. See details: [https://pris.ly/d/mongodb-replica-set](/orm/v6/overview/databases/mongodb#replica-set-configuration)"
#### `P2033`
@@ -350,7 +350,7 @@ The Schema Engine was previously called Migration Engine. This change was introd
#### `P3003`
-"The format of migrations changed, the saved migrations are no longer valid. To solve this problem, please follow the steps at: [https://pris.ly/d/migrate](/v6/orm/prisma-migrate/getting-started)"
+"The format of migrations changed, the saved migrations are no longer valid. To solve this problem, please follow the steps at: [https://pris.ly/d/migrate](/orm/v6/prisma-migrate/getting-started)"
#### `P3004`
@@ -358,7 +358,7 @@ The Schema Engine was previously called Migration Engine. This change was introd
#### `P3005`
-"The database schema is not empty. Read more about how to baseline an existing production database: [https://pris.ly/d/migrate-baseline](/v6/orm/prisma-migrate/workflows/baselining)"
+"The database schema is not empty. Read more about how to baseline an existing production database: [https://pris.ly/d/migrate-baseline](/orm/v6/prisma-migrate/workflows/baselining)"
#### `P3006`
@@ -374,7 +374,7 @@ The Schema Engine was previously called Migration Engine. This change was introd
#### `P3009`
-"migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: [https://pris.ly/d/migrate-resolve](/v6/orm/prisma-migrate/workflows/troubleshooting) \{details}"
+"migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: [https://pris.ly/d/migrate-resolve](/orm/v6/prisma-migrate/workflows/troubleshooting) \{details}"
#### `P3010`
@@ -394,7 +394,7 @@ The Schema Engine was previously called Migration Engine. This change was introd
#### `P3014`
-"Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at [https://pris.ly/d/migrate-shadow](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database).
+"Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at [https://pris.ly/d/migrate-shadow](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database).
Original error: \{error_code} \{inner_error}"
@@ -412,23 +412,23 @@ Original error: \{error_code} \{inner_error}"
#### `P3018`
-"A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: [https://pris.ly/d/migrate-resolve](/v6/orm/prisma-migrate/workflows/troubleshooting)"
Migration name: \{migration_name}
Database error code: \{database_error_code}
Database error: \{database_error} "
+"A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: [https://pris.ly/d/migrate-resolve](/orm/v6/prisma-migrate/workflows/troubleshooting)"
Migration name: \{migration_name}
Database error code: \{database_error_code}
Database error: \{database_error} "
#### `P3019`
-"The datasource provider `{provider}` specified in your schema does not match the one specified in the migration_lock.toml, `{expected_provider}`. Please remove your current migration directory and start a new migration history with prisma migrate dev. Read more: [https://pris.ly/d/migrate-provider-switch](/v6/orm/prisma-migrate/workflows/troubleshooting)"
+"The datasource provider `{provider}` specified in your schema does not match the one specified in the migration_lock.toml, `{expected_provider}`. Please remove your current migration directory and start a new migration history with prisma migrate dev. Read more: [https://pris.ly/d/migrate-provider-switch](/orm/v6/prisma-migrate/workflows/troubleshooting)"
#### `P3020`
-"The automatic creation of shadow databases is disabled on Azure SQL. Please set up a shadow database using the `shadowDatabaseUrl` datasource attribute. Read the docs page for more details: [https://pris.ly/d/migrate-shadow](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database)"
+"The automatic creation of shadow databases is disabled on Azure SQL. Please set up a shadow database using the `shadowDatabaseUrl` datasource attribute. Read the docs page for more details: [https://pris.ly/d/migrate-shadow](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database)"
#### `P3021`
-"Foreign keys cannot be created on this database. Learn more how to handle this: [https://pris.ly/d/migrate-no-foreign-keys](/v6/orm/overview/databases/planetscale#differences-to-consider)"
+"Foreign keys cannot be created on this database. Learn more how to handle this: [https://pris.ly/d/migrate-no-foreign-keys](/orm/v6/overview/databases/planetscale#differences-to-consider)"
#### `P3022`
-"Direct execution of DDL (Data Definition Language) SQL statements is disabled on this database. Please read more here about how to handle this: [https://pris.ly/d/migrate-no-direct-ddl](/v6/orm/overview/databases/planetscale#differences-to-consider)"
+"Direct execution of DDL (Data Definition Language) SQL statements is disabled on this database. Please read more here about how to handle this: [https://pris.ly/d/migrate-no-direct-ddl](/orm/v6/overview/databases/planetscale#differences-to-consider)"
#### `P3023`
@@ -456,7 +456,7 @@ Original error: \{error_code} \{inner_error}"
### Prisma Accelerate
-Prisma Accelerate-related errors start with `P6xxx` except for [`P5011`](/v6/orm/reference/error-reference#p5011-too-many-requests).
+Prisma Accelerate-related errors start with `P6xxx` except for [`P5011`](/orm/v6/reference/error-reference#p5011-too-many-requests).
#### `P6000` (`ServerError`)
@@ -476,13 +476,13 @@ The included usage of the current plan has been exceeded. This can only occur on
#### `P6004` (`QueryTimeout`)
-The global timeout of Accelerate has been exceeded. You can find the limit [here](/v6/postgres/database/connection-pooling#query-timeout-limit).
+The global timeout of Accelerate has been exceeded. You can find the limit [here](/accelerate/more/faq#can-i-increase-my-accelerate-query-duration-and-response-size-limits).
-> Also see the [troubleshooting guide](/v6/accelerate/troubleshoot#p6004-querytimeout) for more information.
+> Also see the [troubleshooting guide](/accelerate/more/troubleshoot#p6004-querytimeout) for more information.
#### `P6005` (`InvalidParameters`)
-The user supplied invalid parameters. Currently only relevant for transaction methods. For example, setting a timeout that is too high. You can find the limit [here](/v6/postgres/database/connection-pooling#interactive-transactions-query-timeout-limit).
+The user supplied invalid parameters. Currently only relevant for transaction methods. For example, setting a timeout that is too high. You can find the limit [here](/accelerate/more/faq#can-i-increase-my-accelerate-query-duration-and-response-size-limits).
#### `P6006` (`VersionNotSupported`)
@@ -492,18 +492,18 @@ The chosen Prisma version is not compatible with Accelerate. This may occur when
The engine failed to start. For example, it couldn't establish a connection to the database.
-> Also see the [troubleshooting guide](/v6/accelerate/troubleshoot#p6008-connectionerrorenginestarterror) for more information.
+> Also see the [troubleshooting guide](/accelerate/more/troubleshoot#p6008-connectionerrorenginestarterror) for more information.
#### `P6009` (`ResponseSizeLimitExceeded`)
-The global response size limit of Accelerate has been exceeded. You can find the limit [here](/v6/postgres/database/connection-pooling#response-size-limit).
+The global response size limit of Accelerate has been exceeded. You can find the limit [here](/accelerate/more/faq#can-i-increase-my-accelerate-query-duration-and-response-size-limits).
-> Also see the [troubleshooting guide](/v6/accelerate/troubleshoot#p6009-responsesizelimitexceeded) for more information.
+> Also see the [troubleshooting guide](/accelerate/more/troubleshoot#p6009-responsesizelimitexceeded) for more information.
#### `P6010` (`ProjectDisabledError`)
-Your accelerate project is disabled. Please [enable](/v6/accelerate/getting-started#1-enable-accelerate) it again to use it.
+Your accelerate project is disabled. Please [enable](/accelerate/getting-started#1-enable-accelerate) it again to use it.
#### `P5011` (`Too Many Requests`)
-This error indicates that the request volume exceeded. Implement a back-off strategy and try again later. For assistance with expected high workloads, contact [support](/v6/platform/support).
+This error indicates that the request volume exceeded. Implement a back-off strategy and try again later. For assistance with expected high workloads, contact [support](/console/more/support).
diff --git a/apps/docs/content/docs.v6/orm/reference/errors/index.mdx b/apps/docs/content/docs/orm/v6/reference/errors/index.mdx
similarity index 67%
rename from apps/docs/content/docs.v6/orm/reference/errors/index.mdx
rename to apps/docs/content/docs/orm/v6/reference/errors/index.mdx
index c4e6251504..45fd7aa42c 100644
--- a/apps/docs/content/docs.v6/orm/reference/errors/index.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/errors/index.mdx
@@ -1,7 +1,7 @@
---
title: Prisma Error Reference
description: Common Prisma ORM errors and how to troubleshoot them.
-url: /v6/orm/reference/errors
+url: /orm/v6/reference/errors
metaTitle: Errors
metaDescription: 'Prisma Client, Migrate, Introspection error message reference'
---
@@ -12,18 +12,18 @@ This section provides information about common errors you might encounter when u
### Prisma Client Errors
-- [**Connection Pool Issues**](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-pool) - Troubleshoot connection pooling problems
+- [**Connection Pool Issues**](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-pool) - Troubleshoot connection pooling problems
### Prisma Migrate Errors
-- [**Migration Overview**](/v6/orm/prisma-migrate/understanding-prisma-migrate/overview) - Understanding migration concepts
-- [**Shadow Database Issues**](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database) - Troubleshoot shadow database problems
-- [**Baselining Issues**](/v6/orm/prisma-migrate/workflows/baselining) - Issues with baseline migrations
+- [**Migration Overview**](/orm/v6/prisma-migrate/understanding-prisma-migrate/overview) - Understanding migration concepts
+- [**Shadow Database Issues**](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database) - Troubleshoot shadow database problems
+- [**Baselining Issues**](/orm/v6/prisma-migrate/workflows/baselining) - Issues with baseline migrations
### MongoDB Errors
-- [**Replica Set Configuration**](/v6/orm/overview/databases/mongodb) - MongoDB replica set requirements
+- [**Replica Set Configuration**](/orm/v6/overview/databases/mongodb) - MongoDB replica set requirements
## Full Error Reference
-For a complete list of error codes and their meanings, see the [Error Reference](/v6/orm/reference/error-reference).
+For a complete list of error codes and their meanings, see the [Error Reference](/orm/v6/reference/error-reference).
diff --git a/apps/docs/content/docs.v6/orm/reference/errors/meta.json b/apps/docs/content/docs/orm/v6/reference/errors/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/reference/errors/meta.json
rename to apps/docs/content/docs/orm/v6/reference/errors/meta.json
diff --git a/apps/docs/content/docs/orm/v6/reference/meta.json b/apps/docs/content/docs/orm/v6/reference/meta.json
new file mode 100644
index 0000000000..9306679aeb
--- /dev/null
+++ b/apps/docs/content/docs/orm/v6/reference/meta.json
@@ -0,0 +1,18 @@
+{
+ "title": "Reference",
+ "defaultOpen": true,
+ "pages": [
+ "prisma-cli-reference",
+ "prisma-client-reference",
+ "prisma-schema-reference",
+ "prisma-config-reference",
+ "connection-urls",
+ "environment-variables-reference",
+ "database-features",
+ "supported-databases",
+ "system-requirements",
+ "error-reference",
+ "...errors",
+ "...preview-features"
+ ]
+}
diff --git a/apps/docs/content/docs.v6/orm/reference/preview-features/cli-preview-features.mdx b/apps/docs/content/docs/orm/v6/reference/preview-features/cli-preview-features.mdx
similarity index 82%
rename from apps/docs/content/docs.v6/orm/reference/preview-features/cli-preview-features.mdx
rename to apps/docs/content/docs/orm/v6/reference/preview-features/cli-preview-features.mdx
index 781723b9b3..22bf11933f 100644
--- a/apps/docs/content/docs.v6/orm/reference/preview-features/cli-preview-features.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/preview-features/cli-preview-features.mdx
@@ -1,18 +1,18 @@
---
title: Prisma CLI Preview features
description: Prisma CLI features that are currently in Preview.
-url: /v6/orm/reference/preview-features/cli-preview-features
+url: /orm/v6/reference/preview-features/cli-preview-features
metaTitle: Prisma CLI Preview features
metaDescription: Prisma CLI features that are currently in Preview.
---
When we release a new Prisma CLI feature, it often starts in Preview so that you can test it and submit your feedback. After we improve the feature with your feedback and are satisfied with the internal test results, we promote the feature to general availability.
-For more information, see [ORM releases and maturity levels](/v6/orm/more/releases).
+For more information, see [ORM releases and maturity levels](/orm/v6/more/releases).
## Currently active Preview features
-There are currently no [Preview](/v6/orm/more/releases#preview) features for Prisma CLI.
+There are currently no [Preview](/orm/v6/more/releases#preview) features for Prisma CLI.
## Preview features promoted to general availability
@@ -20,7 +20,7 @@ In the list below, you can find a history of Prisma CLI features that were in Pr
| Features | Released in Preview | Released in general availability |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- |
-| [`prisma migrate diff`](/v6/orm/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute) | [3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0) | [3.13.0](https://github.com/prisma/prisma/releases/tag/3.13.0) |
-| [`prisma db execute`](/v6/orm/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute) | [3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0) | [3.13.0](https://github.com/prisma/prisma/releases/tag/3.13.0) |
-| [`prisma db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) | [2.10.0](https://github.com/prisma/prisma/releases/tag/2.10.0) | [2.22.0](https://github.com/prisma/prisma/releases/tag/2.22.0) |
-| [`prisma migrate`](/v6/orm/prisma-migrate/getting-started) | [2.13.0](https://github.com/prisma/prisma/releases/tag/2.13.0) | [2.19.0](https://github.com/prisma/prisma/releases/tag/2.19.0) |
+| [`prisma migrate diff`](/orm/v6/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute) | [3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0) | [3.13.0](https://github.com/prisma/prisma/releases/tag/3.13.0) |
+| [`prisma db execute`](/orm/v6/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute) | [3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0) | [3.13.0](https://github.com/prisma/prisma/releases/tag/3.13.0) |
+| [`prisma db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) | [2.10.0](https://github.com/prisma/prisma/releases/tag/2.10.0) | [2.22.0](https://github.com/prisma/prisma/releases/tag/2.22.0) |
+| [`prisma migrate`](/orm/v6/prisma-migrate/getting-started) | [2.13.0](https://github.com/prisma/prisma/releases/tag/2.13.0) | [2.19.0](https://github.com/prisma/prisma/releases/tag/2.19.0) |
diff --git a/apps/docs/content/docs.v6/orm/reference/preview-features/client-preview-features.mdx b/apps/docs/content/docs/orm/v6/reference/preview-features/client-preview-features.mdx
similarity index 91%
rename from apps/docs/content/docs.v6/orm/reference/preview-features/client-preview-features.mdx
rename to apps/docs/content/docs/orm/v6/reference/preview-features/client-preview-features.mdx
index 4eeab7880b..a22ab7e43a 100644
--- a/apps/docs/content/docs.v6/orm/reference/preview-features/client-preview-features.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/preview-features/client-preview-features.mdx
@@ -1,28 +1,28 @@
---
title: Prisma Client & Prisma schema
description: Prisma Client and Prisma schema features that are currently in Preview.
-url: /v6/orm/reference/preview-features/client-preview-features
+url: /orm/v6/reference/preview-features/client-preview-features
metaTitle: Prisma Client & Prisma schema
metaDescription: Prisma Client and Prisma schema features that are currently in Preview.
---
When we release a new Prisma Client or Prisma schema feature, it often starts in Preview so that you can test it and submit your feedback. After we improve the feature with your feedback and are satisfied with the internal test results, we promote the feature to general availability.
-For more information, see [ORM releases and maturity levels](/v6/orm/more/releases).
+For more information, see [ORM releases and maturity levels](/orm/v6/more/releases).
## Currently active Preview features
-The following [Preview](/v6/orm/more/releases#preview) feature flags are available for Prisma Client and Prisma schema:
+The following [Preview](/orm/v6/more/releases#preview) feature flags are available for Prisma Client and Prisma schema:
| Feature | Released into Preview | Feedback issue |
| ------------------------------------------------------------------------------- | :------------------------------------------------------------- | :-------------------------------------------------------------------: |
-| [`metrics`](/v6/orm/prisma-client/observability-and-logging/metrics) | [3.15.0](https://github.com/prisma/prisma/releases/tag/3.15.0) | [Submit feedback](https://github.com/prisma/prisma/issues/13579) |
-| [`views`](/v6/orm/prisma-schema/data-model/views) | [4.9.0](https://github.com/prisma/prisma/releases/tag/4.9.0) | [Submit feedback](https://github.com/prisma/prisma/issues/17335) |
+| [`metrics`](/orm/v6/prisma-client/observability-and-logging/metrics) | [3.15.0](https://github.com/prisma/prisma/releases/tag/3.15.0) | [Submit feedback](https://github.com/prisma/prisma/issues/13579) |
+| [`views`](/orm/v6/prisma-schema/data-model/views) | [4.9.0](https://github.com/prisma/prisma/releases/tag/4.9.0) | [Submit feedback](https://github.com/prisma/prisma/issues/17335) |
| `relationJoins` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22288) |
| `nativeDistinct` | [5.7.0](https://github.com/prisma/prisma/releases/tag/5.7.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/22287) |
| `typedSql` | [5.19.0](https://github.com/prisma/prisma/releases/tag/5.19.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25106) |
| `strictUndefinedChecks` | [5.20.0](https://github.com/prisma/prisma/releases/tag/5.20.0) | [Submit feedback](https://github.com/prisma/prisma/discussions/25271) |
-| [`fullTextSearchPostgres`](/v6/orm/prisma-client/queries/full-text-search) | [6.0.0](https://github.com/prisma/prisma/releases/tag/6.0.0) | [Submit feedback](https://github.com/prisma/prisma/issues/25773) |
+| [`fullTextSearchPostgres`](/orm/v6/prisma-client/queries/full-text-search) | [6.0.0](https://github.com/prisma/prisma/releases/tag/6.0.0) | [Submit feedback](https://github.com/prisma/prisma/issues/25773) |
| `shardKeys` | [6.10.0](https://pris.ly/release/6.10.0) | [Submit feedback](https://github.com/prisma/prisma/issues/) |
To enable a Preview feature, [add the feature flag to the `generator` block](#enabling-a-prisma-client-preview-feature) in your `schema.prisma` file. [Share your feedback on all Preview features on GitHub](https://github.com/prisma/prisma/issues/3108).
@@ -55,39 +55,39 @@ In the list below, you can find a history of Prisma Client and Prisma schema fea
| Feature | Released into Preview | Released into General Availability |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [`driverAdapters`](/v6/orm/overview/databases/database-drivers#driver-adapters) | [5.4.0](https://github.com/prisma/prisma/releases/tag/5.4.0) | [6.16.0](https://github.com/prisma/prisma/releases/tag/6.16.0) |
-| [`queryCompiler`](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine) | [6.7.0](https://github.com/prisma/prisma/releases/tag/6.15.0) | [6.16.0](https://github.com/prisma/prisma/releases/tag/6.16.0) |
-| [`multiSchema`](/v6/orm/prisma-schema/data-model/multi-schema) | [4.3.0](https://github.com/prisma/prisma/releases/tag/4.3.0) | [6.13.0](https://github.com/prisma/prisma/releases/tag/6.13.0) |
-| [`prismaSchemaFolder`](/v6/orm/prisma-schema/overview/location#multi-file-prisma-schema) | [5.15.0](https://github.com/prisma/prisma/releases/tag/5.15.0) | [6.7.0](https://pris.ly/release/6.7.0) |
+| [`driverAdapters`](/orm/v6/overview/databases/database-drivers#driver-adapters) | [5.4.0](https://github.com/prisma/prisma/releases/tag/5.4.0) | [6.16.0](https://github.com/prisma/prisma/releases/tag/6.16.0) |
+| [`queryCompiler`](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine) | [6.7.0](https://github.com/prisma/prisma/releases/tag/6.15.0) | [6.16.0](https://github.com/prisma/prisma/releases/tag/6.16.0) |
+| [`multiSchema`](/orm/v6/prisma-schema/data-model/multi-schema) | [4.3.0](https://github.com/prisma/prisma/releases/tag/4.3.0) | [6.13.0](https://github.com/prisma/prisma/releases/tag/6.13.0) |
+| [`prismaSchemaFolder`](/orm/v6/prisma-schema/overview/location#multi-file-prisma-schema) | [5.15.0](https://github.com/prisma/prisma/releases/tag/5.15.0) | [6.7.0](https://pris.ly/release/6.7.0) |
| `omitApi` | [5.13.0](https://github.com/prisma/prisma/releases/tag/5.13.0) | [6.2.0](https://github.com/prisma/prisma/releases/tag/6.2.0) |
| `jsonProtocol` | [4.11.0](https://github.com/prisma/prisma/releases/tag/4.11.0) | [5.0.0](https://github.com/prisma/prisma/releases/tag/5.0.0) |
-| [`extendedWhereUnique`](/v6/orm/reference/prisma-client-reference#filter-on-non-unique-fields-with-userwhereuniqueinput) | [4.5.0](https://github.com/prisma/prisma/releases/tag/4.5.0) | [5.0.0](https://github.com/prisma/prisma/releases/tag/5.0.0) |
-| [`fieldReference`](/v6/orm/reference/prisma-client-reference#compare-columns-in-the-same-table) | [4.3.0](https://github.com/prisma/prisma/releases/tag/4.3.0) | [5.0.0](https://github.com/prisma/prisma/releases/tag/5.0.0) |
-| [`clientExtensions`](/v6/orm/prisma-client/client-extensions) | [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0) | [4.16.0](https://github.com/prisma/prisma/releases/tag/4.16.0) |
-| [`filteredRelationCount`](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#filter-the-relation-count) | [4.3.0](https://github.com/prisma/prisma/releases/tag/4.3.0) | [4.16.0](https://github.com/prisma/prisma/releases/tag/4.16.0) |
-| [`tracing`](/v6/orm/prisma-client/observability-and-logging/opentelemetry-tracing) | [4.2.0](https://github.com/prisma/prisma/releases/tag/4.2.0) | [6.1.0](https://github.com/prisma/prisma/releases/tag/6.1.0) |
-| [`orderByNulls`](/v6/orm/prisma-client/queries/filtering-and-sorting#sort-with-null-records-first-or-last) | [4.1.0](https://github.com/prisma/prisma/releases/tag/4.1.0) | [4.16.0](https://github.com/prisma/prisma/releases/tag/4.16.0) |
-| [`referentialIntegrity`](/v6/orm/prisma-schema/data-model/relations/relation-mode) | [3.1.1](https://github.com/prisma/prisma/releases/tag/3.1.1) | [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0) |
-| [`interactiveTransactions`](/v6/orm/prisma-client/queries/transactions#interactive-transactions) | [2.29.0](https://github.com/prisma/prisma/releases/tag/2.29.0) | [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0) with Prisma Accelerate [5.1.1](https://github.com/prisma/prisma/releases/tag/5.1.1) |
-| [`extendedIndexes`](/v6/orm/prisma-schema/data-model/indexes) | [3.5.0](https://github.com/prisma/prisma/releases/tag/3.5.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
-| [`filterJson`](/v6/orm/prisma-client/special-fields-and-types/working-with-json-fields#filter-on-a-json-field-simple) | [2.23.0](https://github.com/prisma/prisma/releases/tag/2.23.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
-| [`improvedQueryRaw`](/v6/orm/prisma-client/using-raw-sql/raw-queries#raw-query-type-mapping) | [3.14.0](https://github.com/prisma/prisma/releases/tag/3.14.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
-| [`cockroachdb`](/v6/orm/overview/databases/cockroachdb) | [3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0) migrations in [3.11.0](https://github.com/prisma/prisma/releases/tag/3.11.0) | [3.14.0](https://github.com/prisma/prisma/releases/tag/3.14.0) |
-| [`mongodb`](/v6/orm/overview/databases/mongodb) | [2.27.0](https://github.com/prisma/prisma/releases/tag/2.27.0) introspection in [3.2.0](https://github.com/prisma/prisma/releases/tag/3.2.0) embedded docs in [3.4.0](https://github.com/prisma/prisma/releases/tag/3.4.0) raw queries in [3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0) filters/ordering in embedded docs in [3.11.0](https://github.com/prisma/prisma/releases/tag/3.11.0) | [3.12.0](https://github.com/prisma/prisma/releases/tag/3.12.0) |
-| [`microsoftSqlServer`](/v6/orm/overview/databases/sql-server) | [2.10.0](https://github.com/prisma/prisma/releases/tag/2.10.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
-| [`namedConstraints`](/v6/orm/prisma-schema/data-model/database-mapping#constraint-and-index-names) | [2.29.0](https://github.com/prisma/prisma/releases/tag/2.29.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
-| [`referentialActions`](/v6/orm/prisma-schema/data-model/relations/referential-actions) | [2.26.0](https://github.com/prisma/prisma/releases/tag/2.26.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
-| [`orderByAggregateGroup`](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#order-by-aggregate-group) | [2.21.0](https://github.com/prisma/prisma/releases/tag/2.21.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
-| [`orderByRelation`](/v6/orm/prisma-client/queries/filtering-and-sorting#sort-by-relation) | [2.16.0](https://github.com/prisma/prisma/releases/tag/2.16.0) aggregates in [2.19.0](https://github.com/prisma/prisma/releases/tag/2.19.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
-| [`selectRelationCount`](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#count-relations) | [2.20.0](https://github.com/prisma/prisma/releases/tag/2.20.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
+| [`extendedWhereUnique`](/orm/v6/reference/prisma-client-reference#filter-on-non-unique-fields-with-userwhereuniqueinput) | [4.5.0](https://github.com/prisma/prisma/releases/tag/4.5.0) | [5.0.0](https://github.com/prisma/prisma/releases/tag/5.0.0) |
+| [`fieldReference`](/orm/v6/reference/prisma-client-reference#compare-columns-in-the-same-table) | [4.3.0](https://github.com/prisma/prisma/releases/tag/4.3.0) | [5.0.0](https://github.com/prisma/prisma/releases/tag/5.0.0) |
+| [`clientExtensions`](/orm/v6/prisma-client/client-extensions) | [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0) | [4.16.0](https://github.com/prisma/prisma/releases/tag/4.16.0) |
+| [`filteredRelationCount`](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#filter-the-relation-count) | [4.3.0](https://github.com/prisma/prisma/releases/tag/4.3.0) | [4.16.0](https://github.com/prisma/prisma/releases/tag/4.16.0) |
+| [`tracing`](/orm/v6/prisma-client/observability-and-logging/opentelemetry-tracing) | [4.2.0](https://github.com/prisma/prisma/releases/tag/4.2.0) | [6.1.0](https://github.com/prisma/prisma/releases/tag/6.1.0) |
+| [`orderByNulls`](/orm/v6/prisma-client/queries/filtering-and-sorting#sort-with-null-records-first-or-last) | [4.1.0](https://github.com/prisma/prisma/releases/tag/4.1.0) | [4.16.0](https://github.com/prisma/prisma/releases/tag/4.16.0) |
+| [`referentialIntegrity`](/orm/v6/prisma-schema/data-model/relations/relation-mode) | [3.1.1](https://github.com/prisma/prisma/releases/tag/3.1.1) | [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0) |
+| [`interactiveTransactions`](/orm/v6/prisma-client/queries/transactions#interactive-transactions) | [2.29.0](https://github.com/prisma/prisma/releases/tag/2.29.0) | [4.7.0](https://github.com/prisma/prisma/releases/tag/4.7.0) with Prisma Accelerate [5.1.1](https://github.com/prisma/prisma/releases/tag/5.1.1) |
+| [`extendedIndexes`](/orm/v6/prisma-schema/data-model/indexes) | [3.5.0](https://github.com/prisma/prisma/releases/tag/3.5.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
+| [`filterJson`](/orm/v6/prisma-client/special-fields-and-types/working-with-json-fields#filter-on-a-json-field-simple) | [2.23.0](https://github.com/prisma/prisma/releases/tag/2.23.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
+| [`improvedQueryRaw`](/orm/v6/prisma-client/using-raw-sql/raw-queries#raw-query-type-mapping) | [3.14.0](https://github.com/prisma/prisma/releases/tag/3.14.0) | [4.0.0](https://github.com/prisma/prisma/releases/tag/4.0.0) |
+| [`cockroachdb`](/orm/v6/overview/databases/cockroachdb) | [3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0) migrations in [3.11.0](https://github.com/prisma/prisma/releases/tag/3.11.0) | [3.14.0](https://github.com/prisma/prisma/releases/tag/3.14.0) |
+| [`mongodb`](/orm/v6/overview/databases/mongodb) | [2.27.0](https://github.com/prisma/prisma/releases/tag/2.27.0) introspection in [3.2.0](https://github.com/prisma/prisma/releases/tag/3.2.0) embedded docs in [3.4.0](https://github.com/prisma/prisma/releases/tag/3.4.0) raw queries in [3.9.0](https://github.com/prisma/prisma/releases/tag/3.9.0) filters/ordering in embedded docs in [3.11.0](https://github.com/prisma/prisma/releases/tag/3.11.0) | [3.12.0](https://github.com/prisma/prisma/releases/tag/3.12.0) |
+| [`microsoftSqlServer`](/orm/v6/overview/databases/sql-server) | [2.10.0](https://github.com/prisma/prisma/releases/tag/2.10.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
+| [`namedConstraints`](/orm/v6/prisma-schema/data-model/database-mapping#constraint-and-index-names) | [2.29.0](https://github.com/prisma/prisma/releases/tag/2.29.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
+| [`referentialActions`](/orm/v6/prisma-schema/data-model/relations/referential-actions) | [2.26.0](https://github.com/prisma/prisma/releases/tag/2.26.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
+| [`orderByAggregateGroup`](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#order-by-aggregate-group) | [2.21.0](https://github.com/prisma/prisma/releases/tag/2.21.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
+| [`orderByRelation`](/orm/v6/prisma-client/queries/filtering-and-sorting#sort-by-relation) | [2.16.0](https://github.com/prisma/prisma/releases/tag/2.16.0) aggregates in [2.19.0](https://github.com/prisma/prisma/releases/tag/2.19.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
+| [`selectRelationCount`](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#count-relations) | [2.20.0](https://github.com/prisma/prisma/releases/tag/2.20.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
| `napi` | [2.20.0](https://github.com/prisma/prisma/releases/tag/2.20.0) | [3.0.1](https://github.com/prisma/prisma/releases/tag/3.0.1) |
-| [`groupBy`](/v6/orm/reference/prisma-client-reference#groupby) | [2.14.0](https://github.com/prisma/prisma/releases/tag/2.14.0) | [2.20.0](https://github.com/prisma/prisma/releases/tag/2.20.0) |
-| [`createMany`](/v6/orm/reference/prisma-client-reference#createmany) | [2.16.0](https://github.com/prisma/prisma/releases/tag/2.16.0) | [2.20.0](https://github.com/prisma/prisma/releases/tag/2.20.0) |
-| [`nativeTypes`](/v6/orm/prisma-schema/data-model/models#native-types-mapping) | [2.11.0](https://github.com/prisma/prisma/releases/tag/2.11.0) | [2.17.0](https://github.com/prisma/prisma/releases/tag/2.17.0) |
-| [`uncheckedScalarInputs`](/v6/orm/prisma-client/queries/relation-queries#create-a-single-record-and-multiple-related-records) | [2.11.0](https://github.com/prisma/prisma/releases/tag/2.11.0) | [2.15.0](https://github.com/prisma/prisma/releases/tag/2.15.0) |
-| [`transactionApi`](/v6/orm/prisma-client/queries/transactions#the-transaction-api) | [2.1.0](https://github.com/prisma/prisma/releases/tag/2.1.0) | [2.11.0](https://github.com/prisma/prisma/releases/tag/2.11.0) |
-| [`connectOrCreate`](/v6/orm/reference/prisma-client-reference#connectorcreate) | [2.1.0](https://github.com/prisma/prisma/releases/tag/2.1.0) | [2.11.0](https://github.com/prisma/prisma/releases/tag/2.11.0) |
-| [`atomicNumberOperations`](/v6/orm/reference/prisma-client-reference#atomic-number-operations) | [2.6.0](https://github.com/prisma/prisma/releases/tag/2.6.0) | [2.10.0](https://github.com/prisma/prisma/releases/tag/2.10.0) |
-| [`insensitiveFilters` (PostgreSQL)](/v6/orm/prisma-client/queries/filtering-and-sorting#case-insensitive-filtering) | [2.5.0](https://github.com/prisma/prisma/releases/tag/2.5.0) | [2.8.0](https://github.com/prisma/prisma/releases/tag/2.8.0) |
-| [`aggregateApi`](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#aggregate) | [2.2.0](https://github.com/prisma/prisma/releases/tag/2.2.0) | [2.5.0](https://github.com/prisma/prisma/releases/tag/2.5.0) |
-| [`distinct`](/v6/orm/reference/prisma-client-reference#distinct) | [2.3.0](https://github.com/prisma/prisma/releases/tag/2.3.0) | [2.5.0](https://github.com/prisma/prisma/releases/tag/2.5.0) |
+| [`groupBy`](/orm/v6/reference/prisma-client-reference#groupby) | [2.14.0](https://github.com/prisma/prisma/releases/tag/2.14.0) | [2.20.0](https://github.com/prisma/prisma/releases/tag/2.20.0) |
+| [`createMany`](/orm/v6/reference/prisma-client-reference#createmany) | [2.16.0](https://github.com/prisma/prisma/releases/tag/2.16.0) | [2.20.0](https://github.com/prisma/prisma/releases/tag/2.20.0) |
+| [`nativeTypes`](/orm/v6/prisma-schema/data-model/models#native-types-mapping) | [2.11.0](https://github.com/prisma/prisma/releases/tag/2.11.0) | [2.17.0](https://github.com/prisma/prisma/releases/tag/2.17.0) |
+| [`uncheckedScalarInputs`](/orm/v6/prisma-client/queries/relation-queries#create-a-single-record-and-multiple-related-records) | [2.11.0](https://github.com/prisma/prisma/releases/tag/2.11.0) | [2.15.0](https://github.com/prisma/prisma/releases/tag/2.15.0) |
+| [`transactionApi`](/orm/v6/prisma-client/queries/transactions#the-transaction-api) | [2.1.0](https://github.com/prisma/prisma/releases/tag/2.1.0) | [2.11.0](https://github.com/prisma/prisma/releases/tag/2.11.0) |
+| [`connectOrCreate`](/orm/v6/reference/prisma-client-reference#connectorcreate) | [2.1.0](https://github.com/prisma/prisma/releases/tag/2.1.0) | [2.11.0](https://github.com/prisma/prisma/releases/tag/2.11.0) |
+| [`atomicNumberOperations`](/orm/v6/reference/prisma-client-reference#atomic-number-operations) | [2.6.0](https://github.com/prisma/prisma/releases/tag/2.6.0) | [2.10.0](https://github.com/prisma/prisma/releases/tag/2.10.0) |
+| [`insensitiveFilters` (PostgreSQL)](/orm/v6/prisma-client/queries/filtering-and-sorting#case-insensitive-filtering) | [2.5.0](https://github.com/prisma/prisma/releases/tag/2.5.0) | [2.8.0](https://github.com/prisma/prisma/releases/tag/2.8.0) |
+| [`aggregateApi`](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#aggregate) | [2.2.0](https://github.com/prisma/prisma/releases/tag/2.2.0) | [2.5.0](https://github.com/prisma/prisma/releases/tag/2.5.0) |
+| [`distinct`](/orm/v6/reference/prisma-client-reference#distinct) | [2.3.0](https://github.com/prisma/prisma/releases/tag/2.3.0) | [2.5.0](https://github.com/prisma/prisma/releases/tag/2.5.0) |
diff --git a/apps/docs/content/docs.v6/orm/reference/preview-features/index.mdx b/apps/docs/content/docs/orm/v6/reference/preview-features/index.mdx
similarity index 68%
rename from apps/docs/content/docs.v6/orm/reference/preview-features/index.mdx
rename to apps/docs/content/docs/orm/v6/reference/preview-features/index.mdx
index a9a58e55e0..48c693421b 100644
--- a/apps/docs/content/docs.v6/orm/reference/preview-features/index.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/preview-features/index.mdx
@@ -2,14 +2,14 @@
title: Preview features
description: Previews are typically available behind a feature flag or require some form of opt-in.
hiddenPage: false
-url: /v6/orm/reference/preview-features
+url: /orm/v6/reference/preview-features
metaTitle: Preview features
metaDescription: Previews are typically available behind a feature flag or require some form of opt-in.
---
-Some Prisma ORM features are released as [Previews](/v6/orm/more/releases#preview). [Share your feedback on all Preview features on GitHub](https://github.com/prisma/prisma/issues/3108). For information about available preview features and how to enable them, see:
+Some Prisma ORM features are released as [Previews](/orm/v6/more/releases#preview). [Share your feedback on all Preview features on GitHub](https://github.com/prisma/prisma/issues/3108). For information about available preview features and how to enable them, see:
-- [Prisma Client and Prisma schema preview features](/v6/orm/reference/preview-features/client-preview-features)
-- [Prisma CLI preview features](/v6/orm/reference/preview-features/cli-preview-features)
+- [Prisma Client and Prisma schema preview features](/orm/v6/reference/preview-features/client-preview-features)
+- [Prisma CLI preview features](/orm/v6/reference/preview-features/cli-preview-features)
-For information regarding upgrading Prisma ORM and enabling Preview features see [Upgrading to use Preview features](/v6/orm/more/upgrades/preview-features).
+For information regarding upgrading Prisma ORM and enabling Preview features see [Upgrading to use Preview features](/orm/v6/more/upgrades/preview-features).
diff --git a/apps/docs/content/docs.v6/orm/reference/preview-features/meta.json b/apps/docs/content/docs/orm/v6/reference/preview-features/meta.json
similarity index 100%
rename from apps/docs/content/docs.v6/orm/reference/preview-features/meta.json
rename to apps/docs/content/docs/orm/v6/reference/preview-features/meta.json
diff --git a/apps/docs/content/docs.v6/orm/reference/prisma-cli-reference.mdx b/apps/docs/content/docs/orm/v6/reference/prisma-cli-reference.mdx
similarity index 93%
rename from apps/docs/content/docs.v6/orm/reference/prisma-cli-reference.mdx
rename to apps/docs/content/docs/orm/v6/reference/prisma-cli-reference.mdx
index 43d4b9b9dd..2b6e6beb56 100644
--- a/apps/docs/content/docs.v6/orm/reference/prisma-cli-reference.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/prisma-cli-reference.mdx
@@ -1,7 +1,7 @@
---
title: Prisma CLI reference
description: 'This page gives an overview of all available Prisma CLI commands, explains their options and shows numerous usage examples.'
-url: /v6/orm/reference/prisma-cli-reference
+url: /orm/v6/reference/prisma-cli-reference
metaTitle: Prisma CLI reference
metaDescription: 'This page gives an overview of all available Prisma CLI commands, explains their options and shows numerous usage examples.'
---
@@ -86,19 +86,19 @@ Bootstraps a fresh Prisma ORM project within the current directory.
The `init` command does not interpret any existing files. Instead, it creates a `prisma` directory containing a bare-bones `schema.prisma` file within your current directory.
-By default, the project sets up a [local Prisma Postgres](/v6/postgres/database/local-development) instance but you can choose a different database using the `--datasource-provider` option.
+By default, the project sets up a [local Prisma Postgres](/postgres/database/local-development) instance but you can choose a different database using the `--datasource-provider` option.
#### Arguments
| Argument | Required | Description | Default |
| ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `--datasource-provider` | No | Specifies the value for the `provider` field in the `datasource` block. Options are `prisma+postgres`, `sqlite`, `postgresql`, `mysql`, `sqlserver`, `mongodb` and `cockroachdb`. | `postgresql` |
-| `--db` | No | Shorthand syntax for `--datasource-provider prisma+postgres`; creates a new [Prisma Postgres](/v6/postgres) instance. Requires authentication in the [PDP Console](https://console.prisma.io). | |
+| `--db` | No | Shorthand syntax for `--datasource-provider prisma+postgres`; creates a new [Prisma Postgres](/postgres) instance. Requires authentication in the [PDP Console](https://console.prisma.io). | |
| `--prompt` (or `--vibe`) | No | Scaffolds a Prisma schema based on the prompt and deploys it to a fresh Prisma Postgres instance. Requires authentication in the [PDP Console](https://console.prisma.io). | |
| `--url` | No | Define a custom `datasource` url. | |
| `--generator-provider` | No | Define the generator provider to use. | `prisma-client` |
-| `--preview-feature` | No | Define the [Preview features](/v6/orm/reference/preview-features) to use. To define multiple Preview features, you have to provide the flag multiple times for each Preview feature. See examples. | |
-| `--output` | No | Specifies the [output location for the generated client](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path). | `../generated/prisma` |
+| `--preview-feature` | No | Define the [Preview features](/orm/v6/reference/preview-features) to use. To define multiple Preview features, you have to provide the flag multiple times for each Preview feature. See examples. | |
+| `--output` | No | Specifies the [output location for the generated client](/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path). | `../generated/prisma` |
| `--with-model` | No | Adds a simple `User` model to the initial Prisma schema. Available since version `5.14.0`. | |
#### Examples
@@ -283,7 +283,7 @@ export default defineConfig({
});
```
-See the [Prisma Config reference](/v6/orm/reference/prisma-config-reference) for more details.
+See the [Prisma Config reference](/orm/v6/reference/prisma-config-reference) for more details.
**`.env`**
@@ -373,7 +373,7 @@ DATABASE_URL="mysql://user:password@localhost:3306/mydb"
### `generate`
-The `generate` command generates assets like Prisma Client based on the [`generator`](/v6/orm/prisma-schema/overview/generators) and [`data model`](/v6/orm/prisma-schema/data-model/models) blocks defined in your `prisma/schema.prisma` file.
+The `generate` command generates assets like Prisma Client based on the [`generator`](/orm/v6/prisma-schema/overview/generators) and [`data model`](/orm/v6/prisma-schema/data-model/models) blocks defined in your `prisma/schema.prisma` file.
The `generate` command is most often used to generate Prisma Client with the `prisma-client` generator. This does the following:
@@ -395,9 +395,9 @@ generator client {
| Option | Required | Description | Default |
| ------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
-| `--data-proxy` | No | The `generate` command will generate Prisma Client for use with [Prisma Accelerate](/v6/accelerate) prior to Prisma 5.0.0. Mutually exclusive with `--accelerate` and `--no-engine`. |
-| `--accelerate` | No | The `generate` command will generate Prisma Client for use with [Prisma Accelerate](/v6/accelerate). Mutually exclusive with `--data-proxy` and `--no-engine`. Available in Prisma 5.1.0 and later. |
-| `--no-engine` | No | The `generate` command will generate Prisma Client without an accompanied engine for use with [Prisma Accelerate](/v6/accelerate). Mutually exclusive with `--data-proxy` and `--accelerate`. Available in Prisma ORM 5.2.0 and later. |
+| `--data-proxy` | No | The `generate` command will generate Prisma Client for use with [Prisma Accelerate](/accelerate) prior to Prisma 5.0.0. Mutually exclusive with `--accelerate` and `--no-engine`. |
+| `--accelerate` | No | The `generate` command will generate Prisma Client for use with [Prisma Accelerate](/accelerate). Mutually exclusive with `--data-proxy` and `--no-engine`. Available in Prisma 5.1.0 and later. |
+| `--no-engine` | No | The `generate` command will generate Prisma Client without an accompanied engine for use with [Prisma Accelerate](/accelerate). Mutually exclusive with `--data-proxy` and `--accelerate`. Available in Prisma ORM 5.2.0 and later. |
| `--no-hints` | No | The `generate` command will generate Prisma Client without usage hints, surveys or info banners being printed to the terminal. Available in Prisma ORM 5.16.0 and later. |
| `--allow-no-models` | No | The `generate` command will generate Prisma Client without generating any models. |
| `--watch` | No | The `generate` command will continue to watch the `schema.prisma` file and re-generate Prisma Client on file changes. |
@@ -470,11 +470,11 @@ prisma generate --generator client --generator zod_schemas
#### Generated Assets
-The `prisma-client` generator creates a customized client for working with your database in a custom output directory specified by the `output` field - you can [customize the output folder](/v6/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path).
+The `prisma-client` generator creates a customized client for working with your database in a custom output directory specified by the `output` field - you can [customize the output folder](/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path).
### `validate`
-Validates the [Prisma Schema Language](/v6/orm/prisma-schema/overview) of the Prisma schema file.
+Validates the [Prisma Schema Language](/orm/v6/prisma-schema/overview) of the Prisma schema file.
#### Arguments
@@ -618,7 +618,7 @@ For general debugging
- https_proxy:
- HTTPS_PROXY:
-For more information see our [environment variable documentation](/v6/orm/reference/environment-variables-reference)
+For more information see our [environment variable documentation](/orm/v6/reference/environment-variables-reference)
For hiding messages
- PRISMA_DISABLE_WARNINGS:
@@ -677,13 +677,13 @@ npx prisma@latest debug
## `dev`
-The `dev` command starts a [local Prisma Postgres](/v6/postgres/database/local-development) database that you can run Prisma ORM commands against. It is useful for development and testing purposes and also allows you to switch to [Prisma Postgres](/v6/postgres) in production easily.
+The `dev` command starts a [local Prisma Postgres](/postgres/database/local-development) database that you can run Prisma ORM commands against. It is useful for development and testing purposes and also allows you to switch to [Prisma Postgres](/postgres) in production easily.
### Arguments
| Argument | Required | Description | Default |
| --------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
-| `--name` (or `-n`) | No | Enables targeting a specific database instance. [Learn more](/v6/postgres/database/local-development#using-different-local-prisma-postgres-instances). | |
+| `--name` (or `-n`) | No | Enables targeting a specific database instance. [Learn more](/postgres/database/local-development#using-different-local-prisma-postgres-instances). | |
| `--port` (or `-p`) | No | Main port number the local Prisma Postgres HTTP server will listen on. | `51213` |
| `--db-port` (or `-P`) | No | Port number the local Prisma Postgres database server will listen on. | `51214` |
| `--shadow-db-port` | No | Port number the shadow database server will listen on. | `51215` |
@@ -719,7 +719,7 @@ This creates a named instance called `mydbname` that you can later start, stop,
### `dev start`
-Starts existing [local Prisma Postgres](/v6/postgres/database/local-development) instances in the background.
+Starts existing [local Prisma Postgres](/postgres/database/local-development) instances in the background.
:::note
@@ -747,7 +747,7 @@ This enables background instance management outside of the VS Code extension.
### `dev ls`
-Lists all available [local Prisma Postgres](/v6/postgres/database/local-development) instances:
+Lists all available [local Prisma Postgres](/postgres/database/local-development) instances:
```npm
npx prisma dev ls
@@ -757,7 +757,7 @@ This command shows all instances on your system with their current status and co
### `dev stop`
-Stops one or more [local Prisma Postgres](/v6/postgres/database/local-development) databases:
+Stops one or more [local Prisma Postgres](/postgres/database/local-development) databases:
```npm
npx prisma dev stop
@@ -783,7 +783,7 @@ The `stop` command is interactive and includes safety prompts to prevent acciden
### `dev rm`
-Removes the data of one or more [local Prisma Postgres](/v6/postgres/database/local-development) databases from your file system:
+Removes the data of one or more [local Prisma Postgres](/postgres/database/local-development) databases from your file system:
```npm
npx prisma dev rm
@@ -821,7 +821,7 @@ The `db pull` command connects to your database and adds Prisma models to your P
:::info
-Introspection with the `db pull` command on the [MongoDB connector](/v6/orm/overview/databases/mongodb) samples the data instead of reading a schema.
+Introspection with the `db pull` command on the [MongoDB connector](/orm/v6/overview/databases/mongodb) samples the data instead of reading a schema.
:::
@@ -948,8 +948,8 @@ This command is a good choice when you do not need to version schema changes, su
See also:
-- [Conceptual overview of `db push` and when to use it over Prisma Migrate](/v6/orm/prisma-migrate/workflows/prototyping-your-schema)
-- [Schema prototyping with `db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema)
+- [Conceptual overview of `db push` and when to use it over Prisma Migrate](/orm/v6/prisma-migrate/workflows/prototyping-your-schema)
+- [Schema prototyping with `db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema)
#### Prerequisites
@@ -1026,7 +1026,7 @@ prisma db push --schema=/tmp/schema.prisma
`db seed` changed from Preview to Generally Available (GA) in 3.0.1.
-See [Seeding your database](/v6/orm/prisma-migrate/workflows/seeding)
+See [Seeding your database](/orm/v6/prisma-migrate/workflows/seeding)
#### Options
@@ -1053,7 +1053,7 @@ The `db execute` command is Generally Available in versions 3.13.0 and later. If
:::warning
-This command is currently not supported on [MongoDB](/v6/orm/overview/databases/mongodb).
+This command is currently not supported on [MongoDB](/orm/v6/overview/databases/mongodb).
:::
@@ -1063,7 +1063,7 @@ The output of the command is connector-specific, and is not meant for returning
See also:
-- [Migration troubleshooting in production](/v6/orm/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute)
+- [Migration troubleshooting in production](/orm/v6/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute)
#### Prerequisites
@@ -1136,7 +1136,7 @@ Prisma Migrate changed from Preview to Generally Available (GA) in 2.19.0.
:::info
**Does not apply for MongoDB**
-Instead of `migrate dev` and related commands, [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/v6/orm/overview/databases/mongodb).
+Instead of `migrate dev` and related commands, [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) is used for [MongoDB](/orm/v6/overview/databases/mongodb).
:::
@@ -1146,14 +1146,14 @@ Instead of `migrate dev` and related commands, [`db push`](/v6/orm/prisma-migrat
The `migrate dev` command:
-1. Reruns the existing migration history in the [shadow database](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database) in order to detect schema drift (edited or deleted migration file, or a manual changes to the database schema)
+1. Reruns the existing migration history in the [shadow database](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database) in order to detect schema drift (edited or deleted migration file, or a manual changes to the database schema)
1. Applies pending migrations to the shadow database (for example, new migrations created by colleagues)
1. Generates a new migration from any changes you made to the Prisma schema before running `migrate dev`
1. Applies all unapplied migrations to the development database and updates the `_prisma_migrations` table
:::warning
-This command is not supported on [MongoDB](/v6/orm/overview/databases/mongodb). Use [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) instead.
+This command is not supported on [MongoDB](/orm/v6/overview/databases/mongodb). Use [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) instead.
:::
@@ -1165,8 +1165,8 @@ This command is not supported on [MongoDB](/v6/orm/overview/databases/mongodb).
See also:
-- [Conceptual overview of Prisma Migrate](/v6/orm/prisma-migrate/getting-started)
-- [Developing with Prisma Migrate](/v6/orm/prisma-migrate/getting-started)
+- [Conceptual overview of Prisma Migrate](/orm/v6/prisma-migrate/getting-started)
+- [Developing with Prisma Migrate](/orm/v6/prisma-migrate/getting-started)
#### Options
@@ -1184,7 +1184,7 @@ The `--skip-generate` and `--skip-seed` flags were removed in Prisma 7. `migrate
:::info
-If a [schema drift](/v6/orm/prisma-migrate/understanding-prisma-migrate/shadow-database#detecting-schema-drift) is detected while running `prisma migrate dev` using `--create-only`, you will be prompted to reset your database.
+If a [schema drift](/orm/v6/prisma-migrate/understanding-prisma-migrate/shadow-database#detecting-schema-drift) is detected while running `prisma migrate dev` using `--create-only`, you will be prompted to reset your database.
:::
@@ -1222,7 +1222,7 @@ This command:
:::warning
-This command is not supported on [MongoDB](/v6/orm/overview/databases/mongodb). Use [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) instead.
+This command is not supported on [MongoDB](/orm/v6/overview/databases/mongodb). Use [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) instead.
:::
@@ -1287,7 +1287,7 @@ The `migrate deploy` command applies all pending migrations, and creates the dat
:::warning
-This command is not supported on [MongoDB](/v6/orm/overview/databases/mongodb). Use [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) instead.
+This command is not supported on [MongoDB](/orm/v6/overview/databases/mongodb). Use [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) instead.
:::
@@ -1317,7 +1317,7 @@ Note that this command can only be used with a failed migration. If you try to u
:::warning
-This command is not supported on [MongoDB](/v6/orm/overview/databases/mongodb). Use [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) instead.
+This command is not supported on [MongoDB](/orm/v6/overview/databases/mongodb). Use [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) instead.
:::
@@ -1353,7 +1353,7 @@ The `prisma migrate status` command looks up the migrations in `./prisma/migrati
:::warning
-This command is not supported on [MongoDB](/v6/orm/overview/databases/mongodb). Use [`db push`](/v6/orm/prisma-migrate/workflows/prototyping-your-schema) instead.
+This command is not supported on [MongoDB](/orm/v6/overview/databases/mongodb). Use [`db push`](/orm/v6/prisma-migrate/workflows/prototyping-your-schema) instead.
:::
@@ -1404,7 +1404,7 @@ prisma migrate status
:::info
-This command is only partially supported for [MongoDB](/v6/orm/overview/databases/mongodb). See the command options below for details.
+This command is only partially supported for [MongoDB](/orm/v6/overview/databases/mongodb). See the command options below for details.
:::
@@ -1414,7 +1414,7 @@ The output can be given either as a human-readable summary (the default) or an e
:::warning
-The `migrate diff` command can only compare database features that are [supported by Prisma](/v6/orm/reference/database-features). If two databases differ only in unsupported features, such as views or triggers, then `migrate diff` will not show any difference between them.
+The `migrate diff` command can only compare database features that are [supported by Prisma](/orm/v6/reference/database-features). If two databases differ only in unsupported features, such as views or triggers, then `migrate diff` will not show any difference between them.
:::
@@ -1435,7 +1435,7 @@ Both schema sources must use the same database provider. For example, a diff com
See also:
-- [Migration troubleshooting in production](/v6/orm/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute)
+- [Migration troubleshooting in production](/orm/v6/prisma-migrate/workflows/patching-and-hotfixing#fixing-failed-migrations-with-migrate-diff-and-db-execute)
#### Prerequisites
@@ -1553,7 +1553,7 @@ Other options:
## Prisma Data Platform
-### `platform` ([Early Access](/v6/platform/maturity-levels#early-access))
+### `platform` ([Early Access](/console/more/feature-maturity#early-access))
The `platform` command provides access to the Prisma Data Platform through the Prisma CLI starting in version `5.10.0` or later.
@@ -1579,11 +1579,11 @@ The `platform` command provides access to the Prisma Data Platform through the P
- `platform accelerate enable`: Enables Prisma Accelerate for the specified environment.
- `platform accelerate disable`: Disables Prisma Accelerate for the specified environment.
-You can find the complete list of available commands with the arguments [here](/v6/platform/platform-cli/commands).
+You can find the complete list of available commands with the arguments [here](/cli/console).
### `mcp`
-Starts the [Prisma MCP server](/v6/postgres/integrations/mcp-server).
+Starts the [Prisma MCP server](/ai/tools/mcp-server).
## Studio
@@ -1597,7 +1597,7 @@ Prisma ORM v7 introduces a more stable version of Prisma Studio with improved pe
Prisma Studio currently supports PostgreSQL, MySQL, and SQLite. Support for CockroachDB and MongoDB is not available yet but may be added in future releases.
-For detailed database support information, including SQLite requirements, see [Databases supported by Prisma Studio](/v6/orm/tools/prisma-studio#databases-supported-by-prisma-studio).
+For detailed database support information, including SQLite requirements, see [Databases supported by Prisma Studio](/orm/v6/tools/prisma-studio#databases-supported-by-prisma-studio).
:::
@@ -1694,12 +1694,12 @@ Prisma CLI supports [custom HTTP proxies](https://github.com/prisma/prisma/issue
To activate usage of the proxy, provide either of the following environment variables:
-- [`HTTP_PROXY`](/v6/orm/reference/environment-variables-reference#http_proxy) or `http_proxy`: Proxy URL for http traffic, for example `http://localhost:8080`
-- [`HTTPS_PROXY`](/v6/orm/reference/environment-variables-reference#https_proxy) or `https_proxy`: Proxy URL for https traffic, for example `https://localhost:8080`
+- [`HTTP_PROXY`](/orm/v6/reference/environment-variables-reference#http_proxy) or `http_proxy`: Proxy URL for http traffic, for example `http://localhost:8080`
+- [`HTTPS_PROXY`](/orm/v6/reference/environment-variables-reference#https_proxy) or `https_proxy`: Proxy URL for https traffic, for example `https://localhost:8080`
## `npx create-db`
-The [`create-db`](https://create-db.prisma.io/) command provisions a temporary [Prisma Postgres](/v6/postgres) database with a single command. This is a standalone utility that can be invoked using `npx`. It's ideal for quickly testing, prototyping, or integrating with Prisma Postgres.
+The [`create-db`](https://create-db.prisma.io/) command provisions a temporary [Prisma Postgres](/postgres) database with a single command. This is a standalone utility that can be invoked using `npx`. It's ideal for quickly testing, prototyping, or integrating with Prisma Postgres.
You can run the following variants:
@@ -1714,4 +1714,4 @@ Each database created with these commands:
- Is available for **24 hours** by default.
- Can be **claimed for free** to make it permanent using the URL displayed in the CLI output.
-For full usage details, options (such as `--region` and `--interactive`), and examples, see the [documentation](/v6/postgres/introduction/npx-create-db).
+For full usage details, options (such as `--region` and `--interactive`), and examples, see the [documentation](/postgres/npx-create-db).
diff --git a/apps/docs/content/docs.v6/orm/reference/prisma-client-reference.mdx b/apps/docs/content/docs/orm/v6/reference/prisma-client-reference.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/reference/prisma-client-reference.mdx
rename to apps/docs/content/docs/orm/v6/reference/prisma-client-reference.mdx
index 5453f5c5fb..90cc7680ce 100644
--- a/apps/docs/content/docs.v6/orm/reference/prisma-client-reference.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/prisma-client-reference.mdx
@@ -1,7 +1,7 @@
---
title: Prisma Client API reference
description: API reference documentation for Prisma Client.
-url: /v6/orm/reference/prisma-client-reference
+url: /orm/v6/reference/prisma-client-reference
metaTitle: Prisma Client API
metaDescription: API reference documentation for Prisma Client.
---
@@ -18,16 +18,16 @@ generator client {
}
```
-Prisma ORM without Rust binaries has been [Generally Available](/v6/orm/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
+Prisma ORM without Rust binaries has been [Generally Available](/orm/v6/more/releases#generally-available-ga) since [v6.16.0](https://pris.ly/release/6.16.0).
-Note that you need to use a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters) in this case.
+Note that you need to use a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters) in this case.
When using this architecture:
- No Rust query engine binary is downloaded or shipped.
- The database connection pool is maintained by the native JS database driver you install (e.g., `@prisma/adapter-pg` for PostgreSQL).
-This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/v6/orm/prisma-client/setup-and-configuration/no-rust-engine).
+This setup can simplify deployments in serverless or edge runtimes. Learn more in the [docs here](/orm/v6/prisma-client/setup-and-configuration/no-rust-engine).
Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this [blog post](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks).
@@ -86,7 +86,7 @@ This section describes the `PrismaClient` constructor and its parameters.
### `datasources`
-Programmatically overrides properties of the `datasource` block in the `schema.prisma` file - for example, as part of an integration test. See also: [Data sources](/v6/orm/prisma-schema/overview/data-sources)
+Programmatically overrides properties of the `datasource` block in the `schema.prisma` file - for example, as part of an integration test. See also: [Data sources](/orm/v6/prisma-schema/overview/data-sources)
From version 5.2.0 and upwards, you can also use the [`datasourceUrl`](#datasourceurl) property to programmatically override the database connection string.
@@ -94,7 +94,7 @@ From version 5.2.0 and upwards, you can also use the [`datasourceUrl`](#datasour
| Example property | Example value | Description |
| ---------------- | ----------------------------- | ---------------------------------------------------------------------- |
-| `db` | `{ url: 'file:./dev_qa.db' }` | The database [connection URL](/v6/orm/reference/connection-urls). |
+| `db` | `{ url: 'file:./dev_qa.db' }` | The database [connection URL](/orm/v6/reference/connection-urls). |
#### Remarks
@@ -133,7 +133,7 @@ Programmatically overrides the [`datasource`](#datasources) block in the `schema
| Option | Example value | Description |
| -------------------------- | -------------------- | ---------------------------------------------------------------------- |
-| Database connection string | `'file:./dev_qa.db'` | The database [connection URL](/v6/orm/reference/connection-urls). |
+| Database connection string | `'file:./dev_qa.db'` | The database [connection URL](/orm/v6/reference/connection-urls). |
#### Examples
@@ -147,7 +147,7 @@ const prisma = new PrismaClient({
### `log`
-Determines the type and level of logging. See also: [Logging](/v6/orm/prisma-client/observability-and-logging/logging)
+Determines the type and level of logging. See also: [Logging](/orm/v6/prisma-client/observability-and-logging/logging)
#### Options
@@ -368,7 +368,7 @@ const prisma = new PrismaClient({
### `adapter`
-Defines an instance of a [driver adapter](/v6/orm/overview/databases/database-drivers#driver-adapters). See also [Database drivers](/v6/orm/overview/databases/database-drivers) .
+Defines an instance of a [driver adapter](/orm/v6/overview/databases/database-drivers#driver-adapters). See also [Database drivers](/orm/v6/overview/databases/database-drivers) .
:::info
@@ -378,7 +378,7 @@ This is available from version 5.4.0 and newer as a Preview feature behind the `
#### Example
-The example below uses the [Neon driver adapter](/v6/orm/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm)
+The example below uses the [Neon driver adapter](/orm/v6/overview/databases/neon#how-to-use-neons-serverless-driver-with-prisma-orm)
```ts
import { PrismaNeon } from "@prisma/adapter-neon";
@@ -394,7 +394,7 @@ const prisma = new PrismaClient({ adapter });
### `comments`
-Defines an array of [SQL commenter plugins](/v6/orm/prisma-client/observability-and-logging/sql-comments) that add metadata to your SQL queries as comments. This is useful for observability, debugging, and correlating queries with application traces.
+Defines an array of [SQL commenter plugins](/orm/v6/prisma-client/observability-and-logging/sql-comments) that add metadata to your SQL queries as comments. This is useful for observability, debugging, and correlating queries with application traces.
#### Options
@@ -455,7 +455,7 @@ This produces SQL queries with comments like:
SELECT "id", "name" FROM "User" /*action='findMany',application='my-app',environment='production',model='User'*/
```
-For more details, see [SQL comments](/v6/orm/prisma-client/observability-and-logging/sql-comments).
+For more details, see [SQL comments](/orm/v6/prisma-client/observability-and-logging/sql-comments).
### `rejectOnNotFound`
@@ -525,7 +525,7 @@ const prisma = new PrismaClient({
:::
-Allows to set [transaction options](/v6/orm/prisma-client/queries/transactions#transaction-options) globally on the constructor level.
+Allows to set [transaction options](/orm/v6/prisma-client/queries/transactions#transaction-options) globally on the constructor level.
#### Remarks
@@ -537,7 +537,7 @@ Allows to set [transaction options](/v6/orm/prisma-client/queries/transactions#t
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `maxWait` | The maximum amount of time Prisma Client will wait to acquire a transaction from the database. The default value is 2 seconds. |
| `timeout` | The maximum amount of time the interactive transaction can run before being canceled and rolled back. The default value is 5 seconds. |
-| `isolationLevel` | Sets the [transaction isolation level](/v6/orm/prisma-client/queries/transactions#transaction-isolation-level). By default this is set to the value currently configured in your database. The available can vary depending on the database you use. |
+| `isolationLevel` | Sets the [transaction isolation level](/orm/v6/prisma-client/queries/transactions#transaction-isolation-level). By default this is set to the value currently configured in your database. The available can vary depending on the database you use. |
#### Example
@@ -553,9 +553,9 @@ const prisma = new PrismaClient({
## Model queries
-Use model queries to perform CRUD operations on your models. See also: [CRUD](/v6/orm/prisma-client/queries/crud)
+Use model queries to perform CRUD operations on your models. See also: [CRUD](/orm/v6/prisma-client/queries/crud)
-> **Note**: It's a best practice to always validate and sanitize any untrusted user data before passing it into Prisma queries. Failure to do so can lead to SQL injection or other injection vulnerabilities if the type checks are bypassed. Make sure user-supplied values cannot inadvertently bypass critical checks. We strongly recommend performing type checking and input validation at the application layer. For more details, see [Custom Validation](/v6/orm/prisma-client/queries/custom-validation) section.
+> **Note**: It's a best practice to always validate and sanitize any untrusted user data before passing it into Prisma queries. Failure to do so can lead to SQL injection or other injection vulnerabilities if the type checks are bypassed. Make sure user-supplied values cannot inadvertently bypass critical checks. We strongly recommend performing type checking and input validation at the application layer. For more details, see [Custom Validation](/orm/v6/prisma-client/queries/custom-validation) section.
### `findUnique()`
@@ -568,19 +568,19 @@ Use model queries to perform CRUD operations on your models. See also: [CRUD](/v
#### Remarks
-- Prisma Client's dataloader [automatically batches `findUnique()` queries](/v6/orm/prisma-client/queries/query-optimization-performance#solving-n1-in-graphql-with-findunique-and-prisma-clients-dataloader) with the same `select` and `where` parameters.
+- Prisma Client's dataloader [automatically batches `findUnique()` queries](/orm/v6/prisma-client/queries/query-optimization-performance#solving-n1-in-graphql-with-findunique-and-prisma-clients-dataloader) with the same `select` and `where` parameters.
- If you want the query to throw an error if the record is not found, then consider using [`findUniqueOrThrow`](#finduniqueorthrow) instead.
-- You cannot use [filter conditions](#filter-conditions-and-operators) (e.g. `equals`, `contains`, `not`) to filter fields of the [JSON](/v6/orm/reference/prisma-schema-reference#json) data type. Using filter conditions will likely result in a `null` response for that field.
+- You cannot use [filter conditions](#filter-conditions-and-operators) (e.g. `equals`, `contains`, `not`) to filter fields of the [JSON](/orm/v6/reference/prisma-schema-reference#json) data type. Using filter conditions will likely result in a `null` response for that field.
#### Options
| Name | Example type (`User`) | Required | Description |
| ---------------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `where` | `UserWhereUniqueInput` | **Yes** | Wraps all fields of a model so that a record can be selected ([learn more](#filter-on-non-unique-fields-with-userwhereuniqueinput)). Before version 4.5.0, this type only wraps _unique_ fields of a model. |
-| `select` | `XOR` | No | [Specifies which properties to include](/v6/orm/prisma-client/queries/select-fields) on the returned object. |
-| `include` | `XOR` | No | [Specifies which relations should be eagerly loaded](/v6/orm/prisma-client/queries/relation-queries) on the returned object. |
-| `omit` | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/v6/orm/more/releases#preview) since 5.13.0 |
-| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/v6/orm/more/releases#preview) since 5.9.0. |
+| `select` | `XOR` | No | [Specifies which properties to include](/orm/v6/prisma-client/queries/select-fields) on the returned object. |
+| `include` | `XOR` | No | [Specifies which relations should be eagerly loaded](/orm/v6/prisma-client/queries/relation-queries) on the returned object. |
+| `omit` | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/orm/v6/more/releases#preview) since 5.13.0 |
+| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/orm/v6/more/releases#preview) since 5.9.0. |
#### Return type
@@ -686,7 +686,7 @@ await prisma.user.findUniqueOrThrow({
`findUniqueOrThrow()` differs from `findUnique()` as follows:
- Its return type is non-nullable. For example, `post.findUnique()` can return `post` or `null`, but `post.findUniqueOrThrow()` always returns `post`.
-- It is not compatible with sequential operations in the [`$transaction` API](/v6/orm/prisma-client/queries/transactions#the-transaction-api). If the query throws a `PrismaClientKnownRequestError`, then the API will not roll back any operations in the array of calls. As a workaround, you can use interactive transactions with the `$transaction` API, as follows:
+- It is not compatible with sequential operations in the [`$transaction` API](/orm/v6/prisma-client/queries/transactions#the-transaction-api). If the query throws a `PrismaClientKnownRequestError`, then the API will not roll back any operations in the array of calls. As a workaround, you can use interactive transactions with the `$transaction` API, as follows:
```ts
$transaction(async (prisma) => {
@@ -707,10 +707,10 @@ await prisma.user.findUniqueOrThrow({
| Name | Example type (`User`) | Required | Description |
| ---------------------- | ----------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `select` | `XOR` | No | [Specifies which properties to include](/v6/orm/prisma-client/queries/select-fields) on the returned object. |
-| `include` | `XOR` | No | [Specifies which relations should be eagerly loaded](/v6/orm/prisma-client/queries/relation-queries) on the returned object. |
-| `omit` | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/v6/orm/more/releases#preview) since 5.13.0. |
-| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/v6/orm/more/releases#preview) since 5.9.0. |
+| `select` | `XOR` | No | [Specifies which properties to include](/orm/v6/prisma-client/queries/select-fields) on the returned object. |
+| `include` | `XOR` | No | [Specifies which relations should be eagerly loaded](/orm/v6/prisma-client/queries/relation-queries) on the returned object. |
+| `omit` | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/orm/v6/more/releases#preview) since 5.13.0. |
+| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/orm/v6/more/releases#preview) since 5.9.0. |
| `where` | `UserWhereInput` | No | Wraps _all_ model fields in a type so that the list can be filtered by any property. |
| `orderBy` | `XOR, UserOrderByInput>` | No | Lets you order the returned list by any property. |
@@ -784,7 +784,7 @@ Note that before Prisma v6, it would throw a `NotFoundError: No User found error
`findFirstOrThrow()` differs from `findFirst()` as follows:
- Its return type is non-nullable. For example, `post.findFirst()` can return `post` or `null`, but `post.findFirstOrThrow` always returns `post`.
-- It is not compatible with sequential operations in the [`$transaction` API](/v6/orm/prisma-client/queries/transactions#the-transaction-api). If the query returns `PrismaClientKnownRequestError`, then the API will not roll back any operations in the array of calls. As a workaround, you can use interactive transactions with the `$transaction` API, as follows:
+- It is not compatible with sequential operations in the [`$transaction` API](/orm/v6/prisma-client/queries/transactions#the-transaction-api). If the query returns `PrismaClientKnownRequestError`, then the API will not roll back any operations in the array of calls. As a workaround, you can use interactive transactions with the `$transaction` API, as follows:
```ts
prisma.$transaction(async (tx) => {
@@ -801,10 +801,10 @@ Note that before Prisma v6, it would throw a `NotFoundError: No User found error
| Name | Type | Required | Description |
| ---------------------- | ------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `select` | `XOR` | No | [Specifies which properties to include](/v6/orm/prisma-client/queries/select-fields) on the returned object. |
-| `include` | `XOR` | No | [Specifies which relations should be eagerly loaded](/v6/orm/prisma-client/queries/relation-queries) on the returned object. |
-| `omit` | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/v6/orm/more/releases#preview) since 5.13.0 |
-| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/v6/orm/more/releases#preview) since 5.9.0. |
+| `select` | `XOR` | No | [Specifies which properties to include](/orm/v6/prisma-client/queries/select-fields) on the returned object. |
+| `include` | `XOR` | No | [Specifies which relations should be eagerly loaded](/orm/v6/prisma-client/queries/relation-queries) on the returned object. |
+| `omit` | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/orm/v6/more/releases#preview) since 5.13.0 |
+| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/orm/v6/more/releases#preview) since 5.9.0. |
| `where` | `UserWhereInput` | No | Wraps _all_ model fields in a type so that the list can be filtered by any property. |
| `orderBy` | `XOR`ByInput>, PostOrderByInput>` | No | Lets you order the returned list by any property. |
| `cursor` | `UserWhereUniqueInput` | No | Specifies the position for the list (the value typically specifies an `id` or another unique value). |
@@ -841,10 +841,10 @@ const user = await prisma.user.findMany({
| Name | Type | Required | Description |
| ---------------------- | -------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `data` | `XOR`UserUncheckedCreateInput>` | **Yes** | Wraps all the model fields in a type so that they can be provided when creating new records. It also includes relation fields which lets you perform (transactional) nested inserts. Fields that are marked as optional or have default values in the datamodel are optional. |
-| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/v6/orm/prisma-client/queries/select-fields) on the returned object. |
-| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/v6/orm/prisma-client/queries/relation-queries) on the returned object. |
-| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/v6/orm/more/releases#preview) since 5.13.0 |
-| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/v6/orm/more/releases#preview) since 5.9.0. |
+| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/orm/v6/prisma-client/queries/select-fields) on the returned object. |
+| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/orm/v6/prisma-client/queries/relation-queries) on the returned object. |
+| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/orm/v6/more/releases#preview) since 5.13.0 |
+| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/orm/v6/more/releases#preview) since 5.9.0. |
#### Return type
@@ -936,10 +936,10 @@ prisma:query COMMIT
| ---------------------- | ------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `data` | `XOR`UserUncheckedUpdateInput>` | **Yes** | Wraps all the fields of the model so that they can be provided when updating an existing record. Fields that are marked as optional or have default values in the datamodel are optional. |
| `where` | `UserWhereUniqueInput` | **Yes** | Wraps all fields of a model so that a record can be selected ([learn more](#filter-on-non-unique-fields-with-userwhereuniqueinput)). Before version 4.5.0, this type only wraps _unique_ fields of a model. |
-| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/v6/orm/prisma-client/queries/select-fields) on the returned object. |
-| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/v6/orm/prisma-client/queries/relation-queries) on the returned object. |
-| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/v6/orm/more/releases#preview) since 5.13.0. |
-| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/v6/orm/more/releases#preview) since 5.9.0. |
+| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/orm/v6/prisma-client/queries/select-fields) on the returned object. |
+| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/orm/v6/prisma-client/queries/relation-queries) on the returned object. |
+| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/orm/v6/more/releases#preview) since 5.13.0. |
+| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/orm/v6/more/releases#preview) since 5.9.0. |
#### Return type
@@ -947,7 +947,7 @@ prisma:query COMMIT
| ---------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| JavaScript object (typed) | `User` | |
| JavaScript object (plain) | `{ name: "Alice Wonderland" }` | Use `select` and `include` to determine which fields to return. |
-| `PrismaClientKnownRequestError` (code `P2025`) | | Thrown if the record to update does not exist. See [Error reference](/v6/orm/reference/error-reference#p2025) |
+| `PrismaClientKnownRequestError` (code `P2025`) | | Thrown if the record to update does not exist. See [Error reference](/orm/v6/reference/error-reference#p2025) |
#### Remarks
@@ -985,10 +985,10 @@ This section covers the usage of the `upsert()` operation. To learn about using
| `create` | `XOR`UserUncheckedCreateInput>` | **Yes** | Wraps all the fields of the model so that they can be provided when creating new records. It also includes relation fields which lets you perform (transactional) nested inserts. Fields that are marked as optional or have default values in the datamodel are optional. |
| `update` | `XOR`UserUncheckedUpdateInput>` | **Yes** | Wraps all the fields of the model so that they can be provided when updating an existing record. Fields that are marked as optional or have default values in the datamodel are optional. |
| `where` | `UserWhereUniqueInput` | **Yes** | Wraps all fields of a model so that a record can be selected ([learn more](#filter-on-non-unique-fields-with-userwhereuniqueinput)). Before version 4.5.0, this type only wraps _unique_ fields of a model. |
-| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/v6/orm/prisma-client/queries/select-fields) on the returned object. |
-| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/v6/orm/prisma-client/queries/relation-queries) on the returned object. |
-| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/v6/orm/more/releases#preview) since 5.13.0 |
-| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/v6/orm/more/releases#preview) since 5.9.0. |
+| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/orm/v6/prisma-client/queries/select-fields) on the returned object. |
+| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/orm/v6/prisma-client/queries/relation-queries) on the returned object. |
+| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/orm/v6/more/releases#preview) since 5.13.0 |
+| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/orm/v6/more/releases#preview) since 5.9.0. |
#### Return type
@@ -1019,7 +1019,7 @@ const user = await prisma.user.upsert({
##### Problem
-If multiple upsert operations happen at the same time and the record doesn't already exist, then one or more of the operations might return a [unique key constraint error](/v6/orm/reference/error-reference#p2002).
+If multiple upsert operations happen at the same time and the record doesn't already exist, then one or more of the operations might return a [unique key constraint error](/orm/v6/reference/error-reference#p2002).
##### Cause
@@ -1059,7 +1059,7 @@ Prisma Client can use database upserts if your stack meets the following criteri
Prisma Client uses a database upsert for an `upsert` query when the query meets the following criteria:
- There are no nested queries in the `upsert`'s `create` and `update` [options](#options-7)
-- The query does _not_ include a selection that uses a [nested read](/v6/orm/prisma-client/queries/relation-queries#nested-reads)
+- The query does _not_ include a selection that uses a [nested read](/orm/v6/prisma-client/queries/relation-queries#nested-reads)
- The query modifies only one model
- There is only one unique field in the `upsert`'s `where` option
- The unique field in the `where` option and the unique field in the `create` option have the same value
@@ -1192,10 +1192,10 @@ To delete records that match a certain criteria, use [`deleteMany`](#deletemany)
| Name | Type | Required | Description |
| ---------------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `where` | `UserWhereUniqueInput` | **Yes** | Wraps all fields of a model so that a record can be selected ([learn more](#filter-on-non-unique-fields-with-userwhereuniqueinput)). Before version 4.5.0, this type only wraps _unique_ fields of a model. |
-| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/v6/orm/prisma-client/queries/select-fields) on the returned object. |
-| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/v6/orm/prisma-client/queries/relation-queries) on the returned object. |
-| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/v6/orm/more/releases#preview) since 5.13.0 |
-| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/v6/orm/more/releases#preview) since 5.9.0. |
+| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/orm/v6/prisma-client/queries/select-fields) on the returned object. |
+| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/orm/v6/prisma-client/queries/relation-queries) on the returned object. |
+| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned object. In [Preview](/orm/v6/more/releases#preview) since 5.13.0 |
+| `relationLoadStrategy` | `'join'` or `'query'` | No | **Default: `join`**. Specifies the [load strategy](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview) for a relation query. Only available in combination with `include` (or `select` on a relation field). In [Preview](/orm/v6/more/releases#preview) since 5.9.0. |
#### Return type
@@ -1203,7 +1203,7 @@ To delete records that match a certain criteria, use [`deleteMany`](#deletemany)
| ---------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ | --- |
| JavaScript object (typed) | `User` | The `User` record that was deleted. |
| JavaScript object (plain) | `{ name: "Alice Wonderland" }` | Data from the `User` record that was deleted. Use `select` and `include` to determine which fields to return. |
-| `PrismaClientKnownRequestError` (code `P2025`) | | Thrown if the record to delete does not exist. See [Error reference](/v6/orm/reference/error-reference#p2025) | |
+| `PrismaClientKnownRequestError` (code `P2025`) | | Thrown if the record to delete does not exist. See [Error reference](/orm/v6/reference/error-reference#p2025) | |
#### Remarks
@@ -1260,7 +1260,7 @@ const deleteUser = await prisma.user.delete({
- As of Prisma ORM version 5.12.0, `createMany()` is now supported by SQLite.
- The `skipDuplicates` option is not supported by MongoDB, SQLServer, or SQLite.
-- You **cannot** create or connect relations by using nested `create`, `createMany`, `connect`, `connectOrCreate` queries inside a top-level `createMany()` query. See here for a [workaround](/v6/orm/prisma-client/queries/relation-queries#using-nested-createmany).
+- You **cannot** create or connect relations by using nested `create`, `createMany`, `connect`, `connectOrCreate` queries inside a top-level `createMany()` query. See here for a [workaround](/orm/v6/prisma-client/queries/relation-queries#using-nested-createmany).
- You can use a nested [`createMany`](#createmany-1) query inside an [`update()`](#update) or [`create()`](#create) query - for example, add a `User` and two `Post` records with a nested `createMany` at the same time.
#### Examples
@@ -1291,16 +1291,16 @@ This feature is available in Prisma ORM version 5.14.0 and later for PostgreSQL,
| Name | Type | Required | Description |
| --------------------- | --------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data` | `Enumerable` | **Yes** | Wraps all the model fields in a type so that they can be provided when creating new records. Fields that are marked as optional or have default values in the datamodel are optional. |
-| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/v6/orm/prisma-client/queries/select-fields) on the returned objects. |
-| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned objects. In [Preview](/v6/orm/more/releases#preview) since 5.13.0. Mutually exclusive with `select`. |
-| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/v6/orm/prisma-client/queries/relation-queries) on the returned objects. |
+| [`select`](#select) | `XOR` | No | [Specifies which properties to include](/orm/v6/prisma-client/queries/select-fields) on the returned objects. |
+| [`omit`](#omit) | `XOR` | No | Specifies which properties to exclude on the returned objects. In [Preview](/orm/v6/more/releases#preview) since 5.13.0. Mutually exclusive with `select`. |
+| [`include`](#include) | `XOR` | No | [Specifies which relations should be eagerly loaded](/orm/v6/prisma-client/queries/relation-queries) on the returned objects. |
| `skipDuplicates?` | `boolean` | No | Do not insert records with unique fields or ID fields that already exist. Only supported by databases that support [`ON CONFLICT DO NOTHING`](https://www.postgresql.org/docs/9.5/sql-insert.html#SQL-ON-CONFLICT). This excludes MongoDB and SQLServer |
#### Remarks
- The `skipDuplicates` option is not supported by SQLite.
- Note that the order of elements returned by `createManyAndReturn` is not guaranteed.
-- You **cannot** create or connect relations by using nested `create`, `createMany`, `connect`, `connectOrCreate` queries inside a top-level `createManyAndReturn()` query. See here for a [workaround](/v6/orm/prisma-client/queries/relation-queries#using-nested-createmany).
+- You **cannot** create or connect relations by using nested `create`, `createMany`, `connect`, `connectOrCreate` queries inside a top-level `createManyAndReturn()` query. See here for a [workaround](/orm/v6/prisma-client/queries/relation-queries#using-nested-createmany).
- When relations are included via `include`, a separate query is generated per relation.
- `relationLoadStrategy: join` is not supported.
@@ -1567,7 +1567,7 @@ const c = await prisma.user.count({
### `aggregate()`
-See also: [Aggregation, grouping, and summarizing](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#aggregate)
+See also: [Aggregation, grouping, and summarizing](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#aggregate)
#### Options
@@ -1630,7 +1630,7 @@ const setValue = await prisma.user.aggregate({
### `groupBy()`
-See also: [Aggregation, grouping, and summarizing](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#group-by)
+See also: [Aggregation, grouping, and summarizing](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#group-by)
#### Options
@@ -1702,17 +1702,17 @@ const groupUsers = await prisma.user.groupBy({
### `findRaw()`
-See: [Using Raw SQL (`findRaw()`)](/v6/orm/prisma-client/using-raw-sql/raw-queries#findraw).
+See: [Using Raw SQL (`findRaw()`)](/orm/v6/prisma-client/using-raw-sql/raw-queries#findraw).
### `aggregateRaw()`
-See: [Using Raw SQL (`aggregateRaw()`)](/v6/orm/prisma-client/using-raw-sql/raw-queries#aggregateraw).
+See: [Using Raw SQL (`aggregateRaw()`)](/orm/v6/prisma-client/using-raw-sql/raw-queries#aggregateraw).
## Model query options
### `select`
-`select` defines which fields are included in the object that Prisma Client returns. See: [Select fields and include relations](/v6/orm/prisma-client/queries/select-fields) .
+`select` defines which fields are included in the object that Prisma Client returns. See: [Select fields and include relations](/orm/v6/prisma-client/queries/select-fields) .
#### Remarks
@@ -1874,7 +1874,7 @@ const result = await prisma.user.findMany({
#### Generated types for `select`
-The following example demonstrates how to use the [`validator`](/v6/orm/prisma-client/type-safety/prisma-validator) with `select`:
+The following example demonstrates how to use the [`validator`](/orm/v6/prisma-client/type-safety/prisma-validator) with `select`:
```ts
const selectNameEmailNotPosts = Prisma.validator()({
@@ -1886,7 +1886,7 @@ const selectNameEmailNotPosts = Prisma.validator()({
### `include`
-`include` defines which relations are included in the result that Prisma Client returns. See: [Select fields and include relations](/v6/orm/prisma-client/queries/select-fields) .
+`include` defines which relations are included in the result that Prisma Client returns. See: [Select fields and include relations](/orm/v6/prisma-client/queries/select-fields) .
#### Remarks
@@ -1921,7 +1921,7 @@ const user = await prisma.user.create({
#### Generated types for `include`
-The following example demonstrates how to use the [`validator`](/v6/orm/prisma-client/type-safety/prisma-validator) with `include`:
+The following example demonstrates how to use the [`validator`](/orm/v6/prisma-client/type-safety/prisma-validator) with `include`:
```ts
const includePosts = Prisma.validator()({
@@ -1953,7 +1953,7 @@ const usersWithCount = await prisma.user.findMany({
#### Remarks
- You cannot combine `omit` and `select` since they serve opposite purposes
-- `omit` was released into General Availability with Prisma ORM 6.2.0. It was available via the `omitApi` [Preview feature](/v6/orm/reference/preview-features/client-preview-features) in Prisma ORM versions `5.13.0` through `6.1.0`.
+- `omit` was released into General Availability with Prisma ORM 6.2.0. It was available via the `omitApi` [Preview feature](/orm/v6/reference/preview-features/client-preview-features) in Prisma ORM versions `5.13.0` through `6.1.0`.
#### Examples
@@ -2038,7 +2038,7 @@ const results = await prisma.user.findMany({
#### Generated types for `omit`
-The following example demonstrates how to use the [`validator`](/v6/orm/prisma-client/type-safety/prisma-validator) with `omit`:
+The following example demonstrates how to use the [`validator`](/orm/v6/prisma-client/type-safety/prisma-validator) with `omit`:
```ts
const omitPassword = Prisma.validator()({
@@ -2053,9 +2053,9 @@ const omitPassword = Prisma.validator()({
- `join` (default): Uses a database-level `LATERAL JOIN` (PostgreSQL) or correlated subqueries (MySQL) and fetches all data with a single query to the database.
- `query`: Sends multiple queries to the database (one per table) and joins them on the application level.
-> **Note**: Once `relationLoadStrategy` moves from [Preview](/v6/orm/more/releases#preview) into [General Availability](/v6/orm/more/releases#generally-available-ga), `join` will universally become the default for all relation queries.
+> **Note**: Once `relationLoadStrategy` moves from [Preview](/orm/v6/more/releases#preview) into [General Availability](/orm/v6/more/releases#generally-available-ga), `join` will universally become the default for all relation queries.
-You can learn more about join strategies [here](/v6/orm/prisma-client/queries/relation-queries#relation-load-strategies-preview).
+You can learn more about join strategies [here](/orm/v6/prisma-client/queries/relation-queries#relation-load-strategies-preview).
Because the `relationLoadStrategy` option is currently in Preview, you need to enable it via the `relationJoins` preview feature flag in your Prisma schema file:
@@ -2116,7 +2116,7 @@ const results = await prisma.user.findMany({
#### Generated types for `where`
-The following examples demonstrate how to use the [`validator`](/v6/orm/prisma-client/type-safety/prisma-validator) with `where`:
+The following examples demonstrate how to use the [`validator`](/orm/v6/prisma-client/type-safety/prisma-validator) with `where`:
- `UserWhereInput`
@@ -2211,15 +2211,15 @@ The following examples demonstrate how to use the [`validator`](/v6/orm/prisma-c
### `orderBy`
-Sorts a list of records. See also: [Sorting](/v6/orm/prisma-client/queries/filtering-and-sorting)
+Sorts a list of records. See also: [Sorting](/orm/v6/prisma-client/queries/filtering-and-sorting)
#### Remarks
- In [2.16.0](https://github.com/prisma/prisma/releases/2.16.0) and later, you can [order by relation fields](#sort-post-by-the-related-user-records-name) - for example, order posts by the author's name.
-- In [3.5.0](https://github.com/prisma/prisma/releases/3.5.0) and later, in PostgreSQL you can [order by relevance](#sort-post-by-relevance-of-the-title). For details, see [Sort by relevance](/v6/orm/prisma-client/queries/filtering-and-sorting#sort-by-relevance-postgresql-and-mysql).
+- In [3.5.0](https://github.com/prisma/prisma/releases/3.5.0) and later, in PostgreSQL you can [order by relevance](#sort-post-by-relevance-of-the-title). For details, see [Sort by relevance](/orm/v6/prisma-client/queries/filtering-and-sorting#sort-by-relevance-postgresql-and-mysql).
-- In [4.1.0](https://github.com/prisma/prisma/releases/4.1.0) and later, you can [sort `null` records first or last](#sort-post-by-the-related-user-records-name-with-null-records-first). For details, see [Sort with nulls first or last](/v6/orm/prisma-client/queries/filtering-and-sorting#sort-with-null-records-first-or-last).
+- In [4.1.0](https://github.com/prisma/prisma/releases/4.1.0) and later, you can [sort `null` records first or last](#sort-post-by-the-related-user-records-name-with-null-records-first). For details, see [Sort with nulls first or last](/orm/v6/prisma-client/queries/filtering-and-sorting#sort-with-null-records-first-or-last).
#### Inputs for `sort` argument
@@ -2233,8 +2233,8 @@ Sorts a list of records. See also: [Sorting](/v6/orm/prisma-client/queries/filte
Note:
- This argument is optional.
-- It is for use on optional [scalar](/v6/orm/prisma-schema/data-model/models#scalar-fields) fields only. If you try to sort by nulls on a required or [relation](/v6/orm/prisma-schema/data-model/models#relation-fields) field, Prisma Client throws a [P2009 error](/v6/orm/reference/error-reference#p2009).
-- It is available in version 4.1.0 and later, as a preview feature. See [sort with nulls first or last](/v6/orm/prisma-client/queries/filtering-and-sorting#sort-with-null-records-first-or-last) for details of how to enable the feature.
+- It is for use on optional [scalar](/orm/v6/prisma-schema/data-model/models#scalar-fields) fields only. If you try to sort by nulls on a required or [relation](/orm/v6/prisma-schema/data-model/models#relation-fields) field, Prisma Client throws a [P2009 error](/orm/v6/reference/error-reference#p2009).
+- It is available in version 4.1.0 and later, as a preview feature. See [sort with nulls first or last](/orm/v6/prisma-client/queries/filtering-and-sorting#sort-with-null-records-first-or-last) for details of how to enable the feature.
| Name | Description |
| ------- | ------------------------------ |
@@ -2297,7 +2297,7 @@ const posts = await prisma.post.findMany({
:::info
-For PostgreSQL, this feature is still in Preview. [Enable the `fullTextSearchPostgres` feature flag](/v6/orm/prisma-client/queries/full-text-search#enabling-full-text-search-for-postgresql) in order to use it.
+For PostgreSQL, this feature is still in Preview. [Enable the `fullTextSearchPostgres` feature flag](/orm/v6/prisma-client/queries/full-text-search#enabling-full-text-search-for-postgresql) in order to use it.
:::
@@ -2628,7 +2628,7 @@ const sort = await prisma.user.findMany({
#### Generated types for `orderBy`
-The following examples demonstrate how to use the [`validator`](/v6/orm/prisma-client/type-safety/prisma-validator) with `orderBy`:
+The following examples demonstrate how to use the [`validator`](/orm/v6/prisma-client/type-safety/prisma-validator) with `orderBy`:
- `UserOrderByInput`
```ts
@@ -2639,7 +2639,7 @@ The following examples demonstrate how to use the [`validator`](/v6/orm/prisma-c
### `distinct`
-Deduplicate a list of records from [`findMany`](#findmany) or [`findFirst`](#findfirst). See also: [Aggregation, grouping, and summarizing](/v6/orm/prisma-client/queries/aggregation-grouping-summarizing#select-distinct)
+Deduplicate a list of records from [`findMany`](#findmany) or [`findFirst`](#findfirst). See also: [Aggregation, grouping, and summarizing](/orm/v6/prisma-client/queries/aggregation-grouping-summarizing#select-distinct)
#### Examples
@@ -2734,13 +2734,13 @@ generator client {
````
-See [Preview Features](/v6/orm/reference/preview-features/client-preview-features#preview-features-promoted-to-general-availability) for more details.
+See [Preview Features](/orm/v6/reference/preview-features/client-preview-features#preview-features-promoted-to-general-availability) for more details.
## Nested queries
### `create`
-A nested `create` query adds a new related record or set of records to a parent record. See: [Working with relations](/v6/orm/prisma-client/queries/relation-queries)
+A nested `create` query adds a new related record or set of records to a parent record. See: [Working with relations](/orm/v6/prisma-client/queries/relation-queries)
#### Remarks
@@ -2840,7 +2840,7 @@ const user = await prisma.user.update({
### `createMany`
-A nested `createMany` query adds a new set of records to a parent record. See: [Working with relations](/v6/orm/prisma-client/queries/relation-queries)
+A nested `createMany` query adds a new set of records to a parent record. See: [Working with relations](/orm/v6/prisma-client/queries/relation-queries)
#### Remarks
@@ -2850,7 +2850,7 @@ A nested `createMany` query adds a new set of records to a parent record. See: [
- You cannot nest an additional `create` or `createMany`.
- Allows setting foreign keys directly — for example, setting the `categoryId` on a post.
- As of Prisma ORM version 5.12.0, nested `createMany` is supported by SQLite.
-- You can use a nested `create` _or_ a nested `createMany` to create multiple related records - [if you do not need the `skipDuplicates` query option, you should probably use `create`](/v6/orm/prisma-client/queries/relation-queries#create-a-single-record-and-multiple-related-records).
+- You can use a nested `create` _or_ a nested `createMany` to create multiple related records - [if you do not need the `skipDuplicates` query option, you should probably use `create`](/orm/v6/prisma-client/queries/relation-queries#create-a-single-record-and-multiple-related-records).
#### Options [#nested-createmany-options]
@@ -2881,7 +2881,7 @@ const user = await prisma.user.update({
### `set`
-`set` overwrites the value of a relation - for example, replacing a list of `Post` records with a different list. See: [Working with relations](/v6/orm/prisma-client/queries/relation-queries)
+`set` overwrites the value of a relation - for example, replacing a list of `Post` records with a different list. See: [Working with relations](/orm/v6/prisma-client/queries/relation-queries)
#### Examples
@@ -2900,7 +2900,7 @@ const user = await prisma.user.update({
### `connect`
-A nested `connect` query connects a record to an existing related record by specifying an ID or unique identifier. See: [Working with relations](/v6/orm/prisma-client/queries/relation-queries)
+A nested `connect` query connects a record to an existing related record by specifying an ID or unique identifier. See: [Working with relations](/orm/v6/prisma-client/queries/relation-queries)
#### Remarks
@@ -2995,7 +2995,7 @@ const user = await prisma.user.update({
### `connectOrCreate`
-`connectOrCreate` _either_ connects a record to an existing related record by ID or unique identifier _or_ creates a new related record if the record does not exist. See: [Working with relations](/v6/orm/prisma-client/queries/relation-queries)
+`connectOrCreate` _either_ connects a record to an existing related record by ID or unique identifier _or_ creates a new related record if the record does not exist. See: [Working with relations](/orm/v6/prisma-client/queries/relation-queries)
#### Remarks
@@ -3148,7 +3148,7 @@ const user = await prisma.user.update({
### `disconnect`
-A nested `disconnect` query breaks the connection between a parent record and a related record, but does not delete either record. See: [Working with relations](/v6/orm/prisma-client/queries/relation-queries)
+A nested `disconnect` query breaks the connection between a parent record and a related record, but does not delete either record. See: [Working with relations](/orm/v6/prisma-client/queries/relation-queries)
#### Remarks
@@ -3191,7 +3191,7 @@ const user = await prisma.user.update({
### `update`
-A nested `update` query updates one or more related records where the parent record's ID is `n`. See: [Working with relations](/v6/orm/prisma-client/queries/relation-queries#update-a-specific-related-record)
+A nested `update` query updates one or more related records where the parent record's ID is `n`. See: [Working with relations](/orm/v6/prisma-client/queries/relation-queries#update-a-specific-related-record)
#### Remarks
@@ -3686,11 +3686,11 @@ const result = await prisma.post.count({
### `search`
-Use [Full-Text Search](/v6/orm/prisma-client/queries/full-text-search) to search within a `String` field.
+Use [Full-Text Search](/orm/v6/prisma-client/queries/full-text-search) to search within a `String` field.
:::info
-For PostgreSQL, this feature is still in Preview. [Enable the `fullTextSearchPostgres` feature flag](/v6/orm/prisma-client/queries/full-text-search#enabling-full-text-search-for-postgresql) in order to use it.
+For PostgreSQL, this feature is still in Preview. [Enable the `fullTextSearchPostgres` feature flag](/orm/v6/prisma-client/queries/full-text-search#enabling-full-text-search-for-postgresql) in order to use it.
:::
@@ -4256,7 +4256,7 @@ Available for:
### Remarks
-- Scalar list / array filters [ignore `NULL` values](/v6/orm/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays#null-values-in-arrays) . Using `isEmpty` or `NOT` does not return records with `NULL` value lists / arrays, and `{ equals: null }` results in an error.
+- Scalar list / array filters [ignore `NULL` values](/orm/v6/prisma-client/special-fields-and-types/working-with-scalar-lists-arrays#null-values-in-arrays) . Using `isEmpty` or `NOT` does not return records with `NULL` value lists / arrays, and `{ equals: null }` results in an error.
### `has`
@@ -4395,7 +4395,7 @@ Available for MongoDB only in Prisma `3.10.0` and later.
:::
-Composite type methods allow you to create, update and delete [composite types](/v6/orm/prisma-client/special-fields-and-types/composite-types).
+Composite type methods allow you to create, update and delete [composite types](/orm/v6/prisma-client/special-fields-and-types/composite-types).
### `set`
@@ -4564,7 +4564,7 @@ Available for MongoDB only in Prisma `3.11.0` and later.
:::
-Composite type filters allow you to filter the contents of [composite types](/v6/orm/prisma-client/special-fields-and-types/composite-types).
+Composite type filters allow you to filter the contents of [composite types](/orm/v6/prisma-client/special-fields-and-types/composite-types).
### `equals`
@@ -4812,11 +4812,11 @@ const updatePosts = await prisma.post.updateMany({
## `Json` filters
-For use cases and advanced examples, see: [Working with `Json` fields](/v6/orm/prisma-client/special-fields-and-types/working-with-json-fields).
+For use cases and advanced examples, see: [Working with `Json` fields](/orm/v6/prisma-client/special-fields-and-types/working-with-json-fields).
:::warning
-Supported by [PostgreSQL](/v6/orm/overview/databases/postgresql) and [MySQL](/v6/orm/overview/databases/mysql) with different syntaxes for the `path` option. PostgreSQL does not support filtering on object key values in arrays.
+Supported by [PostgreSQL](/orm/v6/overview/databases/postgresql) and [MySQL](/orm/v6/overview/databases/mysql) with different syntaxes for the `path` option. PostgreSQL does not support filtering on object key values in arrays.
:::
@@ -4844,7 +4844,7 @@ The examples in this section assumes that the value of the `pet` field is:
### Remarks
-- The implementation of `Json` filtering [differs between database connectors](/v6/orm/prisma-client/special-fields-and-types/working-with-json-fields)
+- The implementation of `Json` filtering [differs between database connectors](/orm/v6/prisma-client/special-fields-and-types/working-with-json-fields)
- Filtering is case sensitive in PostgreSQL and does not yet support `mode`
### `path`
@@ -5142,15 +5142,15 @@ const getUsers = await prisma.user.findMany({
:::warning
-In [extended clients](/v6/orm/prisma-client/client-extensions), Client methods do not necessarily exist. If you are extending your client, make sure to check for existence before using Client methods like `$transaction` or `$connect`.
+In [extended clients](/orm/v6/prisma-client/client-extensions), Client methods do not necessarily exist. If you are extending your client, make sure to check for existence before using Client methods like `$transaction` or `$connect`.
-In addition, if you are using `$on` or `$use`, you will need to use these client methods before extending your client as these methods do not exist on extended clients. For `$use` specifically we recommend transitioning [to use query extensions](/v6/orm/prisma-client/client-extensions/query).
+In addition, if you are using `$on` or `$use`, you will need to use these client methods before extending your client as these methods do not exist on extended clients. For `$use` specifically we recommend transitioning [to use query extensions](/orm/v6/prisma-client/client-extensions/query).
:::
### `$disconnect()`
-The `$disconnect()` method closes the database connections that were established when `$connect` was called and stops the process that was running Prisma ORM's query engine. See [Connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management) for an overview of `$connect()` and `$disconnect()`.
+The `$disconnect()` method closes the database connections that were established when `$connect` was called and stops the process that was running Prisma ORM's query engine. See [Connection management](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management) for an overview of `$connect()` and `$disconnect()`.
#### Remarks
@@ -5158,7 +5158,7 @@ The `$disconnect()` method closes the database connections that were established
### `$connect()`
-The `$connect()` method establishes a physical connection to the database via Prisma ORM's query engine. See [Connection management](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management) for an overview of `$connect()` and `$disconnect()`.
+The `$connect()` method establishes a physical connection to the database via Prisma ORM's query engine. See [Connection management](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management) for an overview of `$connect()` and `$disconnect()`.
#### Remarks
@@ -5168,39 +5168,39 @@ The `$connect()` method establishes a physical connection to the database via Pr
:::warning
-`$on` is not available in [extended clients](/v6/orm/prisma-client/client-extensions). Please either migrate to client extensions or use the `$on` method prior to extending your client.
+`$on` is not available in [extended clients](/orm/v6/prisma-client/client-extensions). Please either migrate to client extensions or use the `$on` method prior to extending your client.
:::
-The `$on()` method allows you to subscribe to [logging events](#log) or the [exit hook](/v6/orm/prisma-client/setup-and-configuration/databases-connections/connection-management#exit-hooks).
+The `$on()` method allows you to subscribe to [logging events](#log) or the [exit hook](/orm/v6/prisma-client/setup-and-configuration/databases-connections/connection-management#exit-hooks).
### `$queryRawTyped`
-See: [Using Raw SQL (`$queryRawTyped`)](/v6/orm/prisma-client/using-raw-sql/typedsql).
+See: [Using Raw SQL (`$queryRawTyped`)](/orm/v6/prisma-client/using-raw-sql/typedsql).
### `$queryRaw`
-See: [Using Raw SQL (`$queryRaw`)](/v6/orm/prisma-client/using-raw-sql/raw-queries#queryraw).
+See: [Using Raw SQL (`$queryRaw`)](/orm/v6/prisma-client/using-raw-sql/raw-queries#queryraw).
### `$queryRawUnsafe()`
-See: [Using Raw SQL (`$queryRawUnsafe()`)](/v6/orm/prisma-client/using-raw-sql/raw-queries#queryrawunsafe).
+See: [Using Raw SQL (`$queryRawUnsafe()`)](/orm/v6/prisma-client/using-raw-sql/raw-queries#queryrawunsafe).
### `$executeRaw`
-See: [Using Raw SQL (`$executeRaw`)](/v6/orm/prisma-client/using-raw-sql/raw-queries#executeraw).
+See: [Using Raw SQL (`$executeRaw`)](/orm/v6/prisma-client/using-raw-sql/raw-queries#executeraw).
### `$executeRawUnsafe()`
-See: [Using Raw SQL (`$executeRawUnsafe()`)](/v6/orm/prisma-client/using-raw-sql/raw-queries#executerawunsafe).
+See: [Using Raw SQL (`$executeRawUnsafe()`)](/orm/v6/prisma-client/using-raw-sql/raw-queries#executerawunsafe).
### `$runCommandRaw()`
-See: [Using Raw SQL (`$runCommandRaw()`)](/v6/orm/prisma-client/using-raw-sql/raw-queries#runcommandraw).
+See: [Using Raw SQL (`$runCommandRaw()`)](/orm/v6/prisma-client/using-raw-sql/raw-queries#runcommandraw).
### `$transaction()`
-See: [Transactions](/v6/orm/prisma-client/queries/transactions).
+See: [Transactions](/orm/v6/prisma-client/queries/transactions).
### `$extends`
@@ -5211,7 +5211,7 @@ With `$extends`, you can create and use Prisma Client extensions to add function
- `query`: create custom Prisma Client queries
- `result`: add custom fields to your query results
-Learn more: [Prisma Client extensions](/v6/orm/prisma-client/client-extensions).
+Learn more: [Prisma Client extensions](/orm/v6/prisma-client/client-extensions).
## Utility types
@@ -5219,7 +5219,7 @@ Utility types are helper functions and types that live on the `Prisma` namespace
### `Prisma.validator`
-The `validator` helps you create re-usable query parameters based on your schema models while making sure that the objects you create are valid. See also: [Using `Prisma.validator`](/v6/orm/prisma-client/type-safety/prisma-validator)
+The `validator` helps you create re-usable query parameters based on your schema models while making sure that the objects you create are valid. See also: [Using `Prisma.validator`](/orm/v6/prisma-client/type-safety/prisma-validator)
There are two ways you can use the `validator`:
@@ -5235,7 +5235,7 @@ Prisma.validator({ args });
When using the selector pattern, you use an existing Prisma Client instance to create a validator. This pattern allows you to select the model, operation, and query option to validate against.
-You can also use an instance of Prisma Client that has been extended using a [Prisma Client extension](/v6/orm/prisma-client/client-extensions).
+You can also use an instance of Prisma Client that has been extended using a [Prisma Client extension](/orm/v6/prisma-client/client-extensions).
```ts
Prisma.validator(PrismaClientInstance, "", "", "")({ args });
@@ -5293,12 +5293,12 @@ This feature was moved to general availability in version 5.0.0 and was availabl
:::info
-In the following situations, you must [use raw queries to compare columns in the same table](/v6/orm/more/troubleshooting/raw-sql-comparisons):
+In the following situations, you must [use raw queries to compare columns in the same table](/orm/v6/more/troubleshooting/raw-sql-comparisons):
- If you use a version earlier than 4.3.0
- If you want to use a unique filter, such as [`findUnique`](#findunique) or [`findUniqueOrThrow`](#finduniqueorthrow)
-- If you want to compare a field with a [unique constraint](/v6/orm/prisma-schema/data-model/models#defining-a-unique-field)
-- If you want to use one of the following operators to compare a [JSON field](/v6/orm/prisma-client/special-fields-and-types/working-with-json-fields) in MySQL or MariaDB with another field: [`gt`](#gt), [`gte`](#gte), [`lt`](#lt), or [`lte`](#lte). Note that you can use these operators to compare the JSON field with a scalar value. This limitation applies only if you try to compare a JSON field with another field.
+- If you want to compare a field with a [unique constraint](/orm/v6/prisma-schema/data-model/models#defining-a-unique-field)
+- If you want to use one of the following operators to compare a [JSON field](/orm/v6/prisma-client/special-fields-and-types/working-with-json-fields) in MySQL or MariaDB with another field: [`gt`](#gt), [`gte`](#gte), [`lt`](#lt), or [`lte`](#lte). Note that you can use these operators to compare the JSON field with a scalar value. This limitation applies only if you try to compare a JSON field with another field.
:::
@@ -5388,7 +5388,7 @@ await prisma.user.findMany({
## Filter on non-unique fields with `UserWhereUniqueInput`
From version 5.0.0, the generated type `UserWhereUniqueInput` on [`where`](#where) exposes all fields on the model, not just unique fields.
-This was available under the [`extendedWhereUnique` Preview flag](/v6/orm/reference/preview-features/client-preview-features#preview-features-promoted-to-general-availability) between versions 4.5.0 to 4.16.2
+This was available under the [`extendedWhereUnique` Preview flag](/orm/v6/reference/preview-features/client-preview-features#preview-features-promoted-to-general-availability) between versions 4.5.0 to 4.16.2
You must specify at least one unique field in your `where` statement [outside of boolean operators](#boolean-operators-with-userwhereuniqueinput), and you can specify any number of additional unique and non-unique fields. You can use this to add filters to any operation that returns a single record. For example, you can use this feature for the following:
@@ -5396,11 +5396,11 @@ You must specify at least one unique field in your `where` statement [outside of
- [Permission checks](#permission-checks)
- [Soft deletes](#soft-deletes)
-From version 4.6.0, you can use this feature to filter on optional [one-to-one nested reads](/v6/orm/prisma-client/queries/relation-queries#nested-reads).
+From version 4.6.0, you can use this feature to filter on optional [one-to-one nested reads](/orm/v6/prisma-client/queries/relation-queries#nested-reads).
### Optimistic concurrency control on updates
-You can filter on non-unique fields to perform [optimistic concurrency control](/v6/orm/prisma-client/queries/transactions#optimistic-concurrency-control) on `update` operations.
+You can filter on non-unique fields to perform [optimistic concurrency control](/orm/v6/prisma-client/queries/transactions#optimistic-concurrency-control) on `update` operations.
To perform optimistic concurrency control, we recommend that you use a `version` field to check whether the data in a record or related record has changed while your code executes. Before version 4.5.0, you could not evaluate the `version` field in an `update` operation, because the field is non-unique. From version 4.5.0, you can evaluate the `version` field.
@@ -5493,7 +5493,7 @@ await prisma.user.update({
#### One-to-one relations
-From version 4.5.0, you can filter on non-unique fields in the following operations on [one-to-one relations](/v6/orm/prisma-schema/data-model/relations/one-to-one-relations):
+From version 4.5.0, you can filter on non-unique fields in the following operations on [one-to-one relations](/orm/v6/prisma-schema/data-model/relations/one-to-one-relations):
- Nested update
- Nested upsert
@@ -5581,4 +5581,4 @@ findPostOperation.then(); // Prisma Client now executes the query
await findPostOperation; // Prisma Client now executes the query
```
-When using the [`$transaction` API](/v6/orm/prisma-client/queries/transactions#the-transaction-api), this behavior makes it possible for Prisma Client to pass all the queries on to the query engine as a single transaction.
+When using the [`$transaction` API](/orm/v6/prisma-client/queries/transactions#the-transaction-api), this behavior makes it possible for Prisma Client to pass all the queries on to the query engine as a single transaction.
diff --git a/apps/docs/content/docs.v6/orm/reference/prisma-config-reference.mdx b/apps/docs/content/docs/orm/v6/reference/prisma-config-reference.mdx
similarity index 97%
rename from apps/docs/content/docs.v6/orm/reference/prisma-config-reference.mdx
rename to apps/docs/content/docs/orm/v6/reference/prisma-config-reference.mdx
index cc9c2d7290..8ca9cbb4a9 100644
--- a/apps/docs/content/docs.v6/orm/reference/prisma-config-reference.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/prisma-config-reference.mdx
@@ -1,7 +1,7 @@
---
title: Prisma Config reference
description: This page gives an overview of all Prisma config options available for use.
-url: /v6/orm/reference/prisma-config-reference
+url: /orm/v6/reference/prisma-config-reference
metaTitle: Reference documentation for the prisma config file
metaDescription: This page gives an overview of all Prisma config options available for use.
---
@@ -123,7 +123,7 @@ Prisma Config files can be named as `prisma.config.*` or `.config/prisma.*` with
### `schema`
-Configures how Prisma ORM locates and loads your schema file(s). Can be a file or folder path. Relative paths are resolved relative to the `prisma.config.ts` file location. See [here](/v6/orm/prisma-schema/overview/location#multi-file-prisma-schema) for more info about schema location options.
+Configures how Prisma ORM locates and loads your schema file(s). Can be a file or folder path. Relative paths are resolved relative to the `prisma.config.ts` file location. See [here](/orm/v6/prisma-schema/overview/location#multi-file-prisma-schema) for more info about schema location options.
| Property | Type | Required | Default |
| -------- | -------- | -------- | ---------------------------------------------- |
@@ -164,7 +164,7 @@ export default defineConfig({
});
```
-Learn more about the [`externalTables` feature here](/v6/orm/prisma-schema/data-model/externally-managed-tables).
+Learn more about the [`externalTables` feature here](/orm/v6/prisma-schema/data-model/externally-managed-tables).
### `migrations.path`
@@ -208,7 +208,7 @@ export default defineConfig({
### `migrations.initShadowDb`
-This option allows you to define SQL statements that Prisma runs on the **shadow database** before creating migrations. It is useful when working with [external managed tables](/v6/orm/prisma-schema/data-model/externally-managed-tables), as Prisma needs to know about the structure of these tables to correctly generate migrations.
+This option allows you to define SQL statements that Prisma runs on the **shadow database** before creating migrations. It is useful when working with [external managed tables](/orm/v6/prisma-schema/data-model/externally-managed-tables), as Prisma needs to know about the structure of these tables to correctly generate migrations.
| Property | Type | Required | Default |
| ------------------------- | -------- | -------- | ------- |
@@ -240,7 +240,7 @@ export default defineConfig({
});
```
-Learn more about the [`externalTables` feature here](/v6/orm/prisma-schema/data-model/externally-managed-tables).
+Learn more about the [`externalTables` feature here](/orm/v6/prisma-schema/data-model/externally-managed-tables).
### `views.path`
@@ -252,7 +252,7 @@ The path to the directory where Prisma should look for the SQL view definitions.
### `typedSql.path`
-The path to the directory where Prisma should look for the SQL files used for generating typings via [`typedSql`](/v6/orm/prisma-client/using-raw-sql/typedsql).
+The path to the directory where Prisma should look for the SQL files used for generating typings via [`typedSql`](/orm/v6/prisma-client/using-raw-sql/typedsql).
| Property | Type | Required | Default |
| --------------- | -------- | -------- | ------- |
@@ -304,11 +304,11 @@ In Prisma ORM v6.19 and earlier, the `experimental` object also included `adapte
### `datasource.url`
-Connection URL including authentication info. Most connectors use [the syntax provided by the database](/v6/orm/reference/connection-urls#format).
+Connection URL including authentication info. Most connectors use [the syntax provided by the database](/orm/v6/reference/connection-urls#format).
:::info[Prisma ORM v7 changes]
-In Prisma ORM v7, the `url` field is configured in `prisma.config.ts` instead of in [the `datasource` block of your `schema.prisma`](/v6/orm/prisma-schema/overview/data-sources) file. When you run `prisma init`, the generated `schema.prisma` file will not include a `url` property in the `datasource` block.
+In Prisma ORM v7, the `url` field is configured in `prisma.config.ts` instead of in [the `datasource` block of your `schema.prisma`](/orm/v6/prisma-schema/overview/data-sources) file. When you run `prisma init`, the generated `schema.prisma` file will not include a `url` property in the `datasource` block.
For Prisma ORM v6.19 and earlier, the `url` field remains in the `schema.prisma` file's `datasource` block.
@@ -366,7 +366,7 @@ Connection URL for direct connection to the database.
If you use a connection pooler URL in the `url` argument (for example, pgBouncer), Prisma CLI commands that require a direct connection to the database use the URL in the `directUrl` argument.
-The `directUrl` property is supported by Prisma Studio from version 5.1.0 upwards. The `directUrl` property is not needed when using [Prisma Postgres](/v6/postgres) database.
+The `directUrl` property is supported by Prisma Studio from version 5.1.0 upwards. The `directUrl` property is not needed when using [Prisma Postgres](/postgres) database.
| Property | Type | Required | Default |
| ---------------------- | -------- | -------- | ------- |
@@ -466,7 +466,7 @@ The `studio` property has been removed in Prisma ORM v7. To run Prisma Studio, u
npx prisma studio --config ./prisma.config.ts
```
-Prisma Studio now uses the connection configuration from the `datasource` property automatically. See the [Prisma Studio documentation](/v6/orm/reference/prisma-cli-reference#studio) for more details.
+Prisma Studio now uses the connection configuration from the `datasource` property automatically. See the [Prisma Studio documentation](/orm/v6/reference/prisma-cli-reference#studio) for more details.
:::
diff --git a/apps/docs/content/docs.v6/orm/reference/prisma-schema-reference.mdx b/apps/docs/content/docs/orm/v6/reference/prisma-schema-reference.mdx
similarity index 95%
rename from apps/docs/content/docs.v6/orm/reference/prisma-schema-reference.mdx
rename to apps/docs/content/docs/orm/v6/reference/prisma-schema-reference.mdx
index 36fa2582ac..05d1f86149 100644
--- a/apps/docs/content/docs.v6/orm/reference/prisma-schema-reference.mdx
+++ b/apps/docs/content/docs/orm/v6/reference/prisma-schema-reference.mdx
@@ -1,14 +1,14 @@
---
title: Prisma schema reference
description: API reference documentation for the Prisma Schema Language (PSL).
-url: /v6/orm/reference/prisma-schema-reference
+url: /orm/v6/reference/prisma-schema-reference
metaTitle: Prisma Schema API
metaDescription: API reference documentation for the Prisma Schema Language (PSL).
---
## `datasource`
-Defines a [data source](/v6/orm/prisma-schema/overview/data-sources) in the Prisma schema.
+Defines a [data source](/orm/v6/prisma-schema/overview/data-sources) in the Prisma schema.
### Fields
@@ -17,24 +17,24 @@ A `datasource` block accepts the following fields:
| Name | Required | Type | Description |
| ------------------- | -------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `provider` | **Yes** | String (`postgresql`, `mysql`, `sqlite`, `sqlserver`, `mongodb`, `cockroachdb`) | Describes which data source connectors to use. |
-| `url` | **Yes** | String (URL) | **Deprecated in Prisma ORM v7.** Configure the connection URL in Prisma Config instead: see [`datasource.url`](/v6/orm/reference/prisma-config-reference#datasourceurl). Existing schemas continue to work, but you should migrate to Prisma Config. |
-| `shadowDatabaseUrl` | No | String (URL) | **Deprecated in Prisma ORM v7.** Configure the shadow database URL in Prisma Config instead: see [`datasource.shadowDatabaseUrl`](/v6/orm/reference/prisma-config-reference#datasourceshadowdatabaseurl). |
-| `directUrl` | No | String (URL) | **Deprecated in Prisma ORM v7.** Configure the direct connection URL in Prisma Config instead: see [`datasource.directUrl`](/v6/orm/reference/prisma-config-reference#datasourcedirecturl-removed). |
-| `relationMode` | No | String (`foreignKeys`, `prisma`) | Sets whether [referential integrity](/v6/orm/prisma-schema/data-model/relations/relation-mode) is enforced by foreign keys in the database or emulated in the Prisma Client.