@prisma/pg-worker
6.9.0 · 3 Jun 2025Apache-2.012.5k / weekRepositoryHomepagenpmAtom feed
34 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 6.x · latest line
6.9.0
3 Jun 2025Persists your databases across
prisma devinvocations.Enables you to have multiple local Prisma Postgres instances running at the same time.
Running
prisma initnow uses local Prisma Postgres by default.
Today, we are excited to share the
6.9.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release.
Highlights
Prisma ORM without Rust engines for PostgreSQL & SQLite (Preview)
If you've been excited about our work of removing the Rust engines from Prisma ORM but hesitated trying it out because it was in an Early Access (EA) phase, now is a great time for you to get your hands on the Rust-free Prisma ORM version.
This major architectural change has moved from EA into Preview in this release, meaning there are no more know major issues. If you want to try it out, add the
queryCompileranddriverAdapterspreview feature flags to yourgenerator, install the driver adapter for your database, and get going:generator client { provider = "prisma-client-js" previewFeatures = ["queryCompiler", "driverAdapters"] output = "../generated/prisma" }Now run
prisma generateto re-generate Prisma Client. If you didn't use a driver adapter before, you'll need to install, e.g. the one for PostgreSQL:npm install @prisma/adapter-pg
Once installed, you can instantiate
PrismaClientas follows:import { PrismaClient } from './generated/prisma' import { PrismaPg } from '@prisma/adapter-pg' const adapter = new PrismaPg({ connectionString: env.DATABASE_URL }) const prisma = new PrismaClient({ adapter })No more hassle with query engines, binary targets and an even smoother experience in serverless and edge environments!
📚 Learn more in the docs.
Major improvements for local Prisma Postgres (Preview)
In the last release, we enabled you to spin up a Prisma Postgres instance locally via the new
prisma devcommand. Local Prisma Postgres uses PGlite under the hood and gives you an identical experience as you get with a remote Prisma Postgres instance.This release brings major improvements to this feature:
Persists your databases across
prisma devinvocations.Enables you to have multiple local Prisma Postgres instances running at the same time.
Running
prisma initnow uses local Prisma Postgres by default.
Try it out and let us know what you think!
📚 Learn more in the docs.
More news
Connect to Prisma Postgres with any ORM (Preview)
Since its GA release, you could only interact with Prisma Postgres using Prisma ORM via a custom connection string.
This has changed now: When setting up a new Prisma Postgres instance, you receive a regular PostgreSQL direct TCP connection string (starting with
postgres://...) that lets you connect to it using your favorite tool or database library, including Drizzle, Kysely, TypeORM, and others.If you want to access Prisma Postgres from a serverless environment, you can also use our new serverless driver (Early Access).
📚 Learn more in the docs.
Automated backup & restore
Prisma Postgres' backup and restore mechanism has seen a major upgrade recently: You can now easily restore any previous backup via the UI in the Prisma Console. Find the new Backups tab when viewing your database and select any backup from the list to restore its state to a previous point in time.
📚 Learn more in the docs.
Prisma's VS Code extension now has a UI to manage Prisma Postgres
If you're using Prisma ORM, chances are that you're using our VS Code extension too. In its latest release, we've added a major new capability to it: A UI for managing databases.
With this new UI, you can:
Authenticate with the Prisma Console
Create and delete remote Prisma Postgres instances
View local Prisma Postgres instances
View and edit data via an embedded Prisma Studio
Visualize your database schema
DB management in VS Code
To use the new features, make sure to have the latest version of the Prisma VS Code extension installed and look out for the new Prisma logo in VS Code's Activity Bar.
📚 Learn more in the docs.
New region for Prisma Postgres: San Francisco (
us-west-1)We keep expanding Prisma Postgres availability across the globe! After having added Singapore just a few weeks ago, we're now adding San Francisco based on another poll we ran on X. Here are all the regions where you can spin up Prisma Postgres instances today:
us-west-1: San Francisco (new!)us-east-1: North Virginiaeu-west-3: Parisap-northeast-1: Tokyoap-southeast-1: Singapore
Keep an eye on our X account to take part in the poll and vote for the next availability zone of Prisma Postgres!
6.8.2
16 May 2025Today, we are issuing the 6.8.2 patch release. It fully resolves an issue with the
prisma initandprisma devcommands for some Windows users who were still facing problems after the previous incomplete fix in version 6.8.1.Today, we are issuing the 6.8.2 patch release. It fully resolves an issue with the
prisma initandprisma devcommands for some Windows users who were still facing problems after the previous incomplete fix in version 6.8.1.Fixes:
6.8.1
15 May 2025Today, we are issuing the 6.8.1 patch release. It fixes an issue with the
prisma initandprisma devcommands on Windows.Today, we are issuing the 6.8.1 patch release. It fixes an issue with the
prisma initandprisma devcommands on Windows.Fixes
6.8.0
15 May 2025Checking the status of your migrations (e.g. telling you if migrations haven't been applied)
Creating and running schema migrations for you
Authenticating you with the Prisma Console
Today, we are excited to share the
6.8.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release.
Highlights
Local development with Prisma Postgres via
prisma dev(Early Access)In this release, we're releasing a way to develop against Prisma Postgres locally — no Docker required!
To get started, run the new
prisma devcommand:npx prisma dev # starts a local Prisma Postgres server
This command spins up a local Prisma Postgres instance and prints the connection URL that you'll need to set as the
urlof yourdatasourceblock to point to a local Prisma Postgres instance. It looks similar to this:datasource db { provider = "postgresql" url = "prisma+postgres://localhost:51213/?api_key=ey..." }You can then run migrations and execute queries against this local Prisma Postgres instance as with any remote one. Note that you need to keep the
prisma devprocess running in order to interact with the local Prisma Postgres instance.📚 Learn more in the docs.
Native Deno support in
prisma-clientgenerator (Preview)In this release, we're removing the
denoPreview feature from theprisma-client-jsgenerator. If you want to use Prisma ORM with Deno, you can now do so with the newprisma-clientgenerator:generator client { provider = "prisma-client" output = "../src/generated/prisma" runtime = "deno" }📚 Learn more in the docs.
VS Code Agent Mode: AI support with your database workflows
Have you tried agent mode in VS Code already?
"The agent acts as an autonomous pair programmer that performs multi-step coding tasks at your command, such as analyzing your codebase, proposing file edits, and running terminal commands."
As of this release, your agent is capable of supporting you with your database workflows more than ever! If you're using VS Code and have the Prisma VS Code extension installed, your agent now is able to help you with your database workflows, such as:
Checking the status of your migrations (e.g. telling you if migrations haven't been applied)
Creating and running schema migrations for you
Authenticating you with the Prisma Console
Provisioning new Prisma Postgres instances so you can start coding right away
All you need to do is make sure you're using the latest version of Prisma's VS Code extension and your agent is ready to go 🚀
📚 Learn more in the docs.
Other news
You voted, we acted: New Singapore region for Prisma Postgres
We recently ran a poll where we asked you which region you'd like to see next for Prisma Postgres. The majority vote went to Asia Pacific (Singapore), so as of today, you're able to spin up new Prisma Postgres instances in the
ap-southeast-1region.We're not stopping here — keep an eye out on X for another poll asking for your favorite regions that we should add!
6.7.0
29 Apr 2025Today, we are excited to share the
6.7.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release.
Highlights
Prisma ORM without Rust engines (Early Access)
If you're a regular visitor of our company blog, you may already know that we're currently working on moving the core of Prisma from Rust to TypeScript. We have written extensively about why we're moving away from Rust and already shared the first measurements of performance boosts we saw from the re-write.
This re-write is not just a move from one programming language to another. It fundamentally improves the architecture of Prisma ORM and replaces the Query Engine (which is written in Rust and deployed as a standalone binary) with a much leaner and more efficient approach that we call Query Compiler.
In this release, we're excited to give you Early Access to the new Query Compiler for PostgreSQL and SQLite database 🥳 Support for more database will follow very soon!
To use the new "Rust-free" version of Prisma ORM, add the
queryCompiler(new) anddriverAdaptersfeature flags to your client generator:generator client { provider = "prisma-client-js" previewFeatures = ["queryCompiler", "driverAdapters"] output = "../generated/prisma" }Now run
prisma generateto re-generate Prisma Client. If you didn't use a driver adapter before, you'll need to install one. For example, the one for PostgreSQL:npm install @prisma/adapter-pg
Once installed, you can instantiate
PrismaClientas follows:import { PrismaPg } from '@prisma/adapter-pg' import { PrismaClient } from './generated/prisma' const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL }) const prisma = new PrismaClient({ adapter })This version of
PrismaClientdoesn't have a Query Engine binary and you can use it in the exact same way as before.📚 Learn more in the docs.
Support for
better-sqlite3JavaScript driver (Preview)Driver adapters are Prisma ORM's way of letting you use JS-native drivers (like
pg) to interact with your database. In this release, we're introducing a new driver adapter for using thebetter-sqlite3package, so you can now interact with SQLite database in a JS-native way.To use it, first enable the
driverAdaptersPreview feature flag in on your clientgenerator, then install these libraries:npm install @prisma/adapter-better-sqlite3
Now you can instantiate Prisma Client as follows:
import { PrismaBetterSQLite3 } from '@prisma/adapter-better-sqlite3'; import { PrismaClient } from './generated/prisma'; const adapter = new PrismaBetterSQLite3({ url: "file:./prisma/dev.db" }); const prisma = new PrismaClient({ adapter });📚 Learn more in the docs.
Multi-file Prisma schemas are now production-ready
The
prismaSchemaFolderPreview feature is moving into General Availability 🎉 With that change, Prisma ORM now by default supports splitting your Prisma schema file and e.g. lets you organize your schema as follows:prisma/schema.prisma→ defines data source and generatordatasource db { provider = "postgresql" url = env("DATABASE_URL") } generator client { provider = "prisma-client-js" }prisma/models/posts.prisma→ definesPostmodelmodel Post { id Int @id @default(autoincrement()) title String content String? published Boolean @default(false) author User? @relation(fields: [authorId], references: [id]) authorId Int? }prisma/models/users.prisma→ definesUsermodelmodel User { id Int @id @default(autoincrement()) email String @unique name String? posts Post[] }⚠️ Note that there have been breaking changes to the
prismaSchemaFolderPreview feature in the last 6.6.0 release. If you've been using this feature to split your Prisma schema, make sure to read the release notes and update your project accordingly.📚 Learn more in the docs.
Splitting generated output with new
prisma-clientgenerator (Preview)With the
prisma-client-jsgenerator, the generated Prisma Client library is put into a singleindex.d.tsfile. This sometimes led to issues with large schemas where the size of the generated output could slow down code editors and breaking auto-complete.As of this release, our new
prisma-clientgenerator (that was released in 6.6.0) now splits the generated Prisma Client library into multiple files and thus avoids the problems of a single, large output file.Also: As a bonus, we now ensure that generated files do not raise any ESLint and TypeScript errors!
Before
generated/ └── prisma ├── client.ts ├── index.ts # -> this is split into multiple files in 6.7.0 └── libquery_engine-darwin.dylib.nodeAfter
generated/ └── prisma ├── client.ts ├── commonInputTypes.ts ├── enums.ts ├── index.ts ├── internal │ ├── class.ts │ └── prismaNamespace.ts ├── libquery_engine-darwin.dylib.node ├── models │ ├── Post.ts │ └── User.ts └── models.ts📚 Learn more in the docs.
Company news
Our team has been busy shipping more than just the ORM! Check out these articles to learn what else we've been up to recently:
6.6.0
8 Apr 2025- breaking
Pass the the
--schemaoption to your Prisma CLI command (e.g.prisma migrate dev --schema ./prisma/schema) - breaking
Set the
prisma.schemafield inpackage.json:// package.json { "prisma": { "schema": "./schema" } } - breaking
Set the
schemaproperty inprisma.config.ts:import path from 'node:path' import type { PrismaConfig } from 'prisma' export default { earlyAccess: true, schema: path.join('prisma', 'schema'), } satisfies PrismaConfig<Env>
Today, we are excited to share the
6.6.0stable release 🎉 This version comes packed with exciting features, we can't wait to see what you're going to build with it! Read our announcement blog post for more details: Prisma ORM 6.6.0: ESM Support, D1 Migrations & MCP Server🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release. 🌟
Highlights
ESM support with more flexible
prisma-clientgenerator (Early Access)We are excited to introduce a new
prisma-clientgenerator that's more flexible, comes with ESM support and removes any magic behaviours that may cause friction with the currentprisma-client-jsgenerator.Note: The
prisma-clientgenerator is currently in Early Access and will likely have some breaking changes in the next releases.Here are the main differences:
Requires an
outputpath; no “magic” generation intonode_modulesany moreSupports ESM and CommonJS via the
moduleFormatfieldOutputs plain TypeScript that's bundled just like the rest of your application code
Here's how you can use the new
prisma-clientgenerator in your Prisma schema:// prisma/schema.prisma generator client { provider = "prisma-client" // no `-js` at the end output = "../src/generated/prisma" // `output` is required moduleFormat = "esm" // or `"cjs"` for CommonJS }In your application, you can then import the
PrismaClientconstructor (and anything else) from the generated folder:// src/index.ts import { PrismaClient } from './generated/prisma/client'⚠️ Important: We recommend that you add the
outputpath to.gitignoreso that the query engine that's part of the generated Prisma Client is kept out of version control:# .gitignore ./src/generated/prisma
📚 Learn more in the docs.
Cloudflare D1 & Turso/LibSQL migrations (Early Access)
Cloudflare D1 and Turso are popular database providers that are both based on SQLite. While you can query them using the respective driver adapter for D1 or Turso, previous versions of Prisma ORM weren't able to make schema changes against these databases.
With today's release, we're sharing the first Early Access version of native D1 migration support for the following commands:
prisma db push: Updates the schema of the remote database based on your Prisma schemaprisma db pull: Introspects the schema of the remote database and updates your local Prisma schemaprisma migrate diff: Outputs the difference between the schema of the remote database and your local Prisma schema
Note: Support for
prisma migrate devandprisma migrate deploywill come very soon!To use these commands, you need to connect the Prisma CLI to your D1 or Turso instance by using the driver adapter in your
prisma.config.tsfile. Here is an example for D1:import path from 'node:path' import type { PrismaConfig } from 'prisma' import { PrismaD1HTTP } from '@prisma/adapter-d1' // import your .env file import 'dotenv/config' type Env = { CLOUDFLARE_D1_TOKEN: string CLOUDFLARE_ACCOUNT_ID: string CLOUDFLARE_DATABASE_ID: string } export default { earlyAccess: true, schema: path.join('prisma', 'schema.prisma'), migrate: { async adapter(env) { return new PrismaD1HTTP({ CLOUDFLARE_D1_TOKEN: env.CLOUDFLARE_D1_TOKEN, CLOUDFLARE_ACCOUNT_ID: env.CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_DATABASE_ID: env.CLOUDFLARE_DATABASE_ID, }) }, }, } satisfies PrismaConfig<Env>With that setup, you can now execute schema changes against your D1 instance by running:
npx prisma db push
📚 Learn more in the docs:
MCP server to manage Prisma Postgres via LLMs (Preview)
Prisma Postgres is the first serverless database without cold starts. Designed for optimal efficiency and high performance, it's the perfect database to be used alongside AI tools like Cursor, Windsurf, Lovable or co.dev. In this ORM release, we're adding a command to start a Prisma MCP server that you can integrate in your AI development environment. Thanks to that MCP server, you can now:
Tell your AI agent to create new DB instances
Design your data model
Chat through a database migration
… and much more.
To get started, add this snippet to the MCP configuration of your favorite AI tool and get started:
{ "mcpServers": { "Prisma": { "command": "npx", "args": ["-y", "prisma", "mcp"] } } }📚 Learn more in the docs.
New
--promptoption onprisma initYou can now pass a
--promptoption to theprisma initcommand to have it scaffold a Prisma schema for you and deploy it to a fresh Prisma Postgres instance:npx prisma init --prompt "Simple habit tracker application"
For everyone, following social media trends, we also created an alias called
--vibefor you 😉npx prisma init --vibe "Cat meme generator"
Improved API for using driver adapters
In this release, we are introducing a nice DX improvement for driver adapters. Driver adapters let you access your database using JS-native drivers with Prisma ORM.
Before 6.6.0
Earlier versions of Prisma ORM required you to first instantiate the driver itself, and then use that instance to create the Prisma driver adapter. Here is an example using the
@libsql/clientdriver for LibSQL:import { createClient } from '@libsql/client' import { PrismaLibSQL } from '@prisma/adapter-libsql' import { PrismaClient } from '@prisma/client' // Old way of using driver adapters (before 6.6.0) const driver = createClient({ url: env.LIBSQL_DATABASE_URL, authToken: env.LIBSQL_DATABASE_TOKEN, }) const adapter = new PrismaLibSQL(driver) const prisma = new PrismaClient({ adapter })6.6.0 and later
As of this release, you instantiate the driver adapter directly with the options of your preferred JS-native driver.:
import { PrismaLibSQL } from '@prisma/adapter-libsql' import { PrismaClient } from '../prisma/prisma-client' const adapter = new PrismaLibSQL({ url: env.LIBSQL_DATABASE_URL, authToken: env.LIBSQL_DATABASE_TOKEN, }) const prisma = new PrismaClient({ adapter })Other changes
prismaSchemaFolderbreaking changesIf you are using the
prismaSchemaFolderPreview feature to split your Prisma schema into multiple files, you may encounter some breaking changes in this version.Explicit declaration of schema folder location
You now must always provide the path to the schema folder explicitly. You can do this in either of three ways:
- breaking
Pass the the
--schemaoption to your Prisma CLI command (e.g.prisma migrate dev --schema ./prisma/schema) - breaking
Set the
prisma.schemafield inpackage.json:// package.json { "prisma": { "schema": "./schema" } } - breaking
Set the
schemaproperty inprisma.config.ts:import path from 'node:path' import type { PrismaConfig } from 'prisma' export default { earlyAccess: true, schema: path.join('prisma', 'schema'), } satisfies PrismaConfig<Env>
migrationsfolder must live next to.prismafile withdatasourceblockYour
migrationsdirectory must live next to the.prismafile that defines yourdatasourceblog. If you relied on the implicit schema folder location of./prisma/schemamake sure to move your migrations folder from./prisma/migrationsto./prisma/schema/migrations.Assuming
schema.prismadefines thedatasourcein this example, here's how how need to place themigrationsfolder:# `migrations` and `schema.prisma` are on the same level . ├── migrations ├── models │ ├── posts.prisma │ └── users.prisma └── schema.prisma
See this PR for more details.
No more Bun issues if Node.js is not installed
Bun users reported an issue that
prisma generatewould hang if Node.js installed on their machine. This is now fixed and Bun users can generate Prisma Client without issues.Company news
Enterprise support
Prisma offers an enterprise support plan for Prisma ORM. Get direct help from our team and a joint slack channel! With Prisma ORM 7 on the horizon, this is a great time to upgrade your support today.
We are hiring: Developer Support Engineer
If you care about making developers successful, join us as a Developer Support Engineer.
6.5.0
11 Mar 2025Using the
defineConfighelper exported byprisma/config.Using the
PrismaConfigutility type exported byPrisma.
Today, we are excited to share the
6.5.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release. 🌟
Highlights
Databases can only be reset manually and explicitly
In previous versions, if Prisma ORM determined that a
migratecommand could not be applied cleanly to the underlying database, you would get a message like this one:? We need to reset the "public" schema at "db.url.com:5432" Do you want to continue? All data will be lost. (y/N)
While "no" was the default, we've determined that having this prompt in the first place was a mistake. In this version we're removing the prompt entirely and instead exiting with an appropriate error message.
To get the previous behavior, you will need to run
prisma migrate resetdirectly.Support for
prisma.config.tsin Prisma StudioWe've expanded support for our
prisma.config.tsfile to include Prisma Studio!To use the new config file, including the ability to connect to driver adapter enabled databases with Prisma Studio, add a
studioblock to yourprisma.config.tsfile:import path from 'node:path' import type { PrismaConfig } from 'prisma' import { PrismaLibSQL } from '@prisma/adapter-libsql' import { createClient } from '@libsql/client' export default { earlyAccess: true, schema: { kind: 'single', filePath: './prisma/schema.prisma', }, studio: { adapter: async (env: unknown) => { const connectionString = `file:./dev.db' const libsql = createClient({ url: connectionString, }) return new PrismaLibSQL(libsql) }, }, } satisfies PrismaConfigNotice how this looks a little different from last release! Instead of an
@prisma/configpackage there’s now two different options:Using the
defineConfighelper exported byprisma/config.Using the
PrismaConfigutility type exported byPrisma.
All the relevant info for the
prisma.config.tsfile, including these new ways of defining your config, can be found in our docs.Allow for chaining
$onand$extends.In previous versions of Prisma ORM, the return type of the
$onclient method wasvoid. This did not allow for chaining$on()and$extends()calls, as$onis not available on extended clients.In this version we've resolved this issue and
$onwill now return the modified Prisma Client.Community fixes
We have a number of community-submitted fixes that improve Prisma ORM:
Allow for binaries to be loaded from local network. Thank you @RaHehl!
Enhance type safety of the AtLeast utility type. Thank you @de-novo!
Resolve a race condition in the NextJS monorepo plugin. Thank you @toniopelo!
allow for filtering out spans with PrismaInstrumentation. Thank you @overbit!
Prisma is hiring
Join us at Prisma and work on our TypeScript ORM (now faster than ever) and our Cloud products like Prisma Postgres (now in GA!)
We currently have two open roles in our Engineering team:
If these don’t fit, you can still check out our jobs page and send a general application.
Enterprise support
Prisma offers an enterprise support plan for Prisma ORM. Get direct help from our team and a joint slack channel! With Prisma ORM 7 on the horizon this is a great time to upgrade your support today.
6.4.1
20 Feb 2025Today, we are issuing the 6.4.1 patch release. It fixes a few issues with the NPS survey and makes it respect the
--no-hintsCLI flag.Today, we are issuing the 6.4.1 patch release. It fixes a few issues with the NPS survey and makes it respect the
--no-hintsCLI flag.Fixes
6.4.0
18 Feb 2025Today, we are excited to share the
6.4.0stable release 🎉Today, we are excited to share the
6.4.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release. 🌟
Highlights
TypeScript-based configuration with
prisma.config.ts(Early Access)In this release, we're introducing an Early Access version of a TypeScript-based configuration file for Prisma ORM:
prisma.config.ts.This file will serve as a central configuration point for Prisma ORM:
import path from 'node:path' export default { earlyAccess: true, // required while in Early Access schema: { kind: 'single', // use 'multi' if you're using the `prismaSchemaFolder` preview feature filePath: path.join('custom', 'prisma', 'schema.prisma') } })With this file you are able to run any arbitrary code needed to get values required by Prisma ORM, such as database URLs from a secret store or fine-grained control of settings. It needs to live in the current working directory from where you're executing Prisma CLI commands (typically, the root of your project).
Note: If you're using
prisma.config.ts, the Prisma CLI will not load environment variables from.envfiles. If you want to use a.envfile withprisma.config.ts, you'll need to load the environment variables manually using thedotenvpackage (see here).Learn more about the new
prisma.config.tsfile in the docs.Case-insensitive mode in JSON filters
You can now do case-insensitive filtering on JSON data.
Just use the new
modeoption when filtering usingstring_contains,string_starts_withorstring_ends_within a JSON object and set it to"insensitive":await prisma.user.findMany({ where: { pets: { path: ['favorites', 'catBreed'], string_contains: 'Van', mode: "insensitive", }, }, });The above query returns all users where the
favorites.catBreedvalue contains"Van"or"van".Improved CockroachDB migration speed
In this release we found some inefficiencies in our migration engine that was impacting CockroachDB migrations. In 6.4.0, CockroachDB migrations should be significantly faster.
Calling all devs: Give us your feedback!
Prisma ORM's community keeps us going. To make sure that we're focused on what the community needs, we would like to get your feedback via our online feedback form.
6.3.1
4 Feb 2025This patch releases introduces improvements to the
prisma initoutput when invoked to with the--dboption.This patch releases introduces improvements to the
prisma initoutput when invoked to with the--dboption.Run
npx prisma@latest init --dbto get an instant Prisma Postgres database.6.3.0
28 Jan 2025Today, we are excited to share the
6.3.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or tweeting about the release. 🌟
Highlights
A brand new Prisma Studio
In this release we've included several great improvements to Prisma Studio's developer experience. You can learn all about the changes we've made in our release blog post, but here's a short list:
Prisma Studio is back in the Console
Fans of Prisma Data Browser rejoice! The new Prisma Studio is now in the Prisma Console and is available for all PostgreSQL and MySQL databases.
A new model viewer
Previously, switching from model to model in Prisma Studio would require backing all the way out to the model view, then digging in again. With our new UI, it's easy to switch from model to model while keeping your place.
image
A new editing experience
If you're trying to edit a given field in a model, Prisma Studio made it quite easy. However, if you're trying to edit every field in a given row, it could get quite annoying to keep scrolling left to right. Our new edit sidebar resolves that with the ability to edit all fields for a given row at once.
image
Clean up at the click of a button
When editing a number of models, it can get difficult to get back to a clean slate. In the new Prisma Studio, we've added a "Close all" button that puts you back to a fresh start.
image
Add
limittoupdateMany()anddeleteMany()Previously,
limithas not existed as a valid option in top levelupdateMany()anddeleteMany()queries. In 6.3.0limitis now available in these queries, bringing their features more in line with other query types.You can use
limitlike the following:await prisma.user.deleteMany({ where: { column: 'value' }, limit: 100, });This will limit the number of deleted users to 100 at maximum.
Sort
generatorfields deterministicallyIn previous version of Prisma ORM, the fields inside of a
generatorblock in your Prisma Schema were not deterministically sorted. This could lead to cases whereprisma db pullcould lead to re-ordering of fields.In 6.3.0, the sorting of fields in this block is now deterministic. You may see re-ordering on the first
prisma db pullafter you upgrade, but it will remain consistent afterwards.Replace
NOT INwithNOT EXISTSfor PostgreSQL relation filtersIn previous versions of Prisma ORM, when using the
noneorsomerelation filters, the SQL queries generated usedNOT IN. In many cases this lead to performance issues as the size of the related table grew. In 6.3.0, we’ve replaced these usages ofINwithEXISTSin order to improve query performance.A special thank you
We'd like to extend our heartfelt thanks to @loren and his team for the collaboration and trust in our enterprise support plan. Working closely with them allowed us to address important issues like #19249 and #17303. Their insights and partnership have been invaluable in improving our product.
If your team could benefit from dedicated support and tailored solutions, learn more about our enterprise support plan.
Fixes and improvements
Prisma Client
Prisma
6.2.1
8 Jan 2025Today we are releasing the 6.2.1 patch release to address an issue with some of the
omitApipreview feature checks having been accidentally omitted when making the feature GA. Now it is fully functional without the preview feature flag.Today we are releasing the 6.2.1 patch release to address an issue with some of the
omitApipreview feature checks having been accidentally omitted when making the feature GA. Now it is fully functional without the preview feature flag.6.2.0
7 Jan 2025Today we're releasing Prisma ORM version 6.2.0 🎉
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
We have a number of new features in this version, including support for
jsonandenumfields in SQLite, a newupdateManyAndReturnfunction, support for ULID values, as well as the promotion of theomitfeature from Preview to Generally Availability.Highlights
Excluding fields via
omitis now production-readyOur number one requested feature is out of Preview and Generally Available. In 6.2.0, you no longer need to add
omitApito your list of Preview features:generator client { provider = "prisma-client-js" - previewFeatures = ["omitApi"] }As a refresher:
omitallows you to exclude certain fields from being returned in the results of your Prisma Client queries.You can either do this locally, on a per-query level:
const result = await prisma.user.findMany({ omit: { password: true, }, });Or globally, to ensure a field is excluded from all queries of a certain model:
const prisma = new PrismaClient({ omit: { user: { password: true } } }) // The password field is excluded in all queries, including this one const user = await prisma.user.findUnique({ where: { id: 1 } })For more information on
omit, be sure to check our documentation.jsonandenumfields in SQLitePrevious to this version, you could not define
jsonandenumfields in your Prisma schema when using SQLite. The respective GitHub issues have been among the most popular ones in our repo, so with our new approach to open-source governance, we finally got to work and implemented these.Working with JSON and Enum fields works similarly to other database providers, here’s an example:
datasource db { provider = "sqlite" url = "file:./dev.db" } model User { id Int @id @default(autoincrement()) name String role Role data Json } enum Role { Customer Admin }Support for auto-generated ULID values
Similar to
cuid2support released in ORM version 6.0.0, we are now adding support for Universally Unique Lexicographically Sortable Identifiers (or short: ULIDs 😄) in version 6.2.0. A ULID value is a 26-character alphanumeric string, e.g.01GZ0GZ3XARH8ZP44A7TQ2W4ZD.With this new feature, you can now create records with auto-generated ULID values for
Stringfields:model User { id String @id @default(ulid()) }New batch function:
updateManyAndReturnupdateManyallows you to update many records in your database, but it only returns the count of the affected rows, not the resulting rows themselves. WithupdateManyAndReturnyou are now able to achieve this:const users = await prisma.user.updateManyAndReturn({ where: { email: { contains: 'prisma.io', } }, data: { role: 'ADMIN' } })This call to
updateManyAndReturnwill now return the actual records that have been updated in the query:[{ id: 22, name: 'Alice', email: 'alice@prisma.io', profileViews: 0, role: 'ADMIN', coinflips: [] }, { id: 23, name: 'Bob', email: 'bob@prisma.io', profileViews: 0, role: 'ADMIN', coinflips: [] }]Please note that like
createManyAndReturn,updateManyAndReturnis only supported in PostgreSQL, CockroachDB, and SQLite.Fixed runtime error in Node.js v23
While not officially supported, we understand that a lot of you like to be on the latest Node.js version — so we fixed an error that only occurred on Node.js 23. Happy coding ✌️
Prisma is hiring
Join us at Prisma to work on the most popular TypeScript ORM and other exciting products like the first serverless database built on unikernels!
We currently have two open roles in our Engineering team:
If these don’t fit, you can still check out our jobs page and send a general application.
6.1.0
17 Dec 2024@opentelemetry/apiis now a peer dependency instead of a regular dependencyregisterInstrumentationsin@opentelemetry/instrumentationis now re-exported by@prisma/instrumentation
Today we're releasing Prisma ORM version 6.1.0
In this version our
tracingPreview feature is being graduated to GA!Highlights
Tracing goes GA
The
tracingPreview feature is now stable. You now no longer have to includetracingin your set of enabled preview features.generator client { provider = "prisma-client-js" - previewFeatures = ["tracing"] }We have also changed some of the spans generated by Prisma Client. Previously, a trace would report the following spans:
prisma:client:operation prisma:client:serialize prisma:engine prisma:engine:connection prisma:engine:db_query prisma:engine:serialize
Now, the following are reported:
prisma:client:operation prisma:client:serialize prisma:engine:query prisma:engine:connection prisma:engine:db_query prisma:engine:serialize prisma:engine:response_json_serialization
Additionally, we have made a few changes to our dependencies:
@opentelemetry/apiis now a peer dependency instead of a regular dependencyregisterInstrumentationsin@opentelemetry/instrumentationis now re-exported by@prisma/instrumentation
After upgrading to Prisma ORM 6.1.0 you will need to add
@opentelemetry/apito your dependencies if you haven't already:npm install @opentelemetry/api
You will also no longer need to have
@opentelemetry/instrumentationif you only useregisterInstrumentations. In this case you can importregisterInstrumentationsfrom@prisma/instrumentation- import { PrismaInstrumentation } from '@prisma/instrumentation' + import { PrismaInstrumentation, registerInstrumentations } from '@prisma/instrumentation'Mutli-line comments in Prisma Schema Language (PSL)
Comments can now be defined as multi-line in your Prisma schema! Comments can use the existing format:
// this is a schema comment
or can now also use our multi-line format:
/* * this is a multi-line comment * You can add in all you want here * Keep typing and this comment will keep on going */
Bug fixes
Tracing related
As we're moving our
tracingpreview to GA, a number of issues have been resolved. Here are a few highlights:Other issues
We also have a number of other issues that were resolved outside of our
tracingfeature.Fixes and improvements
Prisma
Instrumentation error in production:
TypeError: parentTracer.getSpanLimits is not a functionPrisma Client doesn't put all OTEL trace spans under one parent span
Add tests for tracing and different ways to open the first connection (including internal spans)
prisma:enginespans are missing when there are multiplenew PrismaClient()invocationsSupport tracers not derived from
opentelemetry-sdk-trace-base(e.g. Datadog tracer)Make sure
db.statementattribute doesn't include thetraceparentcomment[Instrumentation]
registerInstrumentationsuses the global provider instead of the one passed inAlpine Linux 3.21:
Prisma failed to detect the libssl/openssl version to use
Prisma Client
6.0.1
2 Dec 2024Today we are releasing the
6.0.1patch release to address an issue with using Prisma Client generated in a custom output path with Next.js.Changes
6.0.0
28 Nov 2024- breaking
For Node.js 18 the minimum supported version is 18.18.0
- breaking
For Node.js 20 the minimum supported version is 20.9.0
- breaking
For Node.js 22 the minimum supported version is 22.11.0
We’re excited to share the Prisma ORM v6 release today 🎉
As this is a major release, it includes a few breaking changes that may affect your application. Before upgrading, we recommend that you check out our upgrade guide to understand the impact on your application.
If you want to have an overview of what we accomplished since v5, check out our announcement blog post: Prisma 6: Better Performance, More Flexibility & Type-Safe SQL.
🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release.
Breaking changes
⚠️ This section contains a list of breaking changes. If you upgrade your application to Prisma ORM v6 without addressing these, your application is going to break! For detailed upgrade instructions, check out the upgrade guide. ⚠️
Minimum supported Node.js versions
The new minimum supported Node.js versions for Prisma ORM v6 are:
- breaking
For Node.js 18 the minimum supported version is 18.18.0
- breaking
For Node.js 20 the minimum supported version is 20.9.0
- breaking
For Node.js 22 the minimum supported version is 22.11.0
There is no official support for Node.js <18.18.0, 19, 21, 23.
Minimum supported TypeScript version
The new minimum supported TypeScript version for Prisma ORM v6 is: 5.1.0.
Schema change for implicit m-n relations on PostgreSQL
If you're using PostgreSQL and are defining implicit many-to-many relations in your Prisma schema, Prisma ORM maintains the relation table for you under the hood. This relation table has
AandBcolumns to represent the tables of the models that are part of this relation.Previous versions of Prisma ORM used to create a unique index on these two columns. In Prisma v6, this unique index is changing to a primary key in order to simplify for the default replica identity behaviour.
If you're defining implicit m-n relations in your Prisma schema, the next migration you'll create will contain
ALTER TABLEstatements for all the relation tables that belong to these relations.Full-text search on PostgreSQL
The
fullTextSearchPreview feature is promoted to General Availability only for MySQL. This means that if you're using PostgreSQL and currently make use of this Preview feature, you now need to use the newfullTextSearchPostgresPreview feature.Usage of
BufferPrisma v6 replaces the usage of
BufferwithUint8Arrayto represent fields of typeBytes. Make sure to replace all your occurrences of theBuffertype with the newUint8Array.Removed
NotFoundErrorIn Prisma v6, we removed the
NotFoundErrorin favor ofPrismaClientKnownRequestErrorwith error codeP2025infindUniqueOrThrow()andfindFirstOrThrow(). If you've relied on catchingNotFoundErrorinstances in your code, you need to adjust the code accordingly.New keywords that can't be used as model names:
async,await,usingWith this release, you can't use
async,awaitandusingas model names any more.⚠️ For detailed upgrade instructions, check out the upgrade guide. ⚠️
Preview features promoted to General Availability
In this release, we are promoting a number of Preview features to General Availability.
fullTextIndexIf you use the full-text index feature in your app, you can now remove
fullTextIndexfrom thepreviewFeaturesin your Prisma schema:generator client { provider = "prisma-client-js" - previewFeatures = ["fullTextIndex"] }fullTextSearchIf you use the full-text search feature with MySQL in your app, you can now remove
fullTextSearchfrom thepreviewFeaturesin your Prisma schema:generator client { provider = "prisma-client-js" - previewFeatures = ["fullTextSearch"] }If you are using it with PostgreSQL, you need to update the name of the feature flag to
fullTextSearchPostgres:generator client { provider = "prisma-client-js" - previewFeatures = ["fullTextSearch"] + previewFeatures = ["fullTextSearchPostgres"] }New features
We are also releasing new features with this release:
Company news
Prisma Postgres is free during Early Access
In case you missed it: We recently launched Prisma Postgres, a serverless database with zero cold starts, a generous free tier, connection pooling, real-time events, and a lot more! It’s entirely free during the Early Access phase, try it now!
Let us know what you think of Prisma ORM
We're always trying to improve! If you've recently used Prisma ORM, we'd appreciate hearing your thoughts about your experience via this 2min survey.
- 5.x
5.22.0
5 Nov 2024Today, we are excited to share the
5.22.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release.
Highlights
Further Tracing Improvements
In our ongoing effort to stabilize the
tracingPreview feature, we’ve made our spans compliant with OpenTelemetry Semantic Conventions for Database Client Calls. This should lead to better compatibility with tools such as DataDog and Sentry.We’ve also included numerous bug fixes that should make this Preview feature easier to work with.
Metrics bug fix
Occasionally, connection pool metrics would become negative or grow unbounded. In this release, connection pool metrics should stay consistent.
Connection Pool Timeout fix
In a specific case, there could be issues where fetching a new connection from the connection pool would time out, regardless of the state of the application and connection pool. If you have experience connection pool issues accessing a PostgreSQL database with TLS encryption in a resource-constrained environment (such as Function-as-a-Service offerings or very small VPS) this should resolve those issues.
Special thanks to @youxq for their pull request and help resolving this issue!
Join us
Looking to make an impact on Prisma in a big way? We're hiring!
Learn more on our careers page: prisma.io/careers
Fixes and improvements
Prisma Migrate
Prisma
5.21.1
17 Oct 2024Fixed a bug where migrations were not using shadow database correctly in some edge cases
5.21.0
15 Oct 2024Today, we are excited to share the
5.21.0release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release.
Highlights
Better support for tracing in MongoDB
The
tracingPreview feature now has full support for MongoDB with previously missing functionality now implemented. This is a part of the ongoing effort to stabilize this Preview feature and release it in General Availability.tracingis a Preview feature that enables built-in support for OpenTelemetry instrumentation inside the Prisma Client and provides deep insights into the performance and timing of your queries. See our documentation for more information.For an easy to use and zero-configuration tracing instrumentation tool with a dashboard that provides an overview of your queries, statistics, and AI-powered recommendations, try Prisma Optimize.
WebAssembly engine size decrease for edge functions
Due to recent changes, some users experienced a steep increase of the bundle size in Prisma 5.20 when using the
driverAdaptersPreview feature, going over the 1 MB limit on the free tier of Cloudflare Workers. This has now been fixed.Fixes and improvements
Prisma Engines
5.20.0
24 Sep 2024🌟 Help us spread the word about Prisma by starring the repo or posting on X about the release. 🌟
Highlights
strictUndefinedChecksin PreviewWith Prisma ORM 5.20.0, the Preview feature
strictUndefinedCheckswill disallow any value that is explicitlyundefinedand will be a runtime error. This change is direct feedback from this GitHub issue and follows our latest proposal on the same issue.To demonstrate the change, take the following code snippet:
prisma.table.deleteMany({ where: { // If `nullableThing` is nullish, this query will remove all data. email: nullableThing?.property, } })In Prisma ORM 5.19.0 and below, this could result in unintended behavior. In Prisma ORM 5.20.0, if the
strictUndefinedChecksPreview feature is enabled, you will get a runtime error instead:Invalid \`prisma.user.findMany()\` invocation in /client/tests/functional/strictUndefinedChecks/test.ts:0:0 XX }) XX XX test('throws on undefined input field', async () => { → XX const result = prisma.user.deleteMany({ where: { email: undefined ~~~~~~~~~ } }) Invalid value for argument \`where\`: explicitly \`undefined\` values are not allowed."We have also introduced the
Prisma.skipsymbol, which will allow you to get the previous behavior if desired.prisma.table.findMany({ where: { // Use Prisma.skip to skip parts of the query email: nullableEmail ?? Prisma.skip } })From Prisma ORM 5.20.0 onward, we recommend enabling
strictUndefinedChecks, along with the TypeScript compiler optionexactOptionalPropertyTypes, which will help catch cases of undefined values at compile time. Together, these two changes will help protect your Prisma queries from potentially destructive behavior.strictUndefinedCheckswill be a valid Preview feature for the remainder of Prisma ORM 5. With our next major version, this behavior will become the default and the Preview feature will be “graduated” to Generally Available.If you have any questions or feedback about
strictUndefinedChecks, please ask/comment in our dedicated Preview feature GitHub discussion.typedSqlbug fixThank you to everyone who has tried out our
typedSqlPreview feature and provided feedback! This release has a quick fix for typescript files generated when Prisma Schema enums had hyphens.Fixes and improvements
Prisma
Prisma incorrectly parses CRDB's FK constraint error as
not available.Invalid TypeScript files created by
generatewhen typedSql is enabled and enum contains hyphens.using
$extendsprevents model comments from being passed to TypeScript
Prisma Engines
5.19.1
2 Sep 2024Today, we are issuing the
5.19.1patch release.Today, we are issuing the
5.19.1patch release.What's Changed
We've fixed the following issues:
5.19.0
27 Aug 2024Make sure that you have the latest version of
prismaand@prisma/clientinstalled:npm install -D prisma@latest npm install @prisma/client@latest
Enable the
typedSqlPreview feature in your Prisma Schema.generator client { provider = "prisma-client-js" previewFeatures = ["typedSql"] }Create a
sqlsubdirectory of yourprismadirectory.mkdir -p prisma/sql
Today, we are excited to share the
5.19.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or posting on X about the release. 🌟
Highlights
Introducing TypedSQL
TypedSQL is a brand new way to interact with your database from Prisma Client. After enabling the
typedSqlPreview feature, you’re able to write SQL queries in a newsqlsubdirectory of yourprismadirectory. These queries are then checked by Prisma during using the new--sqlflag ofprisma generateand added to your client for use in your code.To get started with TypedSQL:
Make sure that you have the latest version of
prismaand@prisma/clientinstalled:npm install -D prisma@latest npm install @prisma/client@latest
Enable the
typedSqlPreview feature in your Prisma Schema.generator client { provider = "prisma-client-js" previewFeatures = ["typedSql"] }Create a
sqlsubdirectory of yourprismadirectory.mkdir -p prisma/sql
You can now add
.sqlfiles to thesqldirectory! Each file can contain one sql query and the name must be a valid JS identifier. For this example, say you had the filegetUsersWithPosts.sqlwith the following contents:SELECT u.id, u.name, COUNT(p.id) as "postCount" FROM "User" u LEFT JOIN "Post" p ON u.id = p."authorId" GROUP BY u.id, u.name
Import your SQL query into your code with the
@prisma/client/sqlimport:import { PrismaClient } from '@prisma/client' import { getUsersWithPosts } from '@prisma/client/sql' const prisma = new PrismaClient() const usersWithPostCounts = await prisma.$queryRawTyped(getUsersWithPosts) console.log(usersWithPostCounts)
There’s a lot more to talk about with TypedSQL. We think that the combination of the high-level Prisma Client API and the low-level TypedSQL will make for a great developer experience for all of our users.
To learn more about behind the “why” of TypedSQL be sure to check out our announcement blog post.
For docs, check out our new TypedSQL section.
Bug fixes
Driver adapters and D1
A few issues with our
driverAdaptersPreview feature and Cloudflare D1 support were resolved via #4970 and #24922Mathematic operations such as
max,min,eq, etc in queries when using Cloudflare D1.Resolved issues when comparing
BigIntIDs whenrelationMode="prisma"was enabled and Cloudflare D1 was being used.
Joins
#23742 fixes Prisma Client not supporting deeply nested
someclauses when therelationJoinsPreview feature was enabled.
MongoDB
The MongoDB driver for Rust (that our query engine users under the hood) had behavior that prioritized IPv4 connections over IPv6 connections. In IPv6-only environments, this could lead to significant "cold starts" where the query engine had to wait for IPv4 to fail before the driver would try IPv6.
With help from the MongoDB team, this has been resolved. The driver will now try IPv4 and IPv6 connections in parallel and then move forward with the first response. This should prevent cold start issues that have been seen with MongoDB in Prisma Accelerate.
Thank you to the MongoDB team!
Join us
Looking to make an impact on Prisma in a big way? We're now hiring engineers for the ORM team!
Senior Engineer (TypeScript): This person will be primarily working on the TypeScript side and evolving our Prisma client. Rust knowledge (or desire to learn Rust) is a plus.
Senior Engineer (Rust): This person will be focused on the
prisma-enginesRust codebase. TypeScript knowledge (or, again, a desire to learn) is a plus.
5.18.0
6 Aug 2024[Empty
Jsonfields will now return `` instead ofnullwhen accessed through a join using therelationJoinsPreview feature.](#22923)
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Highlights
Native support for UUIDv7
Previous to this release, the Prisma Schema function
uuid()did not accept any arguments and created a UUIDv4 ID. While sufficient in many cases, UUIDv4 has a few drawbacks, namely that it is not temporally sortable.UUIDv7 attempts to resolve this issue, making it easy to temporally sort your database rows by ID!
To support this, we’ve updated the
uuid()function in Prisma Schema to accept an optional, integer argument. Right now, the only valid values are4and7, with4being the default.model User { id String @id @default(uuid()) // defaults to 4 name String } model User { id String @id @default(uuid(4)) // same as above, but explicit name String } model User { id String @id @default(uuid(7)) // will use UUIDv7 instead of UUIDv4 name String }Bug squashing
We’ve squashed a number of bugs this release, special thanks to everyone who helped us! A few select highlights are:
SQLite db will now be created and read from the correct location when using
prismaSchemaFolder.[Empty
Jsonfields will now return `` instead ofnullwhen accessed through a join using therelationJoinsPreview feature.](#22923)
Fixes and improvements
Prisma
Language tools (e.g. VS Code)
Share your feedback about Prisma ORM
We want to know how you like working with Prisma ORM in your projects! Please take our 2min survey and let us know what you like or where we can improve 🙏
5.17.0
16 Jul 2024🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Highlights
VSCode extension improvements
We’re happy to introduce some cool new features that will make your experience with the Prisma VSCode extension even better!
Find references across schema files
The ability to hop between references of a given symbol is really useful in application code and now with the introduction of multi-file schema, we think it’s the perfect time to bring this feature to the VSCode extension!
With the 5.17.0 release, you’ll now have the ability to use the native “find references” feature to find any usage of a given symbol
references
Added context on hover
When hovering over a symbol that references a view, type, enum, or any other block with multiple values, you’ll now see a handy pop out that shows what is in that block at a glance.
image
Additional quick fixes
We’ve taken some fixes made by the
prisma formatcli command and made them quick fixes available to the VSCode Extension. Now, when you have forget a back relation or relation scalar field, you’ll now see in real time what is wrong and have the option to fix it via the extension.image (1)
QueryRaw performance improvements
We’ve changed the response format of
queryRawto decrease its average size which reduces serialization CPU overhead.When querying large data sets, we expect you to see improved memory usage and up to 2x performance improvements.
Fixes and improvements
Prisma Client
Prisma
Language tools (e.g. VS Code)
5.16.2
9 Jul 2024Today, we are issuing the 5.16.2 patch release to fix an issue in Prisma client.
Fix in Prisma Client
5.16.1
27 Jun 2024Today, we are issuing the 5.16.1 patch release to fix an issue in Prisma client.
Fix in Prisma Client
5.16.0
25 Jun 2024When using relative paths in Prisma Schema files with the
prismaSchemaFolderfeature, a path is now relative to the file it is defined in rather than relative to theprisma/schemafolder. This means that if you have a generator block in/project/prisma/schema/config/generator.prismawith anoutputof./foothe output will be resolved to/project/prisma/schema/config/foorather than/project/prisma/foo. The path to a SQLite file will be resolved in the same manner.We realized that during migration many people would have
prisma/schemaas well asprisma/schema.prisma. Our initial implementation looked for a.prismafile first and would ignore theschemafolder if it exists. This is now an error.
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Highlights
Omit model fields globally
With Prisma ORM 5.16.0 we’re more than happy to announce that we’re expanding the
omitApiPreview feature to also include the ability to omit fields globally.When the Preview feature is enabled, you’re able to define fields to omit when instantiating Prisma Client.
const prisma = new PrismaClient({ omit: { user: { // make sure that password is never queried. password: true, }, }, });You’re also able to omit fields from multiple models and multiple fields from the same model
const prisma = new PrismaClient({ omit: { user: { // make sure that password and internalId are never queried. password: true, internalId: true, }, post: { secretkey: true, }, }, });With both local and global
omit, you now have the flexibility to completely remove sensitive fields while also tailoring individual queries. If you need the ability to generally omit a field except in a specific query, you can also overwrite a global omit locallyconst prisma = new PrismaClient({ omit: { user: { // password is omitted globally. password: true, }, }, }); const userWithPassword = await prisma.user.findUnique({ omit: { password: false }, // omit now false, so password is returned where: { id: 1 }, });Changes to
prismaSchemaFolderIn
5.15.0we released theprismaSchemaFolderPreview feature, allowing you to create multiple Prisma Schema files in aprisma/schemadirectory. We’ve gotten a lot of great feedback and are really excited with how the community has been using the feature.To continue improving our multi-file schema support, we have a few breaking changes to the
prismaSchemaFolderfeature:When using relative paths in Prisma Schema files with the
prismaSchemaFolderfeature, a path is now relative to the file it is defined in rather than relative to theprisma/schemafolder. This means that if you have a generator block in/project/prisma/schema/config/generator.prismawith anoutputof./foothe output will be resolved to/project/prisma/schema/config/foorather than/project/prisma/foo. The path to a SQLite file will be resolved in the same manner.We realized that during migration many people would have
prisma/schemaas well asprisma/schema.prisma. Our initial implementation looked for a.prismafile first and would ignore theschemafolder if it exists. This is now an error.
Changes to
fullTextSearchIn order to improve our full-text search implementation we have made a breaking change to the
fullTextSearchPreview feature.Previously, when the feature was enabled we updated the
<Model>OrderByWithRelationInputTypeScript type with the<Model>OrderByWithRelationAndSearchRelevanceInputtype. However, we have noted that there are no cases where relational ordering is needed but search relevance is not. Thus, we have decided to remove the<Model>OrderByWithRelationAndSearchRelevanceInputnaming and only use the<Model>OrderByWithRelationInputnaming.Fixes and improvements
Prisma
[Driver Adapters]: missing provider compatibility validation
Disable "Start using Prisma Client" hint logs on
prisma generate@prisma/adapter-pgmodifies node-postgres global type parsers@prisma/adapter-d1 is failing with an import error when called inside vitest tests
Language tools (e.g. VS Code)
Prisma Engines
5.15.1
18 Jun 2024Today, we are issuing the
5.15.1patch release.Fixes in Prisma Client
Got error 'internal error: entered unreachable code' when trying to perform an upsert.
ConnectionError(Timed out during query execution.)during seedingConnectionError(Timed out during query execution.)error when usingPromise.allfor SQLiteSQLite times out during query execution when using
Promise.all()/ concurrent
5.15.0
4 Jun 2024Enable the
prismaSchemaFolderPreview feature by including it in thepreviewFeaturesfield of yourgenerator.datasource db { provider = "postgresql" url = env("DATABASE_URL") } generator client { provider = "prisma-client-js" previewFeatures = ["prismaSchemaFolder"] }Create a
schemasubdirectory under yourprismadirectory.
Today, we are excited to share the
5.15.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Highlights
Multi-File Prisma Schema support
Prisma ORM 5.15.0 features support for multi-file Prisma Schema in Preview.
This closes a long standing issue and does so in a clean and easy to migrate way.
To get started:
Enable the
prismaSchemaFolderPreview feature by including it in thepreviewFeaturesfield of yourgenerator.datasource db { provider = "postgresql" url = env("DATABASE_URL") } generator client { provider = "prisma-client-js" previewFeatures = ["prismaSchemaFolder"] }Create a
schemasubdirectory under yourprismadirectory.Move your
schema.prismainto this directory.
You are now set up with a multi-file Prisma Schema! Add as many or as few
.prismafiles to the newprisma/schemadirectory.When running commands where a Prisma Schema file is expected to be provided, you can now define a Prisma Schema directory. This includes Prisma CLI commands that use the
--schemaoption as well as defining schema viapackage.jsonOur tooling has also been updated to handle multiple Prisma Schema files. This includes our Visual Studio Code extension and tools like database introspection, which will deposit new models in a
introspected.prismafile. Existing models will be updated in the file they are found.To learn more, please refer to our official documentation and announcement blog post. If you try out
prismaSchemaFolder, please let us know!Interesting Bug Fixes
Fix for PostgreSQL prepared statement caching for raw queries
This release fixes a nasty bug with the caching of prepared statements in raw Prisma Client queries that affected PostgreSQL when you ran the same SQL statement with differently typed paramters. This should not fail any more.
Fix for SQL Server introspection of (deprecated)
CREATE DEFAULTOur Introspection logic crashed on encountering certain multi-line
CREATE DEFAULT, a deprecated way to define defaults in SQL Server. As many SQL Server users are working with established databases, this happened frequently enough that we now explicitly ignore these defaults instead of crashing.Fix for Cloudflare D1’s lower parameter limit
Cloudflare’s D1 has a lower parameter limit than local SQLite, which caused bigger queries to fail. We adapted that limit to the D1 default for
@prisma/adapter-d1, which will avoid such failures.Fix for Cloudflare D1’s different
PRAGMAsupportOur generated migration SQL for SQLite did not always work for Cloudflare D1, because of differences in the supported pragmas. We adapted the SQL to work in both local SQLite and Cloudflare D1.
Fixes and improvements
Prisma Migrate
doing introspection on a SQL Server 2018 DB - for Dynamic GP get the following error.
Error: called
Result::unwrap()on anErrvalue: "Couldn't parse default value in SQL ServerSQL Server Introspection crashes on multi-line (deprecated) defaults
Prisma Client
Float number on raw query:
incorrect binary data format in bind parameter 1Can't use Prisma client in Next.js middleware, even when deploying to Node.js
Next.js app build fails when using Prisma with DB driver in Server Action
Bug: [D1] Error in performIO: Error: D1_ERROR: too many SQL variables
$executeRawUnsafe:
incorrect binary data format in bind parameter 6Bug: Error or bug using Prisma with DriverAdapter with PostgreSQL database Neon
Incompatibility with NextJS app dir, CloudFlare Pages and D1
- breaking
Language tools (e.g. VS Code)
5.14.0
14 May 2024Today, we are excited to share the
5.14.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release. 🌟
Highlights
Share your feedback about Prisma ORM
We want to know how you like working with Prisma ORM in your projects! Please take our 2min survey and let us know what you like or where we can improve 🙏
createManyAndReturn()We’re happy to announce the availability of a new, top-level Prisma Client query:
createManyAndReturn(). It works similarly tocreateMany()but uses aRETURNINGclause in the SQL query to retrieve the records that were just created.Here’s an example of creating multiple posts and then immediately returning those posts.
const postBodies = req.json()['posts'] const posts = prisma.post.createManyAndReturn({ data: postBodies }); return postsAdditionally,
createManyAndReturn()supports the same options asfindMany(), such as the ability to return only specific fields.const postBodies = req.json()['posts'] const postTitles = prisma.post.createManyAndReturn({ data: postBodies, select: { title: true, }, }); return postTitlesFull documentation for this feature can be found in the Prisma Client API Reference.
Note: Because
createManyAndReturn()uses theRETURNINGclause, it is only supported by PostgreSQL, CockroachDB, and SQLite databases. At this time,relationLoadStrategy: joinis not supported increateManyAndReturn()queries.MongoDB performance improvements
Previously, Prisma ORM suffered from performance issues when using the
inoperator or when including related models in queries against a MongoDB database. These queries were translated by the Prisma query engine in such a way that indexes were skipped and collection scans were used, leading to slower queries especially on large datasets.With 5.14.0, Prisma ORM now rewrites queries to use a combination of
$orand$eqoperators, leading to dramatic performance increases for queries that includeinoperators or relation loading.Fixes and improvements
Prisma Client
MongoDB: Performance issue with nested
takeon many-to-one relationship[MongoDB] Performance issue in
findMany()query execution withinMongoDB Connector generates queries which do not take advantage of indices.
Prisma Migrate
Validation error when
shadowDatabaseUrlis identical tourl(ordirectUrl)MongoDB Query with 'in' condition will cause COLLSCAN, without leveraging indexes
Language tools (e.g. VS Code)
Company news
Prisma Changelog
Curious about all things Prisma? Be sure to check out the Prisma Changelog for updates across Prisma's products, including ORM, Accelerate, and Pulse!
New product announcement: Prisma Optimize
With this release, we are excited to introduce a new Prisma product. We’re calling it “Optimize” because that’s what it does! Let your favorite ORM also help you debug the performance of your application.
Check out our announcement blog post for more details, including a demo video.
5.13.0
23 Apr 2024Today, we are excited to share the
5.13.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or posting on X about the release.
Highlights
omitfields from Prisma Client queries (Preview)We’re excited to announce Preview support for the
omitoption within the Prisma Client query options. The highly-requestedomitfeature now allows you to exclude fields that you don’t want to retrieve from the database on a per-query basis.By default, when a query returns records, the result includes all scalar fields of the models defined in the Prisma schema.
selectcan be used to return specific fields, whileomitcan now be used to exclude specific fields.omitlives at the same API level and works on all of the same Prisma Client model queries asselect. Note, however, thatomitandselectare mutually exclusive. In other words, you can’t use both in the same query.To get started using
omit, enable theomitApiPreview feature in your Prisma schema:// schema.prisma generator client { provider = "prisma-client-js" previewFeatures = ["omitApi"] }Be sure to re-generate Prisma Client afterwards:
npx prisma generate
Here is an example of using
omit:// Includes all fields except password await prisma.user.findMany({ omit: { password: true }, })Here is an example of using
omitwithinclude:// Includes all user fields except user's password and title of user's posts await prisma.user.findMany({ omit: { password: true }, include: { posts: { omit: { title: true }, }, }, })Expand to view the example Prisma schema
model User { id Int @id @default(autoincrement()) email String @unique name String? password String posts Post[] } model Post { id Int @id @default(autoincrement()) title String author User @relation(fields: [authorId], references: [id]) authorId Int }Many users have requested a global implementation of
omit. This request will be accommodated in the future. In the meantime, you can follow the issue here.📣 Share your feedback:
omitApiPreview feature📚 Documentation:
omit- Prisma Client API ReferenceFixes and improvements
Prisma Migrate
Prisma Client
MySQL
upsert():Internal error: Attempted to serialize empty result.Mysql
upsert()fails with "Attempted to serialize empty result."Interactive Transaction API timing out after upgrading from 4.7.0 and above
MySQL and SQLite
upsert():Internal error: Attempted to serialize empty result.MySQL
upsert():Internal error: Attempted to serialize empty result.MongoDB
upsert():Internal error: Attempted to serialize empty result.MongoDB
upsert():Internal error: Attempted to serialize empty resultRelation mode +
upsert():Internal error: Attempted to serialize empty result.
5.12.1
4 Apr 2024Today, we are issuing the
5.12.1patch release to fix two small problems with our new Cloudflare D1 support.Fixes in Prisma CLI
Windows-only fix for new D1 specific flags for
migrate diffanddb pullThe flags
--from-local-d1and--to-local-d1formigrate diffand--local-d1todb pullwe added in 5.12.0 were not working as expected when running on Windows only. This is now fixed.📚 Documentation: Deploying a Cloudflare worker with D1 and Prisma ORM
New option for
migrate diff:-oor--outputWe added a new parameter
--outputtomigrate diffthat can be used to provide a filename into which the output of the command will be written. This is particularly useful for Windows users, using PowerShell, as using>to write into a file creates a UTF-16 LE file that can not be read bywrangler d1 migrations apply. Using this new option, this problem can be avoided:npx prisma migrate diff --script --from-empty --to-schema-datamodel ./prisma/schema.prisma --output ./schema.sql
Related issues:
5.12.0
2 Apr 2024Today, we are excited to share the
5.12.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or posting on X about the release.
Highlights
Cloudflare D1 (Preview)
This release brings Preview support for Cloudflare D1 with Prisma ORM 🥳
D1 is Cloudflare’s SQLite database that can be used when deploying applications with Cloudflare.
When using Prisma ORM with D1, you can continue to: model your database with Prisma schema language, specify
sqliteas your database provider in your Prisma schema, and interact with your database using Prisma Client.To use Prisma ORM and D1 on Cloudflare Workers or Cloudflare Pages, you need to set
sqliteas your database provider and use the@prisma/adapter-d1database adapter via thedriverAdaptersPreview feature, released back in version 5.4.0.Here is an example of sending a query to your D1 database using Prisma Client in your Worker:
// src/index.ts file import { PrismaClient } from '@prisma/client' import { PrismaD1 } from '@prisma/adapter-d1' // Add the D1Database to the Env interface export interface Env { // This must match the binding name defined in your wrangler.toml configuration DB: D1Database } export default { async fetch( request: Request, env: Env, ctx: ExecutionContext ): Promise<Response> { // Make sure the database name matches the binding name in wrangler.toml and Env interface const adapter = new PrismaD1(env.DB) // Instantiate PrismaClient using the PrismaD1 driver adapter const prisma = new PrismaClient({ adapter }) const users = await prisma.user.findMany() const result = JSON.stringify(users) return new Response(result) }, }📚 Documentation: D1 Documentation
✍️ Blog post: Build Applications at the Edge with Prisma ORM & Cloudflare D1 (Preview)
📣 Share your feedback: D1 Driver Adapter
🚀 Example project: Deploy a Cloudflare Worker with D1
createMany()for SQLiteBringing support for
createMany()in SQLite has been a long-awaited feature ⭐createMany()is a method on Prisma Client, released back in version 2.16.0, that lets you insert multiple records into your database at once. This can be really useful when seeding your database or inserting bulk data.Here is an example of using
createMany()to create new users:const users = await prisma.user.createMany({ data: [ { name: 'Sonali', email: 'sonali@prisma.io' }, { name: 'Alex', email: 'alex@prisma.io' }, { name: 'Yewande', email: 'yewande@prisma.io' }, { name: 'Angelina', email: 'angelina@prisma.io' }, ], })Before this release, if you wanted to perform bulk inserts with SQLite, you would have most likely used
$queryRawUnsafeto execute raw SQL queries. But now you don’t have to go through all that trouble 🙂With SQLite,
createMany()works exactly the same way from an API standpoint as it does with other databases except it does not support theskipDuplicatesoption. At the behavior level, SQLite will splitcreateMany()entries into multipleINSERTqueries when the model in your schema contains fields with attributes like@default(dbgenerated())or@default(autoincrement())and when the fields are not consistently provided with values across the entries.📚Documentation:
createMany()- Prisma Client API ReferenceFixes and Improvements
Prisma Client
5.11.0
12 Mar 2024Vercel Edge Functions and Vercel Edge Middleware
Cloudflare Workers and Cloudflare Pages
Neon Serverless Driver (for PostgreSQL databases hosted via Neon)
Today, we are excited to share the
5.11.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release.
Highlights
Edge function support for Cloudflare and Vercel (Preview)
We’re thrilled to announce that support for edge function deployments with Prisma ORM is now in Preview 🥳 As of this release, you can deploy your apps that are using Prisma ORM to:
Vercel Edge Functions and Vercel Edge Middleware
Cloudflare Workers and Cloudflare Pages
In order to deploy to an edge function, you’ll need to use a compatible database driver (along with its Prisma driver adapter):
Neon Serverless Driver (for PostgreSQL databases hosted via Neon)
PlanetScale Serverless Driver (for MySQL databases hosted via PlanetScale)
pgdriver (for traditional PostgreSQL databases)@libsql/clientdriver (for SQLite databases hosted via Turso)
Check out our documentation to learn how you can deploy an edge function using any combination of supported edge function provider and database.
You can also read more about it in the announcement blog post!
Performance improvements in nested
createoperationsWith Prisma ORM, you can create multiple new records in nested queries, for example:
const user = await prisma.user.update({ where: { id: 9 }, data: { name: 'Elliott', posts: { create: { data: [{ title: 'My first post' }, { title: 'My second post' }], }, }, }, })In previous versions, Prisma ORM would translate this into multiple SQL
INSERTqueries, each requiring its own roundtrip to the database. As of this release, these nestedcreatequeries are optimized and theINSERTqueries are sent to the database in bulk in a single roundtrip. These optimizations apply to one-to-many as well as many-to-many relations.With this change, using the nested
createoption to create multiple records effectively becomes equivalent to using a nestedcreateManyoperation (except thatcreateManyonly works with one-to-many relations, whereascreateworks both with one-to-many and many-to-many).Note: Only the deepest nested operation is optimized. If a user specified
create (1) -> create (2) -> create (3)in their query, onlycreate (3)will be optimized.Fixes and improvements
Prisma Client
Prisma errors when not using the major.minor.patch versioning system
mongodb where condition resulted in combined $ne but should not be $eq
Regression: Mapped
enumthrows error (collationcp1250_czech_csor similar)Running
prisma generateon Litespeed Web Server cPanel with sshPrisma doesn't know which engines to download for the Linux distro "guttaos"
Error in driver-adapter-utils with
tsc:Cannot find namespace 'debug'.VS Code debugger freeze from time to time, when Prisma Client is involved
pushmethod still unimplemented for scalar lists in CockroachDB
Prisma Migrate
Error when run
npx prisma db pullwith DeepinOS 20.9GNU/LInuxPrisma doesn't know which engines to download with
Linux MintError: Invalid characterwhenschema.prismaincludes Chinese/Non-ASCII characters in a comment
Prisma Engines