prisma/prisma
Compare Source
Today, we are issuing the 4.8.1
patch release.
Fixe in Prisma Client
Compare Source
π Help us spread the word about Prisma by starring the repo or tweeting about the release. π
Highlights
Improved serverless experience β smaller engines size
In this release, we have decreased the size of our engine files by an average of 50%. The size of the Query Engine used on Debian, with OpenSSL 3.0.x, for example, went from 39MB to 14MB. We will also remove some smaller engines to decrease the total size in future versions.
Additionally, we have started optimizing how the Prisma schema is loaded in Prisma Client. You should notice a considerable improvement when executing the first query if you're working with a bigger schema with many models and relations.
We will continue investing in this direction in the next releases and further improve the experience with Prisma and serverless environments.
Multi-schema support for CockroachDB (Preview)
We're pleased to share that this release adds Preview support for multi-schema for CockroachDB. π
This release adds support for:
- Introspecting databases that organize objects in multiple database schemas
- Managing multi-schema database setups directly from Prisma schema
- Generating migrations that are database schema-aware with Prisma Migrate
- Querying across multiple database schemas with Prisma Client
If you already have a CockroachDB database using multiple schemas, you can quickly get up and running set up multiple schemas by:
- Enabling the Preview feature in the Prisma schema
- Defining the schemas in the
schemas
property in the datasource
block
- Introspecting your database using
prisma db pull
You can further evolve your database schema using the multi-schema Preview feature by using prisma migrate dev
.
For further details, refer to our documentation and let us know what you think in this GitHub issue.
Improved OpenSSL 3.x support
Prisma now supports OpenSSL 3 builds for Linux Alpine on x86_64
architectures. This particularly impacts users running Prisma on node:alpine
and node:lts-alpine
Docker images. The images are based on an Alpine version that ships with OpenSSL 3.0.x, which isnβt compatible with OpenSSL 1.1.x (already supported by Prisma). You can read more details about it in this GitHub comment.
We also have rewritten our OpenSSL version detection logic, making it future-proof. We now expect Prisma to support systems running with any OpenSSL 3 minor versions out of the box.
Fixes and improvements
Prisma
Prisma Migrate
Prisma Client
Language tools (e.g. VS Code)
Prisma Engines
Credits
Huge thanks to @βivan, @βMini256, @βcmd-johnson for helping!
Prisma Help Center (New)
We recently just launched our Help Center that you can use to find resources and get help from our support team for both the Prisma ORM and the Prisma Data Platform.
Check it out, and let us know what you think.
πΊ Join us for another "What's new in Prisma" live stream
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, December 22 at 5 pm Berlin | 8 am San Francisco.
Compare Source
Today, we are issuing the 4.7.1
patch release.
Fixes in Prisma Client
Compare Source
π Help us spread the word about Prisma by starring the repo or tweeting about the release. π
Highlights
Interactive transactions are now Generally Available
After an extensive Preview phase and lots of great feedback from our community, we're excited to announce that interactiveTransactions
is now Generally Available and production ready! π
Interactive transactions allow you to pass an async function into a $transaction
, and execute any code you like between the individual Prisma Client queries. Once the application reaches the end of the function, the transaction is committed to the database. If your application encounters an error as the transaction is being executed, the function will throw an exception and automatically rollback the transaction.
Here are some of the feature highlights we've built:
Here's an example of an interactive transaction with a Serializable
isolation level:
await prisma.$transaction(
async (prisma) => {
// Your transaction...
},
{
isolationLevel: Prisma.TransactionIsolationLevel.Serializable,
maxWait: 5000,
timeout: 10000,
}
)
You can now remove the interactiveTransactions
Preview feature in your schema.
Relation mode is Generally Available
This release marks relationMode="prisma"
as stable for our users working with databases that don't rely on foreign keys to manage relations. π
Prismaβs relation mode started as a way to support PlanetScale which does not allow you to create foreign keys for better online migration support. We transformed that into our Referential Integrity Emulation in 3.1.1
when we realised that more users could benefit from it, and then integrated it as the default mode for MongoDB, which generally does not have foreign keys. Prisma needed to use emulation to give the same guarantees.
We then realized the feature was more than just referential integrity and affected how relations work. To reflect this, we renamed the feature to relation mode and the datasource
property to relationMode
in 4.5.0
Index warnings for relationMode = "prisma"
In this release, we've added a warning to our Prisma schema validation that informs you that the lack of foreign keys might result in slower performance β and that you should add an @@​index
manually to your schema to counter that. This ensures your queries are equally fast in relation mode prisma
as they are with foreign keys.
With relationMode = "prisma"
, no foreign keys are used, so relation fields will not benefit from the index usually created by the relational database under the hood. This can lead to slower performance when querying these fields. We recommend manually adding an index.
We also added a fix to our VS Code extension to help adding the suggested index with minimal effort:
If you are currently using the Preview feature flag to enable relation mode, you can now remove referentialIntegrity
from the previewFeatures
in your generator client
block in your Prisma schema.
For more information, check out our updated relation mode documentation.
Prisma Client Extensions (Preview)
This release adds Preview support for Prisma Client Extensions. This feature introduces new capabilities to customize and extend Prisma Client. Today we are opening up four areas for extending Prisma Client:
Prisma Client Extensions are self-contained scripts that can tweak the behavior of models, queries, results, and the client (Prisma Client) as a whole. You can associate a single or multiple extensions with an extended client to mix and match Prisma to your needs.
Prisma Client Extensions enables many use cases such as defining virtual fields, custom validation, and custom queries.
It also enables you to share your client extensions with others and import client extensions developed by others into your project.
For example, given the following schema:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["clientExtensions"]
}
model User {
id Int @​id @​default(autoincrement())
email String @​unique
firstName String?
lastName String
}
You can create a computed field called fullName
as follows:
import { PrismaClient } from "@​prisma/client"
const prisma = new PrismaClient()
.$extends({
result: {
user: {
fullName: {
// the dependencies
needs: { firstName: true, lastName: true },
compute(user) {
// the computation logic
return `${user.firstName} ${user.lastName}`
},
},
},
},
})
We're excited to see what you build with them! For more information, check out our docs and let us know what you think in this GitHub issue.
Multi-schema support for PostgreSQL (Preview)
We're pleased to announce that this release adds support for multi-schema support for PostgreSQL. The ability to query and manage multiple database schemas has been a long-standing feature request from our community.
This release adds support for the following:
- Introspecting databases that organize objects in multiple database schemas
- Managing multi-schema database setups directly from Prisma schema
- Generating migrations that are database schema-aware with Prisma Migrate
- Querying across multiple database schemas with Prisma Client
If you already have a PostgreSQL database using multiple schemas, you can quickly get up and running using prisma db pull
β on enabling the Preview feature and specifying the schemas in the datasource
block similar to the example below.
You can get started with defining multiple schemas in your Prisma schema as follows:
generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
schemas = ["base", "transactional"]
}
model User {
id Int @​id
orders Order[]
@​@​schema("base")
}
model Order {
id Int @​id
user User @​relation(fields: [id], references: [id])
user_id Int
@​@​schema("transactional")
}
Then generate and apply the changes to your database with prisma migrate dev
.
We want to thank all our users for helping us design the feature since the early proposal on GitHub up to our current Preview release.
For further details, refer to our documentation and let us know what you think in this GitHub issue.
Request for feedback
Our Product team is currently running a survey for designing Database Views support for Prisma and we would appreciate your feedback.
Fixes and improvements
Prisma Client
Prisma
Prisma Migrate
Language tools (e.g. VS Code)
Prisma Engines
Credits
Huge thanks to @βcmd-johnson, @βjsoref, @βmiguelgargallo for helping!
Prisma Data Platform
We're working on the Prisma Data Platform β a collaborative environment for connecting apps to databases. It includes the following:
- Data Browser for navigating, editing, and querying data
- Data Proxy for your database's persistent, reliable, and scalable connection pooling.
- Query Console for experimenting with queries
Try it out. Let us know what you think!
πΊ Join us for another "What's new in Prisma" live stream
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, December 1 at 5 pm Berlin | 8 am San Francisco.
Compare Source
Today, we are issuing the 4.6.1
patch release.
Fixes in Prisma Client
Fix in Prisma Migrate
Compare Source
π Help us spread the word about Prisma by starring the repo or tweeting about the release. π
Highlights
Interactive Transactions for Prisma Data Proxy (Preview)
In 3.8.0, we disabled the interactiveTransactions
Preview feature when using the Prisma Data Proxy. This was because the API was not yet supported.
In this release, we're removing the limitation. You can now try the Preview version of interactive transactions with the Prisma Data Proxy. Re-generate Prisma Client using prisma generate --data-proxy
after enabling the Preview feature.
Note: The interactiveTransactions
Preview feature flag is still needed. We will remove this in a future version when the feature is stable.
Try it out and let us know your thoughts in our interactive transactions feedback GitHub issue.
Native database level upserts for PostgreSQL, SQLite, and CockroachDB
Prismaβs upsert is one of its most powerful and most convenient APIs. In this release, Prisma will now default to the native database upsert for PostgreSQL, SQLite, and CockroachDB whenever possible.
Prisma will use the native database upsert if:
- There are no nested queries in the
upsert
's create
and update
options
- The query modifies only one model
- There is only one unique field in the
upsert
's where
option
- The unique field in the
where
option and the unique field in the create
option have the same value
Prisma Client's upsert
operation was implemented on a Prisma-level and did not use the native database implementations like, e.g., INSERT .. ON CONFLICT .. UPDATE SET
. This allowed Prisma to also upsert nested queries.
The Prisma-implementation came at a cost. In some scenarios, it was more likely for a transaction to roll back because of a conflict when multiple upsert
operations were being executed in parallel, and the multiple queries often took longer than the native database query would have taken.
Try it out and let us know what you think. If you run into any issues, don't hesitate to create a GitHub issue.
Relation Mode improvements (Preview)
In 4.5.0, we renamed the "Referential Integrity" Preview feature to "Relation Mode". We also changed the datasource
property name of the feature to relationMode
.
In this release, we fixed all remaining known bugs of relationMode = "prisma"
and cleaned up our documentation. You can now read about Relation mode on its own documentation page which is up to date with the implementation.
If you encounter any problems please comment on our feedback issue. We plan to make this [Generally Available](https://www.pr