Replies: 2 comments
|
Glad to see that we've at least got the option to use interactive transactions, and even happier that you're going "more semver". I've had a few scares with Prisma updating with breaking changes in the past! 🙈 |
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that haven’t had any recent activity and appear to be outdated. If this discussion is still important to you or unresolved, we’d love to hear from you! Feel free to reopen it or start a new one with updated details. For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and being part of the community! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Today, we are excited to share the
2.29.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements & new features
Interactive Transactions are now in Preview
Today we're introducing Interactive Transactions to address one of our most popular feature requests.
Interactive Transactions give you more control over how queries are executed within a transaction. One common use case is when the result of one query depends on another query, and you want to run both queries within a single transaction.
You can opt-in to Interactive Transactions by setting the
interactiveTransactionspreview feature in your Prisma Schema:For example, here's an interactive transaction that is used to create a cinema booking if there's availability and create a notification:
You can find the associated schema and working example here.
Learn more about Interactive Transactions in our documentation. We would love to know your feedback! If you have any comments or run into any problems, you can use this issue.
Named Constraints is now in Preview
Named Constraints allow you to represent (when using introspection) and specify (when using Prisma Migrate) the names of constraints of the underlying database schema in your Prisma schema.
Before this release, you could only specify the underlying database constraint names for
@@uniqueand@@index. This meant that you didn't have control over all constraint names in the database schema. In projects that adopted Prisma with introspection, some constraint names from the database were not represented in the Prisma schema. This could lead to the database schema across environments getting out of sync when one environment was introspected, and another was created with Prisma Migrate and had different constraint names.Starting with this release, you can specify the underlying database constraint names for
@id,@@id,@unique, and@relationconstraints.You can opt-in to Named Constraints by adding the
namedConstraintspreview feature to your Prisma Schema:After enabling the
namedConstraintspreview flag, you can specify the names of constraints in the database schema using themapattribute:@id(map: "custom_primary_key_constraint_name")@@id([field1, field2], map: "custom_compound_primary_key_name")@unique(map: "custom_unique_constraint_name")@@unique([field1, field2], map: "custom_compound_unique_constraint_name")@@index([field1, field2], map: "custom_index_name")@relation(fields: [fieldId], references: [id], map: "custom_foreign_key_name")After specifying the
mapattribute, Prisma Migrate will use it when creating migrations.When using
prisma db pullwithnamedConstraints, these names will be automatically populated in your Prisma schema unless they match our default naming convention (which follows the Postgres convention). When handwriting a Prisma schema, these names are optional and will alternatively be filled with the default names by Prisma under the hood.The
nameargument in@@uniqueand@@idIn addition to the
mapargument, the@@uniqueand the@@idattributes have thenameargument (optional) that Prisma uses to generate theWhereUniqueargument in the Prisma Client API.For example, given the following model:
The following Prisma Client query is valid:
By adding the
nameargument to the@@idattribute:model User { firstName String lastName String - @@id([firstName, lastName]) + @@id([firstName, lastName], name: "fullname") }The following query is valid:
Note: For the
@@uniqueattribute this functionality was already available in previous releases. For@@idthis is new.You can learn more about
namedConstraintsin our documentation.Please check our upgrade guide before enabling the preview flag and running migrate operations for the first time. It explains what to do if you either want to keep the existing names in your database or want to switch to the default names for a cleaner Prisma schema.
Prisma Adopts Semantic Versioning (SemVer)
As previously announced, we are adjusting our release policy to adhere more strictly to Semantic Versioning.
In the future, breaking changes in the stable development surface i.e. General Availability will only be rolled out with major version increments.
You can learn more about the change in the announcement blog post.
Fixes and improvements
Prisma Client
updateManydoes not update the updatedAt timestamps for related records properlyPrisma Migrate
Introducing FOREIGN KEY constraint '...' on table '...' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.--forceExitintrospect --urloutputs additional lines which make output result unusableconfig.datasources[0].providerfrom GetConfig needs to be a string and not a string[]barspecified for the@@uniqueattribute is already used as a name for a field. Please choose a different name.Credits
Huge thanks to @benkenawell 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" livestream.
The stream takes place on Youtube on Thursday, March 04 at 5pm Berlin | 8am San Francisco.
This discussion was created from the release 2.29.0.
All reactions