chore(deps): update prisma monorepo #18
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
2.12.1->2.20.12.12.1->2.30.3Release Notes
prisma/prisma
v2.20.1Compare Source
Today, we are issuing the
2.20.1patch release.Fix
npm install -g prismafails withYou seem to have a global installation of Prisma 1 package prisma#6331v2.20.0Compare Source
Today, we are excited to share the
2.20.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements & new features
Count on relations (Preview)
This highly requested feature is now in Preview. You can now count the number of related records by passing
_countto theselectorincludeoptions and then specifying which relation counts should be included in the resulting objects via anotherselect.For example, counting the number of posts that an user has written:
The structure of the returned
Userobjects is as follows:You can enable this featrues with the
selectRelationCountfeature flag:There may be some rough edges during the Preview period. If you run into any problems, you can reach us in this issue.
Node-APIis now in PreviewNode-API is a new technique for binding Prisma's Rust-based query engine directly to Prisma Client. This reduces the communication overhead between the Node.js and Rust layers when resolving Prisma Client's database queries.
You can enable this feature with the
napifeature flag:Enabling the Node-API will not affect your workflows in any way, the experience of using Prisma will remain exactly the same.
The Node-API has different runtime characteristics than the current communication layer between Node.js and Rust.
There may be some rough edges during the Preview period. If you run into any problems, you can reach us in this issue.
New
pushoperation available for arrays on PostgreSQLPostgreSQL supports array data structures (sometimes also called scalar lists). As an example, consider the
permissionsfield on the followingUsermodel:As of this release, you can append a new item to existing lists atomically with the
pushcommand:Learn more in this issue.
groupByandcreateManyare now Generally AvailableFor the pioneers among you, you can now remove the
groupByandcreateManyfrom your Preview features:generator client { provider = "prisma-client-js" - previewFeatures = ["groupBy", "createMany"] }Learn more in our documentation about
groupByandcreateMany.Prisma Client Go now supports
BigInt,DecimalandBytesPrisma Client Go continues to get more powerful every release. With this release, we've added support for more native database types:
BigInt,DecimalandBytes:Breaking changes
The
@prisma/clipackage has reached its end of lifeFor all you holdovers, you've seen warnings like this for a couple months now:
It's now time to upgrade. Follow the instructions and switch over to the new
prismapackage today:npm
Thanks to this change, running
npx prismawill now always invoke the right Prisma CLI, no matter what your local setup looks like.Yarn
Upcoming breaking changes in the next version (2.21.0)
.aggregatewill change to returnnullin 2.21.0Subscribe to this issue for updates on how to prepare your code.
Fixes and improvements
Prisma Migrate
Schema is inconsistenterror messageprisma formatcli commandprisma migrateset field as unique automaticallyPrisma Client
pushmethod to scalar list update input in addition to setResult::unwrap()on anErrvalue: FieldNotFound { name: "origin", model: "Field not found in record Record { values: [Int(1011), String("https://woman.mynavi.jp/article/190924-7/")], parent_id: None }. Field names are: ["id", "link"], looking for: "origin"" }SKIP_GENERATEfrom Client postinstall script toPRISMA_SKIP_POSTINSTALL_GENERATELanguage tools (e.g. VS Code)
Security Fixes
We fixed two security issues:
This is a low-severity issue and no users have been affected
This is a high-severity issue and we recommend all Prisma VS Code extension users verify that they have automatically been upgraded to the latest version. There is no evidence that this vulnerability has been exploited.
Big thanks to @erik-krogh (Erik Krogh Kristensen) and @Ry0taK for reporting these issues.
Credits
Huge thanks to @endor, @iBluemind, @matthewmueller, @paularah, @Iamshankhadeep 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, April 01 at 5pm Berlin | 8am San Francisco.
v2.19.0Compare Source
Today, we are excited to share the
2.19.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements & new features
Prisma Migrate is now ready for General Availability 🚀
We are excited to announce that Prisma Migrate enters General Availability. You can learn more about the launch in the announcement article.
There are no major changes to how Prisma Migrate works except that the
--preview-featureflag is being removed:Before v2.19.0
Now
Besides making Prisma Migrate ready for production in this release, it comes with a number of smaller fixes and improvements:
migrate dev,migrate resetanddb push, generation is always triggered to avoid issues where the Prisma Client API is outdated due to changes in relation names which have an impact on the database schema (GitHub issue)migrate devproduces warnings (GitHub issue)uuid()📚 Documentation:
Order by aggregates of relations in Prisma Client queries (Preview)
This release makes it possible to order by the aggregates (e.g. count) of relations in your Prisma Client queries. Here's is an example that orders a list of users by the number of the posts they created:
This feature is released in Preview which means you have to explicitly enable it via the
orderByRelationfeature flag in your Prisma schema:Don't forget to run
npx prisma generateafter you've added the feature flag to your Prisma schema so that the Prisma Client API gets updated accordingly.Prisma Client Go now returns results from the
TransactionAPIPreviously in the Go Client, you could write data within a transaction, but you couldn't get the results back from the transaction. Now you can! Learn more in the documentation.
Fixes and improvements
Prisma Client
npx prisma generatewith custom engine binariespool_timeoutvalue hides connect timeoutsPrisma Migrate
Option::unwrap()on aNonevalueprisma migrate devmigrate devprompts for migration name when running after --create-onlyintrospectwhen env var contains wrong connection string protocolStringfield toEnumin a migration - PostgresResult::unwrap()on anErrvalue: TypeMismatchError { expected_type: "constant literal", received_type: "string", raw: "tenantId", span: Span { start: 6221, end: 6231 } }db pushandmigrate deveven if the changes result in no database schema changesmigrate devLanguage tools (e.g. VS Code)
Prisma Studio
Credits
Huge thanks to @endor, @iBluemind, @meeq for their help in this release! ✨
💼 Learn about Enterprise use cases of Prisma on March 25th
We hope you join us for the upcoming Prisma Enterprise Event on Thursday, March 25th which is centered around the following topics:
📺 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 18 at 5pm Berlin | 8am San Francisco.
v2.18.0Compare Source
Today, we are excited to share the
2.18.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major changes & improvements
prisma introspectis becomingprisma db pullIn
2.10.0we introduced theprisma db pushcommand that enables developers to update their database schema from a Prisma schema file without using migrations.For the "opposite" motion (i.e., updating the Prisma schema from an existing database schema), we currently have the
prisma introspectcommand. In this release,prisma introspectis being renamed toprisma db pull. However, theprisma introspectcommand will be kept around for a few more releases so that you have enough time to switch over to the new command.Here is how we are planning to execute the renaming:
prisma db pull, which behaves exactly the same asprisma introspect.prisma introspectCLI command.prisma introspectwill be removed.There is no specific timeline to execute on this deprecation and we want to make sure we give developers a generous period of time to switch over.
Relation syntax will not be updated automatically any more
Prisma has a set of rules for defining relations between models in the Prisma schema.
The
prisma formatcommand automatically helps to apply these rules by inserting missing pieces. As an example, consider this data model with an invalid relation:This example is not valid because the
@relationattribute is missing. Runningnpx prisma format, automatically inserts the missing attribute:model User { id String @​id name String? posts Post[] } model Post { id String @​id authorId String? + author User? @​relation(fields: [authorId], references: [id]) }In previous releases, this expansion logic was applied automatically in several scenarios without running the formatter (by running
npx prisma formatexplicitly, or formatting via VS code), e.g. when runningprisma migrate. While helpful in some scenarios, these "magic" insertions often resulted in others errors that were harder to interpret and to debug for developers and ourselves.In this release, the "magical" instertions are removed and developers need to explicitly run
npx prisma formatif they want still make use of them.More flexible seeding in TypeScript
The
ts-nodecommand options can now be customized viapackage.jsonto pass specific options tots-node. This makesprisma db seedwork with tools that have specific requirements when used with TypeScript, such as Next.js.Here is an example that works with Next.js:
{ "name": "my-project", "version": "1.0.0", "scripts": { "ts-node": "ts-node --compiler-options '{\"module\":\"CommonJS\"}'" }, "devDependencies": { "@​types/node": "^14.14.21", "ts-node": "^9.1.1", "typescript": "^4.1.3" } }New Upsert API for Prisma Client Go
Prisma Client Go now supports upsert operations:
Learn more in the documentation and share your feedback in the
#prisma-client-gochannel on Slack.Fixes and improvements
Prisma Client
WHEREclause with 1=0 as conditionPrisma Migrate
ERROR: zero-length delimited identifier at or near """"Couldn\'t parse default valueShadowDatabaseUrlto use Prisma Migrate in the cloud, a valid URL is always enforced across every environment, even though it's only needed in development.prisma db pullcommand for introspectionPrisma Studio
DateTimefield tonullLanguage tools (e.g. VS Code extension)
shadowDatabaseUrlin the datasource blockPrisma engines
📝 Help us improve our release notes
We want to ensure our release notes are as helpful as possible for you! You can help us achieve this by taking part in the poll in this GitHub issue.
📺 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.
v2.17.0Compare Source
Today, we are excited to share the
2.17.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Overview
prisma db pushprisma db seednow supports custom schema locationsNote that this release comes with some breaking changes. Read the Breaking changes section below to learn more.
Major improvements & new features
Native types are now stable
The
nativeTypespreview feature flag has first been introduced in2.10.0. Thanks to your continuous and awesome feedback for this feature, we're now able to release usage of native database types in the Prisma schema for General Availability 🎉Note that this release comes with a few minor breaking changes compared to previous versions. Please read about the Breaking Changes below.
If you haven't followed previous releases, expand below to learn more about everything that's now possible with the new native types.
Expand to learn more about the benefits of native types
Rich column type mapping for Prisma types
Each Prisma type can now map to one of multiple native database types. Native database type attributes are:
@db.BooleanforBooleanwhereas MySQL uses@db.TinyIntVarCharorText)@db, wheredbis the name of thedatasourceblock in your Prisma schemaType attributes give you:
Stringcan be@db.VarChar(200)or@db.Char(50)Stringisvarchar(200)or justtext.To learn more about all the possible native type attributes, check out the type mapping reference in the docs.
Extending Prisma schema beyond supported column types
Column types which are not (yet?) supported by Prisma Migrate can be used with Prisma Migrate and introspection through the Prisma type
Unsupportedwhich was introduced in Preview in the last release:dbgenerated()in the@defaultdirective can now take a String argument that enables developers to reflect database-levelDEFAULTconstraints not yet supported by Prisma Migrate. These default values will be surfaced when introspecting withprisma introspectand created/changed when using Prisma Migrate.Developers can now add
@@​ignoreand@ignoreattributes to models and fields, for fields they want to manage via Prisma Migrate but not surfaced in Prisma Client. These attributes are added by Prisma when introspecting entities which are not supported, e.g. a table with no unique column. They are now also kept in the Prisma schema when re-introspecting a database.Prisma Migrate now works with cloud-hosted databases (e.g. Heroku)
Before this release, Prisma Migrate could be used to apply migrations in a cloud-hosted environment (CI/CD pipeline, manual deployment to production, staging, etc.), but it was impossible to create new migrations, due to the requirement of a shadow database. Prisma Migrate expects to have privileges to create the shadow database using the same credentials, but cloud providers generally do not allow creating logical databases.
Starting from this release,
prisma migrate devcan now be used in development with cloud-hosted databases by configuring a separate connection URL for the shadow database.To develop natively in the cloud with Prisma Migrate, developers can create two cloud-hosted databases, one being the development- and the other being the shadow-database.
The connection URI for the shadow database can be configured in the
datasourceblock of the Prisma schema file, similarly to the datasource URL, by defining ashadowDatabaseUrlvariable:Soft resets for cloud-hosted environments
Another common limitation of cloud-hosted environments is that the database cannot be dropped and re-created using
DROP DATABASEandCREATE DATABASE, due to insufficient privileges. Prisma Migrate so far relied on these statements to ensure the database is empty when it needs to be reset.Database resets in the context of Prisma Migrate now gracefully fall back to dropping constraints, indexes and tables, if there are insufficient privileges to reset the database using
DROP DATABASE.Note that this comes with the caveat that there could be other entities in the database, which Prisma Migrate could fail to clean up.
More improvements and bug fixes for Prisma Migrate
migrate dev- if a non-interactive environment is detected, you'll be suggested to useprisma migrate deployinstead.prisma/migrations/20210119114009_init(missingmigration.sqlfile).Improvements and changes for
prisma db pushprisma db pushnow handles unexecutable migrations better, offering a path forward by resetting the database. For example, adding a new required field without a default value when there are rows in the table is considered an unexecutable migration; in such situations you will be prompted to first reset the database.—-forcehas been renamed to--accept-data-lossto be more explicit - this is required for certain changes that involve losing data, e.g. dropping a table or dropping a column if there are rows.—-force-resetwhich first resets the database and then updates the schema - this can be useful to start from scratch and as a way to deal with unexecutable migrations (see above).prisma db seednow supports custom schema locationsYou can now point the
prisma db seedcommand to a custom schema location using either of two approaches:--schemaoption when running the commandpackage.jsonwhich will be picked up every time you run the command.Improvements and bug fixes in Prisma Client
server_namefix: Before we couldn't connect to certain kind of SQL Server instances. If the server was a managed instance from Azure, connecting to it with Prisma would returnServer name cannot be determined. Additionally, when running a shared Azure SQL database, if the firewall setting was set toredirect(the default setting), our connection would first fail with advising the user to connect to a new server, and when changing the connection string regarding the error, the new connection would fail with the same errorServer name cannot be determined. This is now fixed. Azure managed instances just work, as do redirections (which are done under the hood, automatically).NVarChar/NCharlength and a maximum of 4000 forVarChar/Char/VarBinary/Binarylength. The actual maximums are4000for first and8000for the latter types.executeRawto insert number values to anumerictype in PostgreSQL, sometimes the stored value would be zero instead of the user input. An example value of12345.0is converted by JavaScript as an integer of 12345, which then is written as an integer to the table. The table column being numeric, the integer representation would always be zero in these cases. Now we should be able to convert integers tonumericwithout any trouble.Bug fixes in Prisma Studio
ByteandBigInt.createManypreview feature doesn't crash Studio any moreBreaking changes
Type mapping from Prisma schema to the database for
Floathas changed fromDecimaltoDoublein MySQL and PostgreSQLOverview
If you use the
Floatscalar type in your Prisma schema and used Prisma Migrate to create the database schema in previous Prisam versions, the corresponding database column has the typeDECIMAL(65,30).For example, given the following Prisma schema:
Previous version of Prisma Migrate would generate the following migration:
As of
2.17.0, the remapping of theFloattype fromDecimal(65,30)toDoublewill cause Migrate to attempt to alter the database type of therewardcolumn toDoublethe next time you create a migration.What does this mean for users?
Nothing changes in Prisma Client until the next time you want to make a change to your schema. In that case, you'll need to decide if you want to keep using the
Decimal(65,30)type in the database:Decimal(65,30), you need to change the type in the Prisma schema fromFloattoDecimal. Alternatively, you can also runprisma introspectwhich will automatically remap the previousFloatfields toDecimal. Note that this will also change the type that Prisma Client returns fromNumbertoDecimal.js.Decimal(65,30)toDouble, leave the Prisma schema as is and create a new migration. Prisma Migrate will alter the column's type toDouble. Note that if you have rows with data for the column, they will be cast fromDecimal(65,30)toDouble.Check out this video guide, which covers how to upgrade and address the remapping of Float.
Breaking changes due to strict type diffing and native types
Overview
Prisma has default mappings between each scalar type in the Prisma schema to the underlying database type. For example, the
Stringscalar type in Prisma schema is mapped to aTEXTcolumn on PostgreSQL by default.Before this release, Prisma supported using a range of database column types for a given Prisma scalar. For example, define a field in Prisma schema as
Stringand useVARCHAR(50)as the column type in the database using the@db.varchar(50)type annotation .With the introduction of native types in General Availability, you can now specify your desired database type for columns in the Prisma schema via the
@db.DB_TYPEfield attributes, e.g.,@db.varchar(50).Because the
@db.DB_TYPEattribute now exists, Prisma no longer allows the loose mapping of Prisma scalar types to database column types without the specific notation. The only exception to this rule is when you want to use default mapping, e.g., theStringPrisma scalar will map toTEXTon PostgreSQL.Before
Given the following table in PostgreSQL:
Prisma would introspect the table as follows:
After
Because
VARCHAR(50)can be expressed in native type notation. The matching Prisma schema for theUserdatabase table above on PostgreSQL is the following:What does this mean for users?
Moving forward, if you want specific database column types, which are supported by Prisma, you should make sure to use the native type notation for the corresponding fields in the Prisma schema.
For users of Prisma Migrate with existing databases, you must understand that Prisma Migrate will try to migrate every column of a type different than what's defined in the schema.
If we go back to the previous example with loose type mapping, with this Prisma schema:
and this initial database schema:
On PostgreSQL, from this release on, Prisma will the columns for the fields
nickNameand name to be of typeTEXTand will generate a migration to alter the type of thenickNamecolumn:To avoid unnecessary migrations to change types you may have defined on purpose, you can run introspection once, which will add the native annotations to any fields when they do not match the default mappings by Prisma.
For the initial database schema we used in the example
This would be the resulting Prisma schema after running prisma introspect
model User { id Int @​id @​default(autoincrement()) nickName String? @​db.VarChar(50) name String }Fixes and improvements
Prisma Client
undefinedvalue shouldn't return datamakeEnumnativeTypeslocalhostfor MySQL, MariaDB and SQL Server (mostly when running those via Docker)PRISMA_DISABLE_WARNINGSPrisma Migrate
Option::unwrap()on aNonevalueALTER TYPEenum migrations fail in PostgreSQL@@​ignoreand@ignoreon re-introspectionundefineddb seednot documented in help output forprisma db --helpprisma migrate deployinmigrate devnon interactive error message for better discoverability.prisma migrate dev --create-only- if there are data loss warnings, the CLI prompts suggest the new migration will be applied when it is (rightfully)notLanguage tools
@ignorecode completion is supported in VS code extensionPrisma Studio
Prisma Engines
clippytomigration-engineclippytointrospection-engineclippytolibs/datamodelclippyto alllibs/*(except datamodel)Check out the official Prisma roadmap
You can find all the features that are currently planned and in progress on our roadmap.
Credits
Huge thanks to @safinsingh for helping!
v2.16.1Compare Source
Today, we introduce the
2.16.1patch release.This fixes a problem some users are having with certain Docker, MariaDB, MySQL or SQL Server configurations, preventing Prisma to connect with
localhost. A recent Docker update caused a regression related to IPv6 and name resolution.Prisma
localhostfor MySQL, MariaDB and SQL Server (mostly when running those via Docker) #5499Prisma Engines
v2.16.0Compare Source
Today, we are excited to share the
2.16.0stable release 🎉🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements
The Prisma CLI moves from the
@prisma/clito theprismanpm packageGoing forward, you can install the Prisma CLI via the
prismanpm package:or
The reason for this is that a number of users were experiencing issues when running the
npx prismacommand. Without a local installation of the@prisma/clipackage, this would invoke the Prisma 1 CLI leading to an error message. From now on,npx prismais always going to work.We will also deprecate the
@prisma/clipackage. Please do a find and replace across your codebase to transition over from@prisma/clitoprisma. To make this transition easier, we'll keep publishing updates to both packages for another month and plan to stop updating the@prisma/clipackage with release2.18.0.There are no changes to the
@prisma/clientnpm package name.Efficient bulk creates with
createManyInsert data a whole lot faster with
createMany. Here's an example:This feature is in preview right now. Enable it with the
createManypreview flag:📚 Documentation: Create multiple records
Learn more in this issue.
Order by relation fields with
orderByEver wish you could order posts by an author's name? Or sort transactions by
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR has been generated by Mend Renovate. View repository job log here.