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 theinsensitive
mode.insensitive
: Uses the case insensitive filter (if possible).
const result = await prisma.user.findMany({
where: {
email: {
equals: 'lowercase@UPPERCASE.com',
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, namelyatomicNumberOperations
. - In version
2.1.0
we introduced two preview features, namelyconnectOrCreate
andtransactionApi
.
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
- Output prepared GitHub issue creation link after reporting error (CLI)
- Prisma Format should enforce opinionation for order of attributes
- Cursor Pagination not returning expected results
- Warn about syntax error in datasource url (with env var) earlier
- Allow setting scalar lists without
set
- Investigate live reload of Prisma Client with
next dev
- Output path of schema.prisma file in CLI commands that read it
- Environment variable to trigger crash/panic in Engines
- Unable to connect when connection string contains $
- Implement a
findFirst
API
prisma-client-js
- Running into an issue with the connectOrCreate operation. The following query should create an entity for a Winery, and assign a Tag to it.
- Integration Tests, Errors: Writing a signed Int to an unsigned column
- ErrorFormat 'colorless' doesn't work
language-tools
- Add option to set the
prisma-fmt
binary path in vscode options - Warn about syntax error in datasource url (with env var) earlier #3509
- Slack notifications for failing workflows
- Quick Fix adding native Types preview Feature when using native types
- Extension panic because of comments
- Move e2e tests for published extension in this repo instead of in vscode-e2e-tests
- Prisma extension formatting failure and freeze after upgrade 2.7.1 and VS v1.49.1
- Add number of CI step in visible name of workflow
studio
prisma-engines
- Add tests using Cockroach DB
- Add tests using Yugabyte DB
- Add test cases for the DMMF command
- Query Engine: Investigate how we could support union types
- After upload: Download binary builds from S3 again and verify expected checksum
- Incorrect error message on missing native Type previewFeature
❓ 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!