81When 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.
206As 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.
|As part of the move to Prisma config, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
=help: Load your .env files yourself, for example with dotenv, before running Prisma commands.
155Currently, 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.
note[1]:The Rust-free ESM Prisma Client is now the default for new projects, with smaller bundles and faster queries.release-notes:13
note[2]:Enum members can now use the @map attribute to set their runtime values.release-notes:278
note[3]:The Prisma CLI now ships the new Prisma Studio, which can inspect remote databases with the --url flag.release-notes:302
note[4]:Prisma Accelerate is now a caching layer, while connection pooling is built into Prisma Postgres.release-notes:317
release-notesgithub.com/prisma/orm · 346 lines
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](https://pris.ly/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](https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-6), 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` :
```diff
// 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
```tsx
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:
```tsx
// 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 removed
- `new PrismaClient({datasourceUrl: ..})` support has been removed
- `new PrismaClient()` support has been removed
- `new PrismaClient({})` support has been removed
For Prisma Accelerate users:
```tsx
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.
```groovy
// 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:
```tsx
// 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:
```bash
# for prisma-client-js users only
npm install @prisma/client-runtime-utils
```
### Removal of implicit Prisma commands
In previous releases, Prisma would run `generate` and `seed` in various situations:
- post-install hook would run `prisma generate`
- `prisma migrate` would run `prisma generate` and `prisma 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-proxy`
- `prisma generate --accelerate`
- `prisma generate --no-engine`
- `prisma 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:
```ts
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.
- 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.
- `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. Our `listLocalDatabases` helper function can be used for that, analogously to the `db pull --local-d1` example above (where the user sets the datasource URL to `file://${listLocalDatabases().pop()}`)
### 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` ⇒ `PrismaBetterSqlite3`
- `PrismaD1HTTP` ⇒ `PrismaD1Http`
- `PrismaLibSQL` ⇒ `PrismaLibSql`
- `PrismaNeonHTTP` ⇒ `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.url` is now configured in the config file
- `datasource.shadowDatabaseUrl` is now configured in the config file
- `datasource.directUrl` has been made unnecessary and has removed
- `generator.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 removed
- `adapter` has been removed
A brief before/after:
```groovy
// schema.prisma
datasource db {
provider = "postgresql"
url = ".."
directUrl = ".."
shadowDatabaseUrl = ".."
}
```
```tsx
// ./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:
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)
- `DataProxyEngine` and `AccelerateEngine` (Accelerate uses a new `RemoteExecutor` now)
- `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](https://github.com/prisma/prisma/pull/28493): Stop shimming `WeakRef` in Cloudflare Workers. This will now avoid any unexpected memory leaks.
- [#28297](https://github.com/prisma/prisma/pull/28297): Remove hardcoded URL validation. Users are now required to make sure they don’t include sensitive information in their config files.
- The following Prisma-specific environment variables have been removed
- `PRISMA_CLI_QUERY_ENGINE_TYPE`
- `PRISMA_CLIENT_ENGINE_TYPE`
- `PRISMA_QUERY_ENGINE_BINARY`
- `PRISMA_QUERY_ENGINE_LIBRARY`
- `PRISMA_GENERATE_SKIP_AUTOINSTALL`
- `PRISMA_SKIP_POSTINSTALL_GENERATE`
- `PRISMA_GENERATE_IN_POSTINSTALL`
- `PRISMA_GENERATE_DATAPROXY`
- `PRISMA_GENERATE_NO_ENGINE`
- `PRISMA_CLIENT_NO_RETRY`
- `PRISMA_MIGRATE_SKIP_GENERATE`
- `PRISMA_MIGRATE_SKIP_SEED`
### Mapped enums
If [you followed along on twitter](https://x.com/prisma/status/1988970132690071600), you will have seen that we teased a highly-request user feature was coming to v7.0. That highly-requested feature is…. mapped emuns! We now support the `@map` attribute for enum members, which can be used to set their expected runtime values
```groovy
enum PaymentProvider {
MixplatSMS @map("mixplat/sms")
InternalToken @map("internal/token")
Offline @map("offline")
@@map("payment_provider")
}
```
```tsx
export const PaymentProvider: {
MixplatSMS: 'mixplat/sms'
InternalToken: 'internal/token'
Offline: 'offline'
}
```
## New Prisma Studio comes to the CLI
We launched a new version of Prisma Studio to our Console and VS Code extension a while back, but the Prisma CLI still shipped with the older version.
Now, with v7.0, we’ve updated the Prisma CLI to include the new Prisma Studio. Not only are you able to inspect your database, but you get rich visualization to help you understand connected relationships in your database. It’s customizable, much smaller, and can inspect remote database by passing a `--url` flag. This new version of Prisma Studio is not tied to the Prisma ORM, and establishes a new foundation for what comes next.
Currently, the new studio only supports Postgres, MySQL, and SQLite, with support for other databases coming in a future release.
For issues related to Prisma Studio, please direct them to the [Studio repo on github](https://github.com/prisma/studio).
[Prisma Postgres](https://www.prisma.io/postgres) is our managed Postgres service, designed with the same philosophy of great DX that has guided Prisma for close to a decade. It works great with serverless, it’s fast, and with simple pricing and a generous free tier. Here’s what’s new:
### Connection Pooling Changes with Prisma Accelerate
With support for connection pooling being added natively to Prisma Postgres, Prisma Accelerate now serves as a dedicated caching layer. If you were using Accelerate for the connection pooling features, don’t worry! Your existing connection string via Accelerate will continue to work, and you can switch to the new connection pool when you’re ready.
### Simplified connection flow
We've made connecting to Prisma Postgres even simpler. Now, when you go to connect to a database, you’ll get new options to enable connection pooling, or to enable Prisma Accelerate for caching. Below, you’ll get code snippets for getting things configured in your project right away.
For those who want to connect to Prisma Postgres but are deploying to environments like Cloudflare Workers, we have a new version of the serverless client library to support these runtimes.
- Compatible with Cloudflare Workers, Vercel Edge Functions, Deno Deploy, AWS Lambda, and Bun
- Stream results row-by-row to handle large datasets with constant memory usage
- Pipeline multiple queries over a single connection, reducing latency by up to 3x
- SQL template literals with automatic parameterization and full TypeScript support
- Built-in transactions, batch operations, and extensible type system
[Check out the serverless driver docs](https://www.prisma.io/docs/postgres/database/serverless-driver) for more details
## 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](https://www.prisma.io/careers#current) 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.