Prisma: 2.8.0 Release

Release date:
September 29, 2020
Previous version:
2.7.1 (released September 16, 2020)
Magnitude:
5,205 Diff Delta
Contributors:
8 total committers
Data confidence:
Commits:

66 Commits in this Release

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

Authored September 18, 2020
Authored September 28, 2020
Authored September 17, 2020
Authored September 16, 2020
Authored September 28, 2020
Authored September 29, 2020
Authored September 29, 2020
Authored September 19, 2020
Authored September 29, 2020
Authored September 22, 2020
Authored September 22, 2020
Authored September 28, 2020
Authored September 29, 2020
Authored September 28, 2020
Authored September 29, 2020
Authored September 16, 2020
Authored September 17, 2020
Authored September 22, 2020
Authored September 21, 2020
Authored September 29, 2020
Authored September 29, 2020
Authored September 17, 2020
Authored September 16, 2020
Authored September 16, 2020
Authored September 23, 2020
Authored September 17, 2020
Authored September 16, 2020
Authored September 28, 2020
Authored September 26, 2020
Authored September 16, 2020

Top Contributors in 2.8.0

timsuchanek
williamluke4
jasonkuhrt
Weakky
Jolg42
renovate-bot
nohns
prisma-bot

Directory Browser for 2.8.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 2.8.0 stable release πŸŽ‰

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

Major improvements

In today's release, we have two new features coming for you!

findFirst

While the findMany API gives you a powerful API to query your database with different filters, it's not ideal if you just want to query a single item.

On the other hand, the findOne API returns single items, but it only allows for filtering by unique fields.

In version 2.8.0, we introduce findFirst - giving you the full power of findMany filters while only returning the first item that matches the filter criteria.

So instead of this:

const usersCalledAlice = await prisma.user.findMany({
  name: "Alice" 
})
const firstUserCalledAlice = usersCalledAlice[0]

You can now do this:

const firstUserCalledAlice = await prisma.user.findFirst({
  name: "Alice" 
})

All filters available for findMany are also available in findFirst.

Case insensitive filters for PostgreSQL are now stable

In 2.5.0 we introduced case insensitive filters for PostgreSQL, in today's release we're promoting this feature to stable. This means you don't need to include the insensitiveFilters feature flag in the Prisma Client generator any more:

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

The new mode option you can pass to findMany influences the corresponding filter (e.g. contains or startsWith) but doesn't change the return type of the findMany query. mode can have two possible values:

  • default: Uses the default filter configured on the database level. If the collation is configured as case insensitive in the database, the default mode will be case insensitive as well. In that case, there's no need to use the insensitive mode.
  • insensitive: Uses the case insensitive filter (if possible).
const result = await prisma.user.findMany({
  where: {
    email: {
      equals: '[email protected]',
      mode: 'insensitive',
    },
  },
})

Note that this feature will not work if you're using database collations that do not know how to convert between upper- and lowercase letters (e.g. the C collation).

πŸ“š Documentation: Case sensitivity / Case-sensitive filtering

Already existing preview features from previous releases

Just a quick reminder:

  • In version 2.6.0 we introduced one preview feature, namely atomicNumberOperations.
  • In version 2.1.0 we introduced two preview features, namely connectOrCreate and transactionApi.

In case they're useful for you, please give them a try and share your feedback! These features remain in preview in this release.

Fixes and improvements

prisma

prisma-client-js

language-tools

studio

prisma-engines

❓ Are you using Prisma at work?

We'd love to know if you're using Prisma at work. Answer with a quick yes or no in our poll, it won't take longer than a few seconds!

Credits

Huge thanks to @nohns for some great contributions in this release!