5.16.0
版本发布时间: 2024-06-25 22:20:18
prisma/prisma最新发布版本:5.19.1(2024-09-02 22:57:37)
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Highlights
Omit model fields globally
With Prisma ORM 5.16.0 we’re more than happy to announce that we’re expanding the omitApi
Preview feature to also include the ability to omit fields globally.
When the Preview feature is enabled, you’re able to define fields to omit when instantiating Prisma Client.
const prisma = new PrismaClient({
omit: {
user: {
// make sure that password is never queried.
password: true,
},
},
});
You’re also able to omit fields from multiple models and multiple fields from the same model
const prisma = new PrismaClient({
omit: {
user: {
// make sure that password and internalId are never queried.
password: true,
internalId: true,
},
post: {
secretkey: true,
},
},
});
With both local and global omit
, you now have the flexibility to completely remove sensitive fields while also tailoring individual queries. If you need the ability to generally omit a field except in a specific query, you can also overwrite a global omit locally
const prisma = new PrismaClient({
omit: {
user: {
// password is omitted globally.
password: true,
},
},
});
const userWithPassword = await prisma.user.findUnique({
omit: { password: false }, // omit now false, so password is returned
where: { id: 1 },
});
Changes to prismaSchemaFolder
In 5.15.0
we released the prismaSchemaFolder
Preview feature, allowing you to create multiple Prisma Schema files in a prisma/schema
directory. We’ve gotten a lot of great feedback and are really excited with how the community has been using the feature.
To continue improving our multi-file schema support, we have a few breaking changes to the prismaSchemaFolder
feature:
- When using relative paths in Prisma Schema files with the
prismaSchemaFolder
feature, a path is now relative to the file it is defined in rather than relative to theprisma/schema
folder. This means that if you have a generator block in/project/prisma/schema/config/generator.prisma
with anoutput
of./foo
the output will be resolved to/project/prisma/schema/config/foo
rather than/project/prisma/foo
. The path to a SQLite file will be resolved in the same manner. - We realized that during migration many people would have
prisma/schema
as well asprisma/schema.prisma
. Our initial implementation looked for a.prisma
file first and would ignore theschema
folder if it exists. This is now an error.
Changes to fullTextSearch
In order to improve our full-text search implementation we have made a breaking change to the fullTextSearch
Preview feature.
Previously, when the feature was enabled we updated the <Model>OrderByWithRelationInput
TypeScript type with the <Model>OrderByWithRelationAndSearchRelevanceInput
type. However, we have noted that there are no cases where relational ordering is needed but search relevance is not. Thus, we have decided to remove the <Model>OrderByWithRelationAndSearchRelevanceInput
naming and only use the <Model>OrderByWithRelationInput
naming.
Fixes and improvements
Prisma
- Wrong Parameterized Types Sent for SQL Server Queries
-
Prisma has no exported member named OrderByWithRelationInput. Did you mean OrderByWithAggregationInput?
- [Driver Adapters]: missing provider compatibility validation
-
Disable "Start using Prisma Client" hint logs on
prisma generate
- Deploying prisma to CloudFlare pages using Nuxt/Nitro and node-postgres (pg) is using the wrong(vercel) wasm path
-
@prisma/adapter-pg
modifies node-postgres global type parsers - @prisma/adapter-d1 is failing with an import error when called inside vitest tests
-
db pull
fails with[libs\user-facing-errors\src\quaint.rs:136:18] internal error: entered unreachable code
on invalid credentials
Language tools (e.g. VS Code)
- Make prisma-fmt logs to work with language server
- Spans and positions get shifted out of sync when schema includes multibyte characters
- VSCode extension panics when opening an empty prisma schema
Prisma Engines
- [DA] Planetscale engine tests: one2m_mix_required_writable_readable
- [DA] Planetscale engine tests: apply_number_ops
Credits
Huge thanks to @key-moon, @pranayat, @yubrot, @skyzh, @brian-dlee, @mydea, @nickcarnival, @eruditmorina, @nzakas, @gutyerrez, @avallete, @ceddy4395, @Kayoshi-dev, @yehonatanz for helping!