You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, we are excited to share the 3.7.0 stable release 🎉
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements
Referential actions support for MongoDB
In 3.7.0, we've added MongoDB support for onDelete and onUpdate to specify how you want to handle changes to relationships. To enable it, use the referentialIntegrity preview feature flag.
MongoDB does not support referential actions out of the box, but we can emulate this feature inside the Prisma Query Engine.
Given the following schema:
generator client {
provider = "prisma-client-js"
+ previewFeatures = ["mongoDb", "referentialIntegrity"]- previewFeatures = ["mongoDb"]
}
model User {
id String @id @default(dbgenerated()) @map("_id") @db.ObjectId
posts Post[]
name String
}
model Post {
id String @id @default(dbgenerated()) @map("_id") @db.ObjectId
+ author User @relation(fields: [userId], references: [id], onDelete: Cascade)- author User @relation(fields: [userId], references: [id])
title String
userId String @db.ObjectId
}
By specifying onDelete: Cascade, Prisma will also delete posts whenever the author of the posts is deleted. There's a lot more to referential actions than cascading deletes. Head over to our documentation to learn more.
This is one of many benefits of building on top of Prisma. We can expose features and workflows that database vendors don't offer.
Prevent referential cycles on MongoDB
As part of getting onDelete and onUpdate ready for MongoDB, we’ve tightened up our validation rules to prevent a potential stack overflow if you create a loop with referential actions.
This change may cause some existing schemas using the mongodb preview feature to become invalid, where your schema now errors out with the following message:
Error parsing attribute "@relation": Reference causes a cycle.
If you run into this, you can learn how to resolve it with this documentation. If you’re still stuck, feel free to open a discussion and we’ll lend a hand!
Deprecating undocumented usage of type in Prisma Schema
With Prisma 3.7.0 release, the VS Code extension (and other IDEs using our language server implementation) will start to show a warning when detecting unsupported usage of the type keyword.
We plan to remove that functionality entirely with the next major release of Prisma. If you happen to depend on similar functionality for type aliasing, please leave a comment on the issue.
Prisma Studio
Due to how Prisma Studio executes Prisma Client queries, it was possible to execute arbitrary code on Studio’s local server. This has since been patched.
Issues with viewing and updating models with BigInt fields are also resolved.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Today, we are excited to share the
3.7.0
stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements
Referential actions support for MongoDB
In
3.7.0
, we've added MongoDB support foronDelete
andonUpdate
to specify how you want to handle changes to relationships. To enable it, use thereferentialIntegrity
preview feature flag.MongoDB does not support referential actions out of the box, but we can emulate this feature inside the Prisma Query Engine.
Given the following schema:
By specifying
onDelete: Cascade
, Prisma will also delete posts whenever the author of the posts is deleted. There's a lot more to referential actions than cascading deletes. Head over to our documentation to learn more.This is one of many benefits of building on top of Prisma. We can expose features and workflows that database vendors don't offer.
Prevent referential cycles on MongoDB
As part of getting
onDelete
andonUpdate
ready for MongoDB, we’ve tightened up our validation rules to prevent a potential stack overflow if you create a loop with referential actions.This change may cause some existing schemas using the
mongodb
preview feature to become invalid, where your schema now errors out with the following message:Error parsing attribute "@relation": Reference causes a cycle.
If you run into this, you can learn how to resolve it with this documentation. If you’re still stuck, feel free to open a discussion and we’ll lend a hand!
Deprecating undocumented usage of
type
in Prisma SchemaWith Prisma
3.7.0
release, the VS Code extension (and other IDEs using our language server implementation) will start to show a warning when detecting unsupported usage of thetype
keyword.An example of that is string aliasing:
We plan to remove that functionality entirely with the next major release of Prisma. If you happen to depend on similar functionality for type aliasing, please leave a comment on the issue.
Prisma Studio
Due to how Prisma Studio executes Prisma Client queries, it was possible to execute arbitrary code on Studio’s local server. This has since been patched.
Issues with viewing and updating models with
BigInt
fields are also resolved.Fixes and improvements
Prisma Client
Prisma Migrate
prisma generate
fails with error "memory allocation of [86GB] failed"Language tools (e.g. VS Code)
@@fulltext(fields:[])
or@@fulltext([])
or@@index([])
or@@unique([])
.Credits
Huge thanks to @otan, @benkroeger, @YassinEldeeb, @chenkie for helping!
📺 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 Holiday Special" livestream.
The stream takes place on YouTube on Tuesday, December 21 at 5 pm Berlin | 8 am San Francisco.
This discussion was created from the release 3.7.0.
Beta Was this translation helpful? Give feedback.
All reactions