Prisma: 3.5.0 Release

Release date:
November 15, 2021
Previous version:
3.4.2 (released November 9, 2021)
Magnitude:
336 Diff Delta
Contributors:
6 total committers
Data confidence:
Commits:

49 Commits in this Release

Ordered by the degree to which they evolved the repo in this version.

Authored November 15, 2021
Authored November 9, 2021
Authored November 9, 2021
Authored November 4, 2021
Authored November 10, 2021
Authored November 10, 2021
Authored November 15, 2021

Top Contributors in 3.5.0

millsp
prisma-bot
aqrln
janpio
Jolg42
renovate-bot

Directory Browser for 3.5.0

We haven't yet finished calculating and confirming the files and directories changed in this release. Please check back soon.

Release Notes Published

Today, we are excited to share the 3.5.0 stable release 🎉

🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟 

Major improvements & new features

Order by relevance in full text search (PostgreSQL)

In 3.5.0, we've added support for ordering full text search results by relevance. Ordering by relevance gives you a way to order search results by the best match. You can enable order by relevance and full-text search with the fullTextSearch feature flag:

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["fullTextSearch"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model People {
  id  Int    @id @default(autoincrement())
  bio String
}

While this feature is useful standalone, it's most commonly used in combination with the full text search field in the where clause:

const query = "node.js developer"
const developers = await prisma.people.findMany({
  where: {
    bio: {
      // Only select people whose bio's contain "node.js developer"
      search: query,
    },
  },
  orderBy: {
    // Order that selection by query relevance.
    _relevance: {
      fields: ["bio"],
      search: query,
      sort: "desc",
    },
  },
})

Learn more in our documentation and if you run into any issues or have feedback for us, you can reach us in this issue.

More configuration options for indexes and constraints in the Prisma schema (Preview)

We are extending the syntax in the Prisma schema to add support for configuration of length and sort order. This applies to:

  • indexes
  • unique constraints
  • primary key constraints

These new configuration options come with full support for the prisma db pull, prisma db push and prisma migrate dev commands, so index configuration can now be managed, evolved and deployed using Prisma's schema management tooling.

Two new arguments can now be specified per field:

  • length (the maximum length of items in the index)
  • sort (how an index is sorted)

In order to use these new capabilities, add the extendedIndexes feature flag in the generator block:

generator client {
  provider = "prisma-client-js"
  previewFeatures = ["extendedIndexes"]
}

The change affects the @id, @@id, @unique, @@unique and @@index fields in certain databases:

  • The length argument is available on MySQL on the @id, @@id, @unique, @@unique and @@index fields. It allows Prisma to now support indexes and constraints on String with a TEXT native type and Bytes types.
  • The sort argument is available for all databases on the @unique, @@unique and @@index fields. Additionally, SQL Server also allows it on @id and @@id.

The following example demonstrates the use of the sort and length arguments:

model Post {
    title       String @db.VarChar(300)
    abstract    String @db.VarChar(3000)
    slug        String @db.VarChar(3000) @unique(sort: Desc, length: 42)
    author      String
    created_at  DateTime

    @@id([title(length: 100, sort: Desc), abstract(length: 10)])
    @@index([author, created_at(sort: Desc)])
}

⚠️ Warning: This might be a breaking change for some users. To learn how to mitigate that, please read the documentation linked below.

Learn more in the documentation on index configuration.

Case insensitive filtering for Prisma Client Go

We've had this feature in the Prisma Client JS for awhile, but in this release, we've added case-insensitive query support to the Go Client as well. Now you can worry a bit less about what kind of data the user is going to send your way.

users, err := client.User.FindMany(
    User.Email.Equals("prisMa"),
    User.Email.Mode(QueryModeInsensitive), // sets case insensitivity
).Exec(ctx)

Learn more in our documentation.

Fixes and improvements

Prisma Client

Prisma Migrate

Prisma Engines

Language tools (e.g. VS Code)

🎉 The Serverless Data Conference is happening on Thursday (Nov 18)

Join us for the first Prisma Serverless Data Conference about all things databases and serverless. Here's an overview of the speakers at the conference:

  • Kevin Jernigan, MongoDB
  • Greg McKeon, Cloudflare
  • Jason Lengstorf, Netlify
  • Sugu Sougoumarane and Taylor Barnett, PlanetScale
  • Aydrian Howard, CockroachDB
  • Hassan El Mghari, Vercel

In addition to these fantastic talks, you can look forward to the Prisma keynote with a lot of information about the current status and upcoming plans for the Prisma Data Platform.

📺 Join us for another "What's new in Prisma" livestream

Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" livestream.

The stream takes place on Youtube on Wednesday, November 17 at 5pm Berlin | 9am San Francisco.

Note: We usually stream on Thursdays, but this week we have moved the stream to Wednesday to leave space for the Serverless Data Conference on Thursday.