2.29.0
#8670
Replies: 1 comment
-
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! 🙈 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Today, we are excited to share the
2.29.0
stable 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
interactiveTransactions
preview 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
@@unique
and@@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@relation
constraints.You can opt-in to Named Constraints by adding the
namedConstraints
preview feature to your Prisma Schema:After enabling the
namedConstraints
preview flag, you can specify the names of constraints in the database schema using themap
attribute:@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
map
attribute, Prisma Migrate will use it when creating migrations.When using
prisma db pull
withnamedConstraints
, 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
name
argument in@@unique
and@@id
In addition to the
map
argument, the@@unique
and the@@id
attributes have thename
argument (optional) that Prisma uses to generate theWhereUnique
argument in the Prisma Client API.For example, given the following model:
The following Prisma Client query is valid:
By adding the
name
argument to the@@id
attribute:The following query is valid:
Note: For the
@@unique
attribute this functionality was already available in previous releases. For@@id
this is new.You can learn more about
namedConstraints
in 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
updateMany
does 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.
--forceExit
introspect --url
outputs additional lines which make output result unusableconfig.datasources[0].provider
from GetConfig needs to be a string and not a string[]bar
specified for the@@unique
attribute 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.
Beta Was this translation helpful? Give feedback.
All reactions