github prisma/prisma 3.3.0

latest releases: 5.13.0, 5.12.1, 5.12.0...
2 years ago

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

Prisma Client

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!

Don't miss a new prisma release

NewReleases is sending notifications on new releases.