Releases: prisma/prisma
7.1.0
Today, we are excited to share the 7.1.0 stable release 🎉
🌟 Star this repo for notifications about new releases, bug fixes & features — or follow us on X!
This release brings quality of life improvements and fixes various bugs.
Prisma ORM
-
#28735: pnpm monorepo issues with prisma client runtime utils
Resolves issues in pnpm monorepos where users would report TypeScript issues related to@prisma/client-runtime-utils. -
#28769: implement sql commenter plugins for Prisma Client
This PR implements support for SQL commenter plugins to Prisma Client. The feature will allow users to add metadata to SQL queries as comments following the sqlcommenter format.Here’s two related PRs that were also merged:
-
#28737: added error message when constructing client without configs
This commit adds an additional error message when trying to create a new PrismaClient instance without any arguments.
Thanks to @xio84 for this community contribution! -
#28820: mark
@opentelemetry/apias external in instrumentation
Ensures@opentelemetry/apiis treated as an external dependency rather than bundled.
Since it is a peer dependency, this prevents applications from ending up with duplicate copies of the package. -
#28694: allow
env()helper to accept interface-based generics
Updates theenv()helper’s type definition so it works with interfaces as well as type aliases.
This removes the previous constraint requiring an index signature and resolves TS2344 errors when using interface-based env types. Runtime behavior is unchanged.
Thanks to @SaubhagyaAnubhav for this community contribution!
Read Replicas extension
-
#53: Add support for Prisma 7
Users of the read-replicas extension can now use the extension in Prisma v7. You can update by installing:npm install @prisma/extension-read-replicas@latest
For folks still on Prisma v6, install version
0.4.1:npm install @prisma/extension-read-replicas@0.4.1
For more information, visit the repo
SQL comments
We're excited to announce SQL Comments support in Prisma 7.1.0! This new feature allows you to append metadata to your SQL queries as comments, making it easier to correlate queries with application context for improved observability, debugging, and tracing.
SQL comments follow the sqlcommenter format developed by Google, which is widely supported by database monitoring tools. With this feature, your SQL queries can include rich metadata:
SELECT "id", "name" FROM "User" /*application='my-app',traceparent='00-abc123...-01'*/Basic usage
Pass an array of SQL commenter plugins to the new comments option when creating a PrismaClient instance:
import { PrismaClient } from './generated/prisma/client';
import { PrismaPg } from '@prisma/adapter-pg';
import { queryTags } from '@prisma/sqlcommenter-query-tags';
import { traceContext } from '@prisma/sqlcommenter-trace-context';
const adapter = new PrismaPg({
connectionString: `${process.env.DATABASE_URL}`,
});
const prisma = new PrismaClient({
adapter,
comments: [queryTags(), traceContext()],
});Query tags
The @prisma/sqlcommenter-query-tags package lets you add arbitrary tags to queries within an async context:
import { queryTags, withQueryTags } from '@prisma/sqlcommenter-query-tags';
const prisma = new PrismaClient({
adapter,
comments: [queryTags()],
});
// Wrap your queries to add tags
const users = await withQueryTags(
{ route: '/api/users', requestId: 'abc-123' },
() => prisma.user.findMany(),
);Resulting SQL:
SELECT ... FROM "User" /*requestId='abc-123',route='/api/users'*/Use withMergedQueryTags to merge tags with outer scopes:
import {
withQueryTags,
withMergedQueryTags,
} from '@prisma/sqlcommenter-query-tags';
await withQueryTags({ requestId: 'req-123', source: 'api' }, async () => {
await withMergedQueryTags(
{ userId: 'user-456', source: 'handler' },
async () => {
// Queries here have: requestId='req-123', userId='user-456', source='handler'
await prisma.user.findMany();
},
);
});Trace context
The @prisma/sqlcommenter-trace-context package adds W3C Trace Context (traceparent) headers for distributed tracing correlation:
import { traceContext } from '@prisma/sqlcommenter-trace-context';
const prisma = new PrismaClient({
adapter,
comments: [traceContext()],
});When tracing is enabled and the span is sampled:
SELECT * FROM "User" /*traceparent='00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01'*/Note: Requires @prisma/instrumentation to be configured. The traceparent is only added when tracing is active and the span is sampled.
Custom plugins
Create your own plugins to add custom metadata:
import type { SqlCommenterPlugin } from '@prisma/sqlcommenter';
const applicationTags: SqlCommenterPlugin = (context) => ({
application: 'my-service',
environment: process.env.NODE_ENV ?? 'development',
operation: context.query.action,
model: context.query.modelName,
});
const prisma = new PrismaClient({
adapter,
comments: [applicationTags],
});Framework integration
SQL comments work seamlessly with popular frameworks, e.g., Hono:
import { createMiddleware } from 'hono/factory';
import { withQueryTags } from '@prisma/sqlcommenter-query-tags';
app.use(
createMiddleware(async (c, next) => {
await withQueryTags(
{
route: c.req.path,
method: c.req.method,
requestId: c.req.header('x-request-id') ?? crypto.randomUUID(),
},
() => next(),
);
}),
);Additional framework examples for Express, Koa, Fastify, and NestJS are available in the documentation.
For complete documentation, see SQL Comments. We'd love to hear your feedback on this feature! Please open an issue on GitHub or join the discussion in our Discord community.
Open roles at Prisma
Interested in joining Prisma? We’re growing and have several exciting opportunities across the company for developers who are passionate about building with Prisma. Explore our open positions on our Careers page and find the role that’s right for you.
Enterprise support
Thousands of teams use Prisma and many of them already tap into our Enterprise & Agency Support Program for hands-on help with everything from schema integrations and performance tuning to security and compliance.
With this program you also get priority issue triage and bug fixes, expert scalability advice, and custom training so that your Prisma-powered apps stay rock-solid at any scale. Learn more or join: https://prisma.io/enterprise.
7.0.1
Today, we are issuing a 7.0.1 patch release focused on quality of life improvements, and bug fixes.
🛠 Fixes
-
Prisma Studio:
-
Prisma CLI
- Fix potential vulnerabilities in installed dependencies (via #28592)
- Fix #28240, an exit code regression affecting
prisma migrate diff(via prisma/prisma-engines#5699) - Show informative message when
prisma db seedis run, but nomigrations.seedcommand is specified in the Prisma config file (via #28711) - Relax
enginescheck inpackage.json, to let Node.js 25+ users adopt Prisma, although Node.js 25+ isn't considered stable yet (via #28600). Thanks @Sajito!
-
Prisma Client
- Restore
cockroachdbsupport inprisma-client-jsgenerator, after it was accidentally not shipped in Prisma 7.0.0 (via #28690)
- Restore
-
@prisma/better-sqlite3
7.0.0
Today, we are excited to share the 7.0.0 stable release 🎉
🌟 Star this repo for notifications about new releases, bug fixes & features — and follow us on X!
Highlights
Over the past year we focused on making it simpler and faster to build applications with Prisma, no matter what tools you use or where you deploy, with exceptional developer experience at it’s core. This release makes many features introduced over the past year as the new defaults moving forward.
Prisma ORM
ESM Prisma Client as the default
The Rust-free/ESM Prisma Client has been in the works for some time now, all the way back to v6.16.0, with early iterations being available for developers to adopt. Now with version 7.0, we’re making this the default for all new projects. With this, developers are able to get:
- ~90% smaller bundle sizes
- Up to 3x faster queries
- Significantly simpler deployments
Adopting the new client is as simple as swapping the prisma-client-js provider for prisma-client in your main schema.prisma :
// schema.prisma
generator client {
- provider = "prisma-client-js"
+ provider = "prisma-client"
}Prisma Client changes
In v7, we've moved to requiring users pass either an adapter or accelerteUrl when creating a new instance of PrismaClient.
For Driver Adapters
import { PrismaClient } from './generated/prisma/client';
import { PrismaPg } from '@prisma/adapter-pg';
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL
});
const prisma = new PrismaClient({ adapter });For other databases:
// If using SQLite
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3';
const adapter = new PrismaBetterSqlite3({
url: process.env.DATABASE_URL || 'file:./dev.db'
})
// If using MySql
import { PrismaMariaDb } from '@prisma/adapter-mariadb';
const adapter = new PrismaMariaDb({
host: "localhost",
port: 3306,
connectionLimit: 5
});We’ve also removed support for additional options when configuring your Prisma Client
new PrismaClient({ datasources: .. })support has been removednew PrismaClient({datasourceUrl: ..})support has been removednew PrismaClient()support has been removednew PrismaClient({})support has been removed
For Prisma Accelerate users:
import { PrismaClient } from "./generated/prisma/client"
import { withAccelerate } from "@prisma/extension-accelerate"
const prisma = new PrismaClient({
accelerateUrl: process.env.DATABASE_URL,
}).$extends(withAccelerate()) Generated Client and types move out of node_modules
When running prisma generate, the generated Client runtime and project types will now require a output path to be set in your project’s main schema.prisma. We recommend that they be generated inside of your project’s src directory to ensure that your existing tools are able to consume them like any other piece of code you might have.
// schema.prisma
generator client {
provider = "prisma-client"
// Generate my Client and Project types
output = "../src/generated/prisma"
}Update your code to import PrismaClient from this generated output:
// Import from the generated prisma client
import { PrismaClient } from './generated/prisma/client';For developers who still need to stay on the prisma-client-js but are using the new output option, theres’s a new required package, @prisma/client-runtime-utils , which needs to be installed:
# for prisma-client-js users only
npm install @prisma/client-runtime-utilsRemoval of implicit Prisma commands
In previous releases, Prisma would run generate and seed in various situations:
- post-install hook would run
prisma generate prisma migratewould runprisma generateandprisma seed
This behaviour has been removed in favor of explicitly requiring commands to be run by users.
Removal of prisma generate flags
For prisma generate , we’ve removed a few flags that were no longer needed:
prisma generate --data-proxyprisma generate --accelerateprisma generate --no-engineprisma generate --allow-no-models
Removal of prisma db flags
For prisma db, we’ve removed the following flag:
prisma db pull --local-d1
This parameter no longer exists but equivalent functionality can be implemented by defining a config file with a connection string for the local D1 database. We provide a helper function listLocalDatabases in the D1 adapter to simplify the migration:
import { defineConfig } from '@prisma/config'
import { listLocalDatabases } from '@prisma/adapter-d1'
export default defineConfig({
datasource: {
url: `file://${listLocalDatabases().pop()}`,
},
})Removal of prisma migrate flags
For prisma migrate diff, we’ve removed the following flags:
prisma --[from/to]-schema-datamodel- This is now replaced with just
--[from/to]-schema. The usage is otherwise the same.
- This is now replaced with just
prisma --[from/to]-url,prisma --[from/to]-schema-datasource- These are now replaced with
--[from/to]-config-datasource. The user is expected to populate the datasource in the config file and use the new flag. We no longer support diffing two different URLs/datasources, since only one config can be used at a time.
- These are now replaced with
prisma --[from/to]-local-d1- These are now replaced with
--[from/to]-config-datasource. The user is expected to populate the datasource in the config file and use the new flag with a minor complication due to the fact that it needs to reference the local D1 database. OurlistLocalDatabaseshelper function can be used for that, analogously to thedb pull --local-d1example above (where the user sets the datasource URL tofile://${listLocalDatabases().pop()})
- These are now replaced with
MongoDB support in Prisma 7
Currently, MongoDB is not supported in Prisma 7. For folks using MongoDB, please stay on Prisma v6. We aim to add support for MongoDB in a future release.
Driver Adapter naming updates
We’ve standardized our naming conventions for the various driver adapters internally. The following driver adapters have been updated:
PrismaBetterSQLite3⇒PrismaBetterSqlite3PrismaD1HTTP⇒PrismaD1HttpPrismaLibSQL⇒PrismaLibSqlPrismaNeonHTTP⇒PrismaNeonHttp
Schema and config file updates
As part of a larger change in how the Prisma CLI reads your project configuration, we’ve updated what get’s set the schema, and what gets set in the prisma.config.ts . Also as part of this release, prisma.config.ts is now required for projects looking to perform introspection and migration.
Schema changes
datasource.urlis now configured in the config filedatasource.shadowDatabaseUrlis now configured in the config filedatasource.directUrlhas been made unnecessary and has removedgenerator.runtime=”react-native”has been removed
For early adopters of the config file, a few things have been removed with this release
engine: 'js'| 'classic'has been removedadapterhas been removed
A brief before/after:
// schema.prisma
datasource db {
provider = "postgresql"
url = ".."
directUrl = ".."
shadowDatabaseUrl = ".."
}// ./prisma.config.ts
export default defineConfig({
datasource: {
url: '..',
shadowDatabaseUrl: '..',
}
})Explicit loading of environment variables
As part of the move to Prisma config, we’re no longer automatically loading environment variables when invoking the Prisma CLI. Instead, developers can utilize libraries like dotenv to manage their environment variables and load them as they need. This means you can have dedicated local environment variables or ones set only for production. This removes any accidental loading of environment variables while giving developers full control.
Removed support for prisma keyword in package.json
In previous releases, users could configure their schema entry point and seed script in a prisma block in the package.json of their project. With the move to prisma.config.ts, this no longer makes sense and has been removed. To migrate, use the Prisma config file instead:
{
"name": "my-project",
"version": "1.0.0",
"prisma": {
"schema": "./custom-path-to-schema/schema.prisma",
"seed": "tsx ./prisma/seed.ts"
}
}import 'dotenv/config'
import { defineConfig, env } from "prisma/config";
export default defineConfig({
schema: "prisma/schema.prisma",
migrations: {
seed: "tsx prisma/seed.ts"
},
datasource: {...},
});Removed Client Engines:
We’ve removed the following client engines:
LibraryEngine(engineType = "library", the Node-API Client)BinaryEngine(engineType = "binary", the long-running executable binary)DataProxyEngineandAccelerateEngine(Accelerate uses a newRemoteExecutornow)ReactNativeEngine
Deprecated metrics feature has been removed
We deprecated the previewFeature metrics some time ago, and have removed it fully for version 7. If you need metrics related data available, you can use the underlying driver adapter itself, like the Pool metric from the Postgres driver.
Miscellaneous
- #28493: Stop shimming
WeakRefin Cloudflare Workers. This will now avoid any unexpected memory leaks. - #28297: Remove hardcoded URL validation. Users are now required to make sure they don’t include sensitive information in their config files.
- [#28273](https://github.com/pris...
6.19.0
Today, we are excited to share the 6.19.0 stable release 🎉
🌟 Star this repo for notifications about new releases, bug fixes & features — or follow us on X
Highlights
This release brings a lot of bug fixes and improvements to both the ORM and Prisma Postgres.
Prisma ORM
Prisma ORM is the most popular ORM in the TypeScript ecosystem. Today’s release brings a bunch of new bug fixes and overall improvements:
- #5675: When dropping a model from a schema, do not append the default schema to the migration.
- #5656: Align naming conventions for fields and relation fields
- #28341: Add biome ignore comments to generated client files. This was a community contribution from @lonelyevil, thank you!
Prisma Postgres
Prisma Postgres is our fully managed Postgres service, designed with the same philosophy of great DX that has guided Prisma for close to a decade. With this release, we are introducing the following improvements:
Connection pooling with Prisma Postgres
We added support for direct connections in 6.17, opening Prisma Postgres up to working with any tool in the wider Postgres ecosystem. Now, you can confirm that connection to support connection pooling by appending the query parameter pool=true to the connection string.
postgres://555555..../postgres?sslmode=require&pool=true
VS Code extension
A frequently requested feature is to be able to use a local Prisma Postgres database within our VS Code Extension without having to log in. In this release, we’re happy to share that this is now supported! Now you can work on your project without having to connect to the database remotely.
#1924: previewFeatures = "" suggestion results in "[]" value
Preparing for Prisma v7
Prisma v7 is almost here, and we’ve been making many of the feature in it available ahead of its release. If you haven’t been keeping your version of prisma, @prisma/client up to date, now is the time to do so before the release. Many of the changes we’ve introduced over the 6.x release cycle will become the default in v7.
- Unified Prisma Config for project configuration
- Move from
prisma-client-jsprisma-client - New
engineanddatasourcekeys inprisma.config.ts
Open roles at Prisma
Interested in joining Prisma? We’re growing and have several exciting opportunities across the company for developers who are passionate about building with Prisma. Explore our open positions on our Careers page and find the role that’s right for you.
Enterprise support
Thousands of teams use Prisma and many of them already tap into our Enterprise & Agency Support Program for hands-on help with everything from schema integrations and performance tuning to security and compliance.
With this program you also get priority issue triage and bug fixes, expert scalability advice, and custom training so that your Prisma-powered apps stay rock-solid at any scale. Learn more or join: https://prisma.io/enterprise.
6.18.0
Today, we are excited to share the 6.18.0 stable release 🎉
🌟 Star this repo for notifications about new releases, bug fixes & features — or follow us on X!
Prisma ORM
Prisma ORM is the most popular ORM in the TypeScript ecosystem. Today’s release brings a bunch of new bug fixes and overall improvements:
prisma initnow creates aprisma.config.tsautomatically
When creating a new project with 6.18.0, prisma init will now create a prisma.config.ts file automatically. This prepares new applications for the future of Prisma 7. Some fields that have been historically set in the schema.prisma file are now able to be set in the prisma.config.ts, and we encourage people to migrate over to the new structure before the release of version 7, where this file will become a requirement.
- Support for defining your
datasourceinprisma.config.ts
If you’re adopting the new prisma.config.ts setup in your projects, version 6.18.0 brings the ability to set your datasource directly in your config file. Once this is in your config file, any datasource set in your schema.prisma will be ignored. To set the datasource, we also must include the new engine key which we can set to "classic" , which will be required for Prisma v7
import { defineConfig, env } from "prisma/config";
export default defineConfig({
// The Rust-compiled schema engine
engine: "classic",
datasource: {
url: env('DATABASE_URL'),
}
});- #28291 Support multiple Prisma instances with different providers
- #28305 Add
envhelper function - #28266 Add support for
jsorclassicas engine types inprisma.config - #28139 Map
BytestoUint8Arraydepending on Typescript version
Preparing for Prisma v7
While it has been mentioned a few times already, many of the changes in this release are here to prepare folks for the upcoming release of Prisma v7. It’s worth repeating that these changes and the migration to prisma.config.ts will be required for Prisma v7, so we’re releasing this as opt-in features for developers. But come Prisma v7, they will be the new way of configuring your project.
Prisma Postgres
Prisma Postgres is our fully managed Postgres service designed with the same philosophy of great DX that has guided Prisma for close to a decade. With this release we are introducing the following improvements:
Database Metric in Console
Inside of your database console, you can now view metrics on your database usage and interactions. You can get insights into the follow:
- Total egress
- Average response size
- Average query duration
In addition, you can also get insights into how to improve your query caching and gain better performance.
Open roles at Prisma
Interested in joining Prisma? We’re growing and have several exciting opportunities across the company for developers who are passionate about building with Prisma. Explore our open positions on our Careers page and find the role that’s right for you.
Enterprise support
Thousands of teams use Prisma and many of them already tap into our Enterprise & Agency Support Program for hands-on help with everything from schema integrations and performance tuning to security and compliance.
With this program you also get priority issue triage and bug fixes, expert scalability advice, and custom training so that your Prisma-powered apps stay rock-solid at any scale. Learn more or join: https://prisma.io/enterprise.
6.17.1
Today, we are issuing a patch release to address a regression in v6.17.0 that affected diffing of unsupported types, leading to unnecessary or incorrect changes when creating new migrations or running db pull. This update is recommended for all users who have any fields marked as Unsupported in their schema files.
Changes
6.17.0
Today, we are excited to share the 6.17.0 stable release 🎉
🌟 Star this repo for notifications about new releases, bug fixes & features — or follow us on X!
Prisma ORM
Prisma ORM is the most popular ORM in the TypeScript ecosystem. Today's release brings a number of bug fixes and improvements to Prisma ORM.
Bug fixes and improvements
- Added support for Entra ID (ActiveDirectory) authentication parameters for the MS SQL Server driver adapter. For example, you can use the
configobject to configure DefaultAzureCredential:Learn more in this PR.import { PrismaMssql } from '@prisma/adapter-mssql' import { PrismaClient } from '@prisma/client' const config = { server: 'localhost', port: 1433, database: 'mydb', authentication: { type: 'azure-active-directory-default', }, options: { encrypt: true, }, } const adapter = new PrismaMssql(config) const prisma = new PrismaClient({ adapter })
- Relaxed the support package range for
@opentelemetry/instrumentationto be compatible with">=0.52.0 <1". Learn more in this PR. - Added Codex CLI detection, ensuring dangerous Prisma operations are not executed by Codex without explicit user consent. Learn more in this PR.
- Fixed JSON column handling when using a MariaDB database. Learn more in this PR.
- Restored the original behaviour of group-by aggregations where they would refer to columns with explicit table names which fixes a regression that would result in ambiguous column errors. Learn more in this PR.
Prisma Postgres
Prisma Postgres is our fully managed Postgres service designed with the same philosophy of great DX that has guided Prisma for close to a decade. With this release we are introducing the following improvements:
New usage workspace metrics available in your Console Dashboard
The Dashboard in your Prisma Console account now displays new metrics about your Prisma Postgres usage:
- Key metrics
- Estimated upcoming invoice
- Total storage used
- Total DBs
- Overall usage
- Cumulative operations
- Operations per day
Using Prisma Postgres with any tool is ready for production
Previously, the only way to connect to Prisma Postgres was using Prisma ORM. That combination is great because it gives you connection pooling, global caching and overall an amazing DX.
That being said, we understand that preferences vary and some developers prefer to use plain SQL or lower-level query builders in their applications. As of this release, these ways for connecting to Prisma Postgres are now officially generally available and can be used in your production apps!
You can connect using Drizzle, Kysely, TypeORM, psql, or any other Postgres-compatible library, database migration tools like Atlas or interfaces like DBeaver, Postico, and more.
📚 Learn more in the docs.
Enterprise support
Thousands of teams use Prisma and many of them already tap into our Enterprise & Agency Support Program for hands-on help with everything from schema integrations and performance tuning to security and compliance.
With this program you also get priority issue triage and bug fixes, expert scalability advice, and custom training so that your Prisma-powered apps stay rock-solid at any scale. Learn more or join: https://prisma.io/enterprise.
6.16.3
Today, we are issuing a 6.16.3 patch release focused on bug fixes.
🛠 Fixes
-
Prisma Client (
prisma-clientgenerator): fixed missing JSON null type definitions (JsonNull,DbNull,AnyNull) in thebrowser.tsentrypoint. (#28186) -
Prisma Migrate: don't add the default schema (namespace) to the generated migrations unless it was specified explicitly in the schema file. This restores the pre-6.13.0 behaviour that was inadvertently changed with enabling multi-schema support by default. Users who rely on database schemas for multi-tenancy can now again use the same migration files for all of their schemas. (prisma/prisma-engines#5614)
-
Prisma Client: enabled negative
takewithfindFirstagain. (prisma/prisma-engines#5616 — contributed by @jay-l-e-e) -
Prisma Accelerate: aligned the behaviour of the new Rust-free client with Query Engine to handle self-signed certificates consistently and ensure backward compatibility. (#28134)
-
@prisma/adapter-mariadb: fixed error event listeners leak. (#28177 — contributed by @Tiaansu)
⚠️ Known Limitation: JSON null types in browser builds
The fix introduces the missing types, but the singleton instances differ between the client and browser entrypoints of the generated client. This means that values like Prisma.JsonNull imported from browser cannot yet be assigned to fields expected from the client entrypoint, and vice versa. This results in confusing TypeScript errors if you mix them. A follow-up improvement is planned to unify these utility types across entrypoints.
6.16.2
Today, we are issuing a 6.16.2 patch release.
Bug fixes
- In Prisma ORM 6.16.0, we've enabled usage of the new
engineType = clientwith Prisma Postgres, but our validation rules permitted invalid combinations of Prisma Postgres URLs and driver adapters. This now produces a clear error message indicating Prisma Postgres URLs and driver adapters are mutually exclusive. - In the previous minor release, we've included a change that calls
unref()on NodeJS timers to prevent them from keeping the NodeJS event loop active. This change unintentionally affected non-NodeJS runtimes likeworkerd, where it has resulted in runtime errors. This behavior has been made conditional to prevent these runtime errors.
6.16.1
Today, we are issuing a 6.16.1 patch release.
Bug fixes
- In Prisma ORM 6.16.0, the
driverAdaptersandqueryCompilerfeatures were stabilized, but leftover code in theprisma-client-tsgenerator required them to still be specified in edge runtimes. This has now been fixed, runtimes likeworkerdandvercel-edgeno longer require these preview features.