Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2de4da9
docs(docs): update the Prisma ORM 8 pages for 8.0.0-rc.25
wmadden-electric Nov 20, 2026
d26c82b
docs(docs): merge main and cover the changes merged into 8.0.0-rc.25 …
wmadden-electric Nov 23, 2026
d3d1008
docs(docs): db migrate advances the db ref by default since 8.0.0-rc.25
wmadden-electric Nov 23, 2026
c887e32
docs(docs): db migrate moves the db ref without --advance-ref db, acr…
wmadden-electric Nov 23, 2026
9035833
docs(docs): correct the db ref guidance after review
wmadden-electric Nov 23, 2026
37020cf
docs(docs): bring the Prisma ORM 8.0.0-rc.25 CLI pages in line with t…
wmadden-electric Nov 23, 2026
9bf0f63
docs(docs): bring the Prisma ORM 8.0.0-rc.25 ORM and guide pages in l…
wmadden-electric Nov 23, 2026
bcfbefa
docs(docs): correct nine statements in the Prisma ORM 8.0.0-rc.25 pag…
wmadden-electric Nov 23, 2026
8de731c
docs(docs): connect on many-to-many fails on MariaDB too, and fns.raw…
wmadden-electric Nov 23, 2026
d05018e
docs(cli): run the commands the error prints, now that 8.0.0-rc.25 pr…
wmadden-electric Nov 23, 2026
35d5114
docs(docs): answer the review of the Prisma ORM 8.0.0-rc.25 pages
wmadden-electric Nov 23, 2026
a1eae38
docs(docs): the printed apply command has no --db unless you passed i…
wmadden-electric Nov 23, 2026
96bf8bf
docs(cli): --backfill also takes a field inside a document on MongoDB
wmadden-electric Nov 23, 2026
5c08d01
docs(docs): printed commands carry --db only when you passed it, and …
wmadden-electric Nov 23, 2026
c81604d
docs(orm): the policies page names the commands that read the change …
wmadden-electric Nov 23, 2026
ceb5cdf
docs(docs): answer the second review of the Prisma ORM 8.0.0-rc.25 pages
wmadden-electric Nov 23, 2026
c5a77a8
docs(docs): name prisma 8.0.0-rc.35 and the engine version it installs
wmadden-electric Nov 23, 2026
5cf1b36
docs(docs): mark the orm init note about 8.0.0-rc.34 as history
wmadden-electric Nov 23, 2026
288bd8e
docs(docs): say which money rows are affected, and name MariaDB for n…
wmadden-electric Nov 23, 2026
09110e4
docs(docs): state the MySQL and MariaDB limits on nested connect, and…
wmadden-electric Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/docs/content/docs/(index)/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Check the Node.js version first: `node --version` must print 22.18 or newer on t
1. Scaffold the app: `npm create prisma@latest -- my-app --template [framework] --provider postgres --yes`.
2. Get a database connection string: use the one I give you, or create a Prisma Postgres database with `npx create-db@latest` and show me the claim URL it prints. Export it as `DATABASE_URL` in the shell: in a project created with `npm create prisma`, the Prisma CLI scripts in package.json read the environment variable, not `.env`.
3. From the project directory, apply the starter contract: `npm run db:init`. The app seeds sample users on its first query, from `src/prisma/seed.ts` (`packages/database/src/seed.ts` for turborepo); there is no seed command to run.
4. Edit the starter contract under `src/prisma/` (`packages/database/src/` for turborepo) into a small schema for my use case, then run `npm run contract:emit` and plan and apply the migration: `npx prisma migration plan --name <name>`, then `npx prisma db migrate --advance-ref db --yes`. Migration planning diffs the emitted contract, so the emit step is required. Pass `--advance-ref db` on every apply to this development database, so that the next `migration plan` starts from the state you applied; without it, the next plan repeats the last change and `db migrate` fails with `MIGRATION.PATH_UNREACHABLE`.
4. Edit the starter contract under `src/prisma/` (`packages/database/src/` for turborepo) into a small schema for my use case, then run `npm run contract:emit` and plan and apply the migration: `npx prisma migration plan --name <name>`, then `npx prisma db migrate --yes`. Migration planning diffs the emitted contract, so the emit step is required. `db migrate` also points the `db` ref at the state you applied, so that the next `migration plan` starts from there. If it prints `MIGRATION.REF_NOT_ADVANCED_IN_CI`, the CLI found a CI variable such as `CI` in your environment and left the ref unchanged: run the command that the notice prints for a development machine, which adds `--advance-ref db`, before you plan again.
5. Update `src/prisma/seed.ts` (`packages/database/src/seed.ts` for turborepo) and the app routes to query the new schema, start `npm run dev` in the background (with `DATABASE_URL` exported), and verify with a request against the running app. For the `nest` template, if routes return 500s with `reading 'findAll'` in the logs, add explicit `@Inject()` tokens as shown in https://www.prisma.io/docs/guides/frameworks/nestjs.md.

Use the installed Prisma ORM skills and the current Prisma docs: https://www.prisma.io/docs/llms.txt (append `.md` to any docs URL for a markdown version).
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/(index)/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Check the Node.js version first: `node --version` must print 22.18 or newer on t

1. Scaffold: `npm create prisma@latest -- my-app --template [framework] --provider postgres --yes`.
2. Export my connection string as `DATABASE_URL` in the shell; the generated scripts read the environment variable, not `.env`. From the project directory: `npm run db:init`, then start `npm run dev` in the background and verify the sample query returns data. The app seeds sample users on its first query, from `src/prisma/seed.ts` (`packages/database/src/seed.ts` for turborepo); there is no seed command to run.
3. Evolve the starter contract under `src/prisma/` (`packages/database/src/` for turborepo) into my schema, then run `npm run contract:emit`, `npx prisma migration plan --name <name>`, and `npx prisma db migrate --advance-ref db --yes`. Pass `--advance-ref db` on every apply to this development database, so that the next `migration plan` starts from the state you applied; without it, the next plan repeats the last change and `db migrate` fails with `MIGRATION.PATH_UNREACHABLE`.
3. Evolve the starter contract under `src/prisma/` (`packages/database/src/` for turborepo) into my schema, then run `npm run contract:emit`, `npx prisma migration plan --name <name>`, and `npx prisma db migrate --yes`. `db migrate` also points the `db` ref at the state you applied, so that the next `migration plan` starts from there.

Do not provision any hosted database. Use the installed Prisma ORM skills and https://www.prisma.io/docs/llms.txt for current docs.
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ Before it adds a validator, `db update` checks the documents already in the coll

When it succeeds, `db update` records which contract the database matches, in the database and in the file `migrations/app/refs/db.json`, called the `db` ref. `migration plan` starts from that record. Without it, `migration plan` plans every collection from an empty database, and `db migrate` then stops with `MIGRATION.PRECHECK_FAILED` because the collection already exists. If that happened to you, delete the directory that `migration plan` wrote under `migrations/app/`, run `npx prisma db update --advance-ref db`, and plan again. That plan writes only a baseline, because `db update` has already applied your change.

After that, every change follows four steps: edit `src/prisma/contract.prisma`, run `npx prisma contract emit`, run `npx prisma migration plan --name <name>`, and run `npx prisma db migrate --advance-ref db`. Commit the `migrations/` directory. Your first `migration plan` writes two directories under `migrations/app/`: a baseline, whose name ends in `_baseline` and which describes the collections as `db update` left them, and your change.
After that, every change follows four steps: edit `src/prisma/contract.prisma`, run `npx prisma contract emit`, run `npx prisma migration plan --name <name>`, and run `npx prisma db migrate`. Commit the `migrations/` directory. Your first `migration plan` writes two directories under `migrations/app/`: a baseline, whose name ends in `_baseline` and which describes the collections as `db update` left them, and your change.

### Production and other databases

Any other database whose collections already exist, such as production, needs the same first step before `db migrate` can run there. Leave out `--advance-ref` for those databases, because the `db` ref tracks your development database.
Any other database whose collections already exist, such as production, needs the same first step before `db migrate` can run there. Pass that database's connection string with `--db`: `db migrate` then leaves the `db` ref alone, because the ref tracks your development database.

If you have not planned a migration yet, run:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ You can ignore the word `space` in the output, because all your migrations are i
Apply the migration:

```npm
npx prisma db migrate --advance-ref db
npx prisma db migrate
```

```text no-copy
Expand All @@ -406,9 +406,9 @@ App space
✔ Advanced ref "db" → 7d5976dd0655cf4b1603d0126720d50248ab95881db001c8e924291efc61f336
```

`db migrate` runs only the migrations that the database does not have yet. Here it adds the `phone` column, and the rows in your tables stay as they are. `marker` in the output is the record from `db sign`, which now holds the new hash. Pass `--advance-ref db` every time you apply a migration to your development database, so that the next `migration plan` contains only your next change.
`db migrate` runs only the migrations that the database does not have yet. Here it adds the `phone` column, and the rows in your tables stay as they are. `marker` in the output is the record from `db sign`, which now holds the new hash. `db migrate` also points the `db` ref at the new hash, so that the next `migration plan` contains only your next change.

To apply the migration to another database with the same tables, such as production, pass its connection string. Leave out `--advance-ref` there, because the `db` ref tracks your development database:
To apply the migration to another database with the same tables, such as production, pass its connection string. With `--db`, `db migrate` leaves the `db` ref alone, because the ref tracks your development database:

```npm
npx prisma db migrate --db "$PRODUCTION_DATABASE_URL"
Expand All @@ -418,7 +418,7 @@ You do not need to run `db sign` on that database. `db migrate` finds that the t

## Next steps

Every later change follows the same four steps: edit `src/prisma/contract.prisma`, run `npx prisma contract emit`, run `npx prisma migration plan --name <name>`, and run `npx prisma db migrate --advance-ref db`.
Every later change follows the same four steps: edit `src/prisma/contract.prisma`, run `npx prisma contract emit`, run `npx prisma migration plan --name <name>`, and run `npx prisma db migrate`.

- [Generating a migration](/orm/migrations/generating-a-migration) for what a migration directory contains and how to edit it.
- [`db update`](/cli/db-update) to apply a contract change to a development database without writing migration files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ npm run db:init
npm run dev
```

Sample records are seeded on the app's first query. From there, change the contract under `src/prisma/` (`packages/database/src/` in the `turborepo` template), run `npm run contract:emit`, plan the migration with `npm run migration:plan -- --name <name>`, and apply it with `npm run migrate -- --advance-ref db`. Keep `--advance-ref db` on every apply in development: it points the `db` ref at the state you applied, and the next `migration plan` starts from there. Without it, the next plan starts from the state before your last migration and plans its changes again, and `npm run migrate` then fails with `MIGRATION.PATH_UNREACHABLE`. [Create a new app with PostgreSQL](/prisma-orm/quickstart/postgresql) covers that loop in detail, and [Create a new app with MongoDB](/prisma-orm/quickstart/mongodb) covers the MongoDB connection string.
Sample records are seeded on the app's first query. From there, change the contract under `src/prisma/` (`packages/database/src/` in the `turborepo` template), run `npm run contract:emit`, plan the migration with `npm run migration:plan -- --name <name>`, and apply it with `npm run migrate`. Each apply points the `db` ref at the state you applied, and the next `migration plan` starts from there. [Create a new app with PostgreSQL](/prisma-orm/quickstart/postgresql) covers that loop in detail, and [Create a new app with MongoDB](/prisma-orm/quickstart/mongodb) covers the MongoDB connection string.

### Generated scripts

Expand Down
14 changes: 7 additions & 7 deletions apps/docs/content/docs/(index)/prisma-orm/from-scratch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ npm pkg set type=module
Install the runtime library, the command-line tool, and the tooling to run a TypeScript file:

```npm
npm install @prisma/orm-postgres dotenv
npm install --save-dev prisma tsx typescript
npm install @prisma/orm-postgres pg dotenv
npm install --save-dev prisma tsx typescript @types/pg
```

`@prisma/orm-postgres` is the library your code imports, and `prisma` is the command-line tool. `dotenv` loads `.env`, `tsx` runs `index.ts` without a build step, and `typescript` 5.9 or newer is a peer dependency of `@prisma/orm-postgres`.
`@prisma/orm-postgres` is the library your code imports, and `prisma` is the command-line tool. `pg` is the PostgreSQL driver, a peer dependency of `@prisma/orm-postgres`, and `@types/pg` gives TypeScript its types. `dotenv` loads `.env`, `tsx` runs `index.ts` without a build step, and `typescript` 5.9 or newer is a peer dependency of `@prisma/orm-postgres`.

`temporal-polyfill` is a peer dependency of `@prisma/orm-postgres` too. It adds `Temporal`, the newer JavaScript date and time API, to runtimes such as Node.js 24 that do not have it built in. npm installs it for you, but with Yarn you add it yourself.

The two Prisma packages have different version numbers, for example `prisma` 8.0.0-rc.34 and `@prisma/orm-postgres` 8.0.0-rc.24. That is normal, and any two `latest` versions work together.
The two Prisma packages have different version numbers, for example `prisma` 8.0.0-rc.35 and `@prisma/orm-postgres` 8.0.0-rc.25. That is normal, and any two `latest` versions work together.

## 2. Create the config file and `.env`

Expand Down Expand Up @@ -253,10 +253,10 @@ ALTER TABLE "public"."User" ADD COLUMN "phone" text;

Two directories appear under `migrations/app/`: a baseline that records the table `db init` created, and your change. The baseline is never applied to this database, because the database is already signed at that state. Each migration directory holds a `migration.ts` you can read and edit; [Generating a migration](/orm/migrations/generating-a-migration) explains the files.

Apply the migration with `--advance-ref db`, which records that your development database is now at the new contract so the next `migration plan` starts from there:
Apply the migration with `db migrate`, which also records in the `db` ref that your development database is now at the new contract, so the next `migration plan` starts from there:

```npm
npx prisma db migrate --advance-ref db
npx prisma db migrate
```

```text
Expand Down Expand Up @@ -300,7 +300,7 @@ npx prisma migration status
✔ Up to date
```

From here, every schema change follows the same routine: edit `prisma/contract.prisma`, run `npx prisma contract emit`, run `npx prisma migration plan --name <name>`, and apply with `npx prisma db migrate --advance-ref db`.
From here, every schema change follows the same routine: edit `prisma/contract.prisma`, run `npx prisma contract emit`, run `npx prisma migration plan --name <name>`, and apply with `npx prisma db migrate`.

## Next steps

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/(index)/prisma-orm/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Check the Node.js version first: `node --version` must print 22.18 or newer on t
1. Scaffold the app: `npm create prisma@latest -- my-app --template [framework] --provider postgres --yes`. Then run `npx prisma@latest init` in the project directory so the Prisma agent skills are installed and stay current, and use them.
2. Get a database connection string: use the one I give you, or create a Prisma Postgres database: check `npx prisma auth whoami` (if I am not signed in, stop and ask me to run `npx prisma auth login`), then `npx prisma project create my-app-db` and `npx prisma postgres create mydb`, which prints the connection string once. Name that project differently from the app, so that it does not collide with the project the deploy in step 6 creates. Export the connection string as `DATABASE_URL` in the shell: in a project created with `npm create prisma`, the Prisma CLI scripts in package.json read the environment variable, not `.env`.
3. From the project directory, apply the starter contract: `npm run db:init`. The app seeds sample users on its first query, from `src/prisma/seed.ts` (`packages/database/src/seed.ts` for turborepo); there is no seed command to run.
4. Edit the starter contract under `src/prisma/` (`packages/database/src/` for turborepo) into a small schema for my use case, then run `npm run contract:emit` and plan and apply the migration: `npx prisma migration plan --name <name>`, then `npx prisma db migrate --advance-ref db --yes`. Migration planning diffs the emitted contract, so the emit step is required. Pass `--advance-ref db` on every apply to this development database, so that the next `migration plan` starts from the state you applied; without it, the next plan repeats the last change and `db migrate` fails with `MIGRATION.PATH_UNREACHABLE`.
4. Edit the starter contract under `src/prisma/` (`packages/database/src/` for turborepo) into a small schema for my use case, then run `npm run contract:emit` and plan and apply the migration: `npx prisma migration plan --name <name>`, then `npx prisma db migrate --yes`. Migration planning diffs the emitted contract, so the emit step is required. `db migrate` also points the `db` ref at the state you applied, so that the next `migration plan` starts from there.
5. Update `src/prisma/seed.ts` (`packages/database/src/seed.ts` for turborepo) and the app routes to query the new schema, start `npm run dev` in the background (with `DATABASE_URL` exported), and verify with a request against the running app. For the `nest` template, if routes return 500s with `reading 'findAll'` in the logs, add explicit `@Inject()` tokens as shown in https://www.prisma.io/docs/guides/frameworks/nestjs.md.
6. Deploy with Prisma Compute. The scaffold declares the app for Prisma Composer in `module.ts` and `service.ts`, with the framework's build requirements (Next.js standalone output, Astro's node adapter, SvelteKit's node adapter, TanStack Start's Nitro build) already configured; the framework guide at https://www.prisma.io/docs/guides/frameworks/[guide].md has the details, where [guide] is the template name except: template `next` → guide `nextjs`, `nest` → `nestjs`, `svelte` → `sveltekit`; `minimal` and `turborepo` have no framework guide. Check `npx prisma auth whoami`. If I am not signed in, stop and ask me to run `npx prisma auth login`, because that step opens a browser. Then run `npm run build` followed by `npx prisma deploy`, and verify the deployed URL with curl. The deployed app provisions and seeds its own Prisma Postgres database; do not pass the local DATABASE_URL. If the deploy fails with `HostedStateBootstrapError`, a project with the module's name exists in my workspace but its hosted state cannot be verified; re-run the deploy with `--name <a unique name>`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ installed
├─ mongodb
├─ prisma@latest (dev)
├─ @types/node (dev)
└─ @prisma/cli-engine@0.10.0 (dev)
└─ @prisma/cli-engine@0.10.4 (dev)

✔ Done. Open prisma-8.md to get started.
```
Expand Down Expand Up @@ -278,7 +278,7 @@ The output continues with a preview of the MongoDB commands. The first plan in a
Apply the migration:

```npm
npx prisma db migrate --advance-ref db
npx prisma db migrate
```

```text no-copy
Expand All @@ -295,17 +295,17 @@ App space
✔ Advanced ref "db" → a7d00abb0f8fc9c9f5ace78b306278673e60cc5774ec1833cd0cfd334beead54
```

`db migrate` runs only the migrations that the database does not have yet, so here it runs only your change. `--advance-ref db` writes the new hash to the `db` ref, so that the next `migration plan` contains only your next change. Pass it every time you apply a migration to your development database. Commit the `migrations/` directory again.
`db migrate` runs only the migrations that the database does not have yet, so here it runs only your change. It also writes the new hash to the `db` ref, so that the next `migration plan` contains only your next change. Commit the `migrations/` directory again.

To apply the migrations to any other database, such as production, pass its connection string. Leave out `--advance-ref`, because the `db` ref describes your development database:
To apply the migrations to any other database, such as production, pass its connection string. With `--db`, `db migrate` leaves the `db` ref alone, because the ref describes your development database:

```npm
npx prisma db migrate --db "$PRODUCTION_DATABASE_URL"
```

`db migrate` runs the migrations that this database does not have yet. An empty database has no marker, so there `db migrate` runs the baseline and then your change.

Every later change follows the same four steps, which take the place of `prisma migrate dev`: edit `src/prisma/contract.prisma`, run `npx prisma contract emit`, run `npx prisma migration plan --name <name>`, and run `npx prisma db migrate --advance-ref db`.
Every later change follows the same four steps, which take the place of `prisma migrate dev`: edit `src/prisma/contract.prisma`, run `npx prisma contract emit`, run `npx prisma migration plan --name <name>`, and run `npx prisma db migrate`.

## Next steps

Expand Down
Loading
Loading