Today, we are excited to share the 3.3.0
stable release 🎉
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements & new features
Prisma Data Proxy support in Prisma Client in Early Access, now with support for Cloudflare Workers
In 3.3.0
, we're releasing Early Access support for Prisma Client connection pooling using Prisma Data Proxy. The Data Proxy feature of the Prisma Data Platform is now accessible to all users of the Prisma Data Platform (no need to request access).
Solving connection management for serverless environments
Prisma Data Proxy is an intermediary between your app and your database. It manages connection pooling, so you can reliably use traditional databases in Serverless environments.
Users can configure a Data Proxy for free on the Prisma Data Platform and connect their Prisma applications to the proxy by enabling the feature flag for it in their code.
For detailed documentation and instructions please refer to pris.ly/data-proxy.
Running Prisma applications in Cloudflare Workers
Using this new feature in Prisma Client and leveraging the Prisma Data Proxy, developers can now deploy Prisma applications on Cloudflare Workers. Here's what it looks like to use Prisma Client inside of this environment:
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request: Request): Promise<Response> {
await prisma.log.create({
data: {
level: 'Info',
message: `${request.method} ${request.url}`,
},
})
return new Response(`request method: ${request.method}!`)
}
Follow this deployment guide to learn how to use Prisma Client with your own Cloudflare Workers. If you run into any problems, you can reach us in this issue!
MongoDB
Support for ordering by relation fields
In 2.16.0
, we first introduced ordering by a relation for relational databases. As of today's release, you can now order by a relation field in MongoDB as well:
// Return a list of posts ordered by the author's email address
// in ascending order.
await prisma.post.findMany({
orderBy: {
author: {
email: "asc",
},
},
})
Learn more in our documentation.
MongoDB 5 is now supported
Prisma now supports connecting to MongoDB 5 databases. Take advantage of the latest and greatest from the fine folks at MongoDB HQ!
Fixed optional timestamp column creation for MySQL in Prisma Migrate
When working with optional timestamp fields in MySQL, there were cases where the database implicitly set the column to NOT NULL
. To fix this behavior, we are now explicitly creating the columns as nullable.
You can find the full details about this change on GitHub.
Prisma Client Go now supports scalar list operations
With 3.3.0
, you can now filter and atomically update scalar lists with Prisma Client Go.
Given the following Prisma schema:
model User {
id Int @id @default(autoincrement())
name String
pets String[]
}
You can filter pets with the following code:
user, err := client.User.FindFirst(
db.User.Pets.HasSome([]string{"Fido", "Scooby"}),
).Exec(ctx)
And when you add a new furry addition to your family, you can update your list with Push
:
user, err := client.User.FindUnique(
db.User.Name.Equals(1),
).Update(
db.User.Items.Push([]string{"Charlemagne"}),
).Exec(ctx)
Learn more about how to use this new feature in our documentation. To dive deeper into the concept of scalar lists, you can read the guide on Working with scalar lists.
Fixes and improvements
Prisma Migrate
- Error: [libs/datamodel/connectors/dml/src/model.rs:161:64] Could not find relation field clubs_clubsTousers on model User.
- Error: [libs/datamodel/connectors/dml/src/model.rs:161:64] Could not find relation field Trade_OrderToTrade on model Order.
- Support for application_name argument in connection URL for postgres
- Revise CONTRIBUTING.md
- MDBE: Adjust the parser to support the new complex
type
construct - Constraint names are not validated against different constraint types
- Patch releases: Creation of tags on prisma-engines fails
- thread '' panicked at 'Every RelationInfo should have a complementary RelationInfo on the opposite relation field.'
- Add ESM compatible TypeScript command for db seed help output
- Re-Introspection changes order of blocks in schema (e.g. in default
schema.prisma
fromprisma init
) - Different drift/reset handling on first Migration/no migration table
- Constraint identifiers created by
prisma migrate dev
exceeding 63 characters causing errors due to truncating - 'DateTime?' does NOT create nullable field
- Remove SQL Server preview from
prisma init
- Panicked on invalid Relation
- MDBI: Update the inconsistent data warning to include an issue where people can discuss what they need
- Prisma generate started throwing that libssl.so.3 is missing (alpine 3.14, node 14)
Prisma Client
init --url ...
logs full connection URL when .env already exists- JSON field can not query for "not equals"
- MBDGA: Support Order By Relations in MongoDB
- Support MongoDB 5.0
- CFW: Add a preview feature guard in the Prisma CLI
Language tools (e.g. VS Code)
📺 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, October 21 at 5pm Berlin | 8am San Francisco.
Credits
Huge thanks to @otan for helping!