Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,18 @@ dataTransform(endContract, "backfill-product-status", {
});
```

Same `check` and `run` callbacks. Same compilation to a JSON file. Same kind of typed query against a contract snapshot specific to this migration. The query language is Mongo's, `.match(...).updateMany(...)` instead of `.where(...).update(...)`, but everything else carries over. There's a fully working example [in the prisma-next repo](https://github.com/prisma/prisma-next/blob/main/examples/retail-store/migrations/20260416_backfill-product-status/migration.ts), and we'll cover Mongo data migrations in more depth in a follow-up post.
Same `check` and `run` callbacks. Same compilation to a JSON file. Same kind of typed query against a contract snapshot specific to this migration. The query language is Mongo's, `.match(...).updateMany(...)` instead of `.where(...).update(...)`, but everything else carries over. There's a fully working example [in the Prisma repo](https://github.com/prisma/prisma/blob/main/examples/retail-store/migrations/app/20260513T0508_backfill_product_status/migration.ts), and we'll cover Mongo data migrations in more depth in a follow-up post.

## Try it yourself

If you're as excited about this as we are, go ahead and try it out! [The Prisma 8 Release Candidate is available](https://www.prisma.io/blog/prisma-next-early-access-write-your-contract-prompt-your-agent-ship-your-app).

```bash
pnpx prisma-next init
npx prisma@next orm init
```

This command will set up Prisma 8 in a new or existing project with a simple example contract. Write a schema change with a data step in the same file, plan it, read the JSON it compiled to, and apply it.

Tell us what worked and what didn't on [Discord](https://pris.ly/discord) in the `#prisma-next` channel, and **star and watch [prisma/prisma-next](https://pris.ly/pn-gh) on GitHub** to follow development. We'd love to hear your feedback!
Tell us what worked and what didn't on [Discord](https://pris.ly/discord) in the `#prisma-next` channel, and **star and watch [prisma/prisma](https://github.com/prisma/prisma) on GitHub** to follow development. We'd love to hear your feedback!

Prisma 8 is a Release Candidate. Prisma 7 is the current generally available release, so if you're using it, keep using it.
4 changes: 2 additions & 2 deletions apps/blog/content/blog/mongodb-without-compromise/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ The `@@index` declarations in the contract above are not just documentation. The
When you update your contract and run `migration plan`, the planner compares the current state with the desired state:

```shell
$ npx @prisma/cli@next migration plan
$ npx prisma@next migration plan

Migration: 20260409T1200_add_post_indexes

Expand Down Expand Up @@ -254,6 +254,6 @@ The MongoDB Node.js Driver team's input from user-journey research and feature-g

We believe this raises the bar for what MongoDB developers should expect from their tools.

- **Star + watch the repo:** [github.com/prisma/prisma-next](https://github.com/prisma/prisma-next)
- **Star + watch the repo:** [github.com/prisma/prisma](https://github.com/prisma/prisma)
- **Try the Mongo demo app:** [examples/mongo-demo](https://github.com/prisma/prisma/tree/main/examples/mongo-demo)
- **Join the conversation:** [Discord](http://pris.ly/discord)
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ There is no "core API" and "plugin API." There is one SPI, used by the team buil

## What an extension can ship

An extension is a normal npm package: `@yourname/prisma-next-extension-foo`. Your users `pnpm add` it, [add one line to `prisma-next.config.ts`](https://www.prisma.io/docs/orm/v8/extensions/using-extensions), and your additions show up in their contract, their queries, and (if you ship migrations) their migration plans.
An extension is a normal npm package: `@yourname/prisma-next-extension-foo`. Your users `pnpm add` it, [add one line to `prisma.config.ts`](https://www.prisma.io/docs/orm/v8/extensions/using-extensions), and your additions show up in their contract, their queries, and (if you ship migrations) their migration plans.

An extension can include any subset of four layers, in any combination:

Expand All @@ -58,14 +58,14 @@ Three extensions ship in the repo today, each demonstrating a different combinat
All three show up in the same project, file by file:

```typescript
// prisma-next.config.ts: register the pack
// prisma.config.ts: register the pack
import pgvector from "@prisma/orm-extension-pgvector/control";

export default defineConfig({
family: sql,
target: postgres,
adapter: postgresAdapter,
extensionPacks: [pgvector],
orm: ormConfig({
extensions: [pgvector],
// ...contract and db settings
}),
});

// prisma/contract.ts: declare a dimensioned vector column
Expand Down Expand Up @@ -127,7 +127,7 @@ We, the Prisma 8 team, are available on Discord and eager to help you build, as

## The fastest way to start

Clone [`prisma/prisma-next`](https://pris.ly/pn-gh), point your coding agent at the repo, and tell it what you want to build.
Clone [`prisma/prisma`](https://github.com/prisma/prisma), point your coding agent at the repo, and tell it what you want to build.

The repo is dense with architecture docs, architecture decision record (ADRs), SPI READMEs, and reference extensions: enough context that an agent can absorb it in seconds and scaffold a working pack from your description alone, without you reading a line of it first.

Expand All @@ -143,7 +143,7 @@ Either way, the packages are small. Reading code is faster than reading docs.

## Build an extension

Build it, then tell us about it in [`#prisma-next`](https://pris.ly/discord) on Discord, and star [`prisma/prisma-next`](https://pris.ly/pn-gh) on GitHub to follow the SPI as it matures.
Build it, then tell us about it in [`#prisma-next`](https://pris.ly/discord) on Discord, and star [`prisma/prisma`](https://github.com/prisma/prisma) on GitHub to follow the SPI as it matures.

Prisma 8 is early, and the SPI is stable enough that the existing extensions are real proof of what's possible, though we expect to iterate as more of you build against it.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ npm create prisma@next
To add Prisma 8 to an existing project, run:

```bash
npx prisma-next@latest init
npx prisma@next orm init
```

From there, just ask your agent to build something:
Expand All @@ -218,11 +218,11 @@ Or ask your agent _anything_ about Prisma 8:
> _"What happens if a migration fails during deployment?"_
> _"How do I handle breaking changes in my code?"_

Once you've got something running, tag [us on X](https://pris.ly/x) and tell us what you built. The best community builds get a shout-out from the Prisma account and a link in the [Prisma 8 README](https://github.com/prisma/prisma-next).
Once you've got something running, tag [us on X](https://pris.ly/x) and tell us what you built. The best community builds get a shout-out from the Prisma account and a link in the [Prisma 8 README](https://github.com/prisma/prisma).

And when you're ready to ship it, our hosted database [Prisma Postgres](https://www.prisma.io/postgres) comes with a generous free tier.

Star and watch [prisma/prisma-next](https://github.com/prisma/prisma-next) on GitHub to follow what ships next. And if you hit a snag, start a thread in [#prisma-next](https://pris.ly/discord) on [our Discord](https://pris.ly/discord).
Star and watch [prisma/prisma](https://github.com/prisma/prisma) on GitHub to follow what ships next. And if you hit a snag, start a thread in [#prisma-next](https://pris.ly/discord) on [our Discord](https://pris.ly/discord).

We can't wait to see what you build.

Expand Down
15 changes: 9 additions & 6 deletions apps/blog/content/blog/prisma-next-ltree-extension/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,17 @@ npm install prisma-ltree
Control config and the runtime client both take an `extensions` array. Control is where the pack contributes schema types and migrations:

```typescript
// prisma-next.config.ts
import { defineConfig } from "@prisma/orm-postgres/config";
// prisma.config.ts
import { defineConfig } from "@prisma/cli-engine";
import { defineConfig as ormConfig } from "@prisma/orm-postgres/config";
import ltree from "prisma-ltree/control";

export default defineConfig({
contract: "./prisma/contract.prisma",
extensions: [ltree],
db: { connection: process.env.DATABASE_URL! },
orm: ormConfig({
contract: "./prisma/contract.prisma",
extensions: [ltree],
db: { connection: process.env.DATABASE_URL! },
}),
});
```

Expand Down Expand Up @@ -112,7 +115,7 @@ There is a TypeScript schema lane too, with the same compiled output as PSL (Pri

**5. Initialize the database**

The pack ships a baseline migration that runs `CREATE EXTENSION IF NOT EXISTS ltree`. On a fresh project: `npx prisma-next contract emit`, then `npx prisma-next migration plan`, then `npx prisma-next db init`.
The pack ships a baseline migration that runs `CREATE EXTENSION IF NOT EXISTS ltree`. On a fresh project: `npx prisma@next contract emit`, then `npx prisma@next migration plan`, then `npx prisma@next db init`.

**6. Insert and query paths**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ This sets you up with a [Prisma Postgres](https://www.prisma.io/postgres) databa
To add Prisma 8 to an existing app, run:

```shell
bunx prisma-next@latest init
bunx prisma@next orm init
```

To learn more, start with the [announcement blog post](https://pris.ly/pn-ea). Star and watch [prisma/prisma-next](https://github.com/prisma/prisma-next) on GitHub to follow what ships next, and if you hit a snag, start a thread in [`#prisma-next` on our Discord](https://pris.ly/discord).
To learn more, start with the [announcement blog post](https://pris.ly/pn-ea). Star and watch [prisma/prisma](https://github.com/prisma/prisma) on GitHub to follow what ships next, and if you hit a snag, start a thread in [`#prisma-next` on our Discord](https://pris.ly/discord).
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ Three things to watch this month:

## Try it out

You can start building with Prisma 8 today. Run `npx prisma-next init`, open the contract, add a model, run `prisma-next migration plan` — it takes about as long as reading this paragraph.
You can start building with Prisma 8 today. Run `npx prisma@next orm init`, open the contract, add a model, run `npx prisma@next migration plan` — it takes about as long as reading this paragraph.

The API is still settling, so expect breaking changes often. If you find rough edges or something you were hoping for that's missing, drop into [`#prisma-next` on Discord](https://pris.ly/discord) and tell us. Feedback right now is the most valuable thing we can get.

Star or watch [`prisma/prisma-next` on GitHub](https://pris.ly/pn-gh) to follow updates as they land, and subscribe to the [Prisma blog](https://www.prisma.io/blog) for the monthly milestone update.
Star or watch [`prisma/prisma` on GitHub](https://github.com/prisma/prisma) to follow updates as they land, and subscribe to the [Prisma blog](https://www.prisma.io/blog) for the monthly milestone update.

Prisma 8 is not yet production-ready. Prisma 7 remains the right choice for production today.

Expand Down
4 changes: 2 additions & 2 deletions apps/blog/content/blog/prisma-next-roadmap/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ For teams looking to upgrade, you'll be able to run Prisma 8 and Prisma 7 in par

## Follow along

For the most up-to-date view, follow the [roadmap in the Prisma 8 repo](https://github.com/prisma/prisma-next/tree/main/ROADMAP.md) as it develops in real time. We'll post announcements like this one as we learn more.
For the most up-to-date view, follow the [roadmap in the Prisma 8 repo](https://github.com/prisma/prisma/blob/main/ROADMAP.md) as it develops in real time. We'll post announcements like this one as we learn more.

For the broader picture, [check out the Prisma 8 repo](https://github.com/prisma/prisma-next/tree/main) and star it to subscribe to updates.
For the broader picture, [check out the Prisma 8 repo](https://github.com/prisma/prisma) and star it to subscribe to updates.
33 changes: 16 additions & 17 deletions apps/blog/content/blog/prisma-studio-migrations-view/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,13 @@ Here is the workflow, from an empty directory. The screenshots in this post come
npm create prisma@next
```

Answer the prompts (PostgreSQL, PSL, and yes to [Prisma Postgres](https://www.prisma.io/docs/postgres)) or skip them:
Answer the prompts (PostgreSQL, PSL, your package manager) or skip them:

```bash
npm create prisma@next -- my-app --yes --provider postgres --authoring psl \
--template minimal --prisma-postgres --install --emit
npm create prisma@next -- my-app --yes --provider postgres --authoring psl --template minimal
```

This provisions a database, writes `DATABASE_URL` into `.env`, and scaffolds a contract at `src/prisma/contract.prisma`. The database is temporary for 24 hours; `.env` also holds a `CLAIM_URL` to keep it.
This scaffolds a contract at `src/prisma/contract.prisma`. Then create a [Prisma Postgres](https://www.prisma.io/docs/postgres) database with `npx create-db@latest` and export the connection string it prints as `DATABASE_URL` (the CLI reads the environment variable, not `.env`). The database is temporary for 24 hours; `create-db` also prints a claim URL to keep it.

### Step 2: Model, plan, apply

Expand Down Expand Up @@ -93,9 +92,9 @@ model Post {
Compile it, [plan a migration](https://www.prisma.io/docs/orm/v8/migrations/generating-a-migration), [apply it](https://www.prisma.io/docs/orm/v8/migrations/applying-a-migration):

```bash
npx @prisma/cli@next contract emit
npx @prisma/cli@next migration plan --name init_users_posts
npx @prisma/cli@next migrate --advance-ref db
npx prisma@next contract emit
npx prisma@next migration plan --name init_users_posts
npx prisma@next migrate --advance-ref db
```

`--advance-ref db` moves a [ref](https://www.prisma.io/docs/orm/v8/migrations/the-migration-graph#name-important-states-with-refs), a name pinned to a point in your migration history, onto what you just applied. Later plans start from there and produce a delta instead of recreating everything.
Expand Down Expand Up @@ -136,9 +135,9 @@ model Post {
```

```bash
npx @prisma/cli@next contract emit
npx @prisma/cli@next migration plan --name add_roles_and_publishing
npx @prisma/cli@next migrate --advance-ref db
npx prisma@next contract emit
npx prisma@next migration plan --name add_roles_and_publishing
npx prisma@next migrate --advance-ref db
```

Repeat for whatever your app needs; when a change needs a backfill, [Data Migrations in Prisma 8](/data-migrations-in-prisma-next) covers that. The history behind the screenshots here has six migrations: an initial pair of models, this enum-and-fields change, a `Category` model with a relation and two unique constraints, a destructive column drop, and two more field additions.
Expand All @@ -153,14 +152,14 @@ npm run db:seed

### Step 5: Open Studio

A Prisma 8 project has no `schema.prisma`, so Studio takes the connection string with `--url`. It lives in `.env` rather than your shell, so load it first:
A Prisma 8 project has no `schema.prisma`, so Studio takes the connection string with `--url`. The connection string lives in `.env` rather than your shell, so load it first. Run Studio from a directory outside the project: the Prisma 7 CLI that ships Studio cannot read the Prisma 8 `prisma.config.ts` and fails if it finds one:

```bash
set -a && . ./.env && set +a
npx prisma@dev studio --url "$DATABASE_URL"
cd .. && npx prisma@latest studio --url "$DATABASE_URL"
```

Studio opens on `http://localhost:5555`, and **Migrations** is in the left navigation.
Studio prints the local URL it serves on; open it, and **Migrations** is in the left navigation.

## Reading a migration

Expand Down Expand Up @@ -201,7 +200,7 @@ The practical consequence: a migration applied from CI, from a teammate's laptop

## Where you can use it

The Migrations view shipped in `@prisma/studio-core` 0.32.0. The Prisma CLI bundles Studio, and a new enough version is currently only in the CLI's `dev` release, so use `npx prisma@dev studio` to try it locally.
The Migrations view shipped in `@prisma/studio-core` 0.32.0, and the stable Prisma CLI bundles it since 7.9. Run `npx prisma@latest studio --url "$DATABASE_URL"` from a directory outside your Prisma 8 project to try it locally.

It is also in the embedded Studio in [Prisma Console](https://console.prisma.io), for any database with an applied Prisma 8 migration history. Open your database's Studio tab and select **Migrations**. No local setup, and the selected migration is part of the Console URL too.

Expand All @@ -225,7 +224,7 @@ This matters most where the repo can't help you. The database your app talks to
The Migrations view is a screen in Prisma Studio that lists every applied migration of a Prisma 8 database, newest first, with a visual diff of the models it changed, the SQL it executed, and a Prisma-schema diff. It shipped in `@prisma/studio-core` 0.32.0 and reads the history from the database itself.
</Accordion>
<Accordion title="Why doesn't the Migrations item appear in my Prisma Studio?">
The Migrations item appears only when the connected database has at least one applied Prisma 8 migration, recorded in the `prisma_contract.ledger` table. It stays hidden for databases with no applied migrations, for Prisma ORM projects using `prisma migrate`, and for Studio versions older than `@prisma/studio-core` 0.32.0. The stable Prisma CLI still bundles an older Studio, so run `npx prisma@dev studio`.
The Migrations item appears only when the connected database has at least one applied Prisma 8 migration, recorded in the `prisma_contract.ledger` table. It stays hidden for databases with no applied migrations, for Prisma ORM projects using `prisma migrate`, and for Studio versions older than `@prisma/studio-core` 0.32.0. Prisma CLI 7.9 and later bundle a new enough Studio; run `npx prisma@latest studio`.
</Accordion>
<Accordion title="Does the Migrations view work with Prisma ORM and prisma migrate?">
No. Projects managed with `prisma migrate` record their history in the `_prisma_migrations` table, which the view does not read. The Migrations view requires a Prisma 8 project on PostgreSQL, which records each apply in `prisma_contract.ledger`.
Expand All @@ -243,8 +242,8 @@ npm create prisma@next

Model something, apply two migrations, and open **Migrations**. Tell us what you'd want in the timeline next on [Discord](https://pris.ly/discord).

**Star and watch [prisma/prisma-next](https://pris.ly/pn-gh) on GitHub** to follow development.
**Star and watch [prisma/prisma](https://github.com/prisma/prisma) on GitHub** to follow development.

---

The Migrations view shipped in `@prisma/studio-core` 0.32.0. The Prisma CLI bundles Studio, and a new enough version is currently only in the CLI's `dev` release, hence `npx prisma@dev studio`. [Prisma 8 is in Early Access](https://www.prisma.io/blog/prisma-next-early-access-write-your-contract-prompt-your-agent-ship-your-app) and not production-ready yet. Prisma 7 is still the right choice for production today.
The Migrations view shipped in `@prisma/studio-core` 0.32.0; the stable Prisma CLI bundles it since 7.9. [Prisma 8 is in Early Access](https://www.prisma.io/blog/prisma-next-early-access-write-your-contract-prompt-your-agent-ship-your-app) and not production-ready yet. Prisma 7 is still the right choice for production today.
Loading
Loading