This repository was archived by the owner on Oct 19, 2022. It is now read-only.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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:
^3.13.0->^4.0.0^3.13.0->^4.0.0Release Notes
prisma/prisma
v4.3.1Compare Source
Today, we are issuing the
4.3.1patch release.Fixes in Prisma Client
Fixes in Prisma CLI
v4.3.0Compare Source
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements
Field reference support on query filters (Preview)
We're excited to announce Preview support for field references. You can enable it with the
fieldReferencePreview feature flag.Field references will allow you to compare columns against other columns. For example, given the following schema:
You can now compare one column with another after running
prisma generate, for example:Learn more about field references in our documentation. Try it out and let us know what you think in this GitHub issue.
Count by filtered relation (Preview)
In this release, we're adding support for the ability to count by a filtered relation. You can enable this feature by adding the
filteredRelationCountPreview feature flag.Given the following Prisma schema:
You can now express the following query with the Preview feature after re-generating Prisma Client:
Learn more in our documentation and let us know what you think in this issue
Multi-schema support (Preview)
In this release, we're adding very early Preview support of multi-schema support for PostgreSQL and SQL Server behind the
multiSchemaPreview feature flag. With it, you can write a Prisma schema that accesses models across multiple schemas.Read further in this GitHub issue. Try it out and let us know what you think in this GitHub issue.
Prisma CLI exit code fixes
We've made several improvements to the Prisma CLI:
prisma migrate devpreviously returned a successful exit code (0) whenprisma db seedwas triggered but failed due to an error. We've fixed this andprisma migrate devwill now exit with an unsuccessful exit code (1) when seeding fails.prisma migrate statuspreviously returned a successful exit code (0) in unexpected cases. The command will now exit with an unsuccessful exit code (1) if:/prisma/migrationsfolder)The previous behavior when canceling a prompt by pressing Ctrl + C was returning a successful exit code (0). It now returns a non-successful,
SIGINT, exit code (130).In the rare event of a Rust panic from the Prisma engine, the CLI now asks you to submit an error report and exit the process with a non-successful exit code (1). Prisma previously ended the process with a successful exit code (0).
Improved precision for the
tracingPreview featureBefore this release, you may have occasionally seen some traces that took 0μs working with the
tracingPreview feature. In this release, we've increased the precision to ensure you get accurate traces.Let us know if you run into any issues in this GitHub issue.
prisma formatnow uses a Wasm moduleInitially, the
prisma formatcommand relied on logic from the Prisma engines in form of a native binary. In an ongoing effort to makeprismamore portable and easier to maintain, we decided to shift to a Wasm module.prisma formatnow uses the same Wasm module as the one the Prisma language server uses, i.e.@prisma/prisma-fmt-wasm, which is now visible inprisma versioncommand's output.Let us know what you think. In case you run into any issues, let us know by creating a GitHub issue.
MongoDB query fixes
While implementing field reference support, we noticed a few correctness bugs in our MongoDB connector that we fixed along the way:
mode: insensitivealphanumeric comparisons (e.g. “a” > “Z”) didn’t work (GitHub issue)mode: insensitivedidn’t exclude undefined (GitHub issue)isEmpty: falseon lists types (e.g. String[]) returned true when a list is empty (GitHub issue)hasEveryon list types wasn’t aligned with the SQL implementations (GitHub issue)JSON filter query fixes
Prisma schema
If you used
NOTwith any of the following queries on aJsonfield, double-check your queries to ensure they're returning the correct data:string_containsstring_starts_withstring_ends_witharray_containsarray_starts_witharray_ends_withgt/gte/lt/ltePrisma extension for VS Code improvements
The Prisma language server now provides Symbols in VS Code. This means you can now:
See the different blocks (
datasource,generator,model,enum, andtype) of your Prisma schema in the Outline view. This makes it easier to navigate to a block in 1 clickA few things to note about the improvement are that:
Enable Editor sticky scroll from version
1.70of VS Code. This means you can have sticky blocks in your Prisma schema, improving your experience when working with big schema filesMake sure to update your VS Code application to 1.70, and the Prisma extension to
4.3.0.We'd also like to give a big Thank you to @yume-chan for your contribution!
Prisma Studio improvements
We've made several improvements to the filter panel which includes:
Refined filter panel
Refined error handling for MongoDB m-n relations
Prisma Studio prevents fatal errors when interacting with m-n relations by explicitly disabling creating, deleting, or editing records for m-n relations
Multi-row copying
You can select multiple rows and copy them to your clipboard as JSON objects using CMD + C on MacOS or Ctrl + C on Windows/ Linux
Prisma Client Extensions: request for comments
For the last couple of months, we've been working on a specification for an upcoming feature — Prisma Client extensions. We're now ready to share our proposed design and we would appreciate your feedback.
Prisma Client Extensions aims to provide a type-safe way to extend your existing Prisma Client instance. With Prisma Client Extensions you can:
... and much more!
Here’s a glimpse at how that will look:
For further details, refer to this GitHub issue. Have a read and let us know what you think!
Fixes and improvements
Prisma Client
Prisma
@prisma/prisma-fmt-wasmto CLI and output dependency version in-v, use instead of Formatter Engine binarydb pushoutput in MongoDBdmmfraises "Schema parsing - Error while interacting with query-engine-node-api library" misleading error message when there is a schema validation error.migrate statusshould return a non-successful exit code (1) when a failed migration is found or an error occursmigrate devshould return a non-successful exit code (1) when there is an error during seedingPrisma Migrate
Language tools (e.g. VS Code)
Credits
Huge thanks to @abenhamdine, @drzamich, @AndrewSouthpaw, @kt3k, @lodi-g, @Gnucki, @apriil15, @givensuman for helping!
Prisma Data Platform
We're working on the Prisma Data Platform — a collaborative environment for connecting apps to databases. It includes the:
Try it out and let us know what you think!
💼 We're hiring!
If you're interested in joining our growing team to help empower developers to build data-intensive applications, Prisma is the place for you.
We're looking for a Developer Advocate (Frontend / Fullstack) and Back-end Engineer: Prisma Data Platform.
Feel free to read the job descriptions and apply using the links provided.
📺 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, September 1 at 5 pm Berlin | 8 am San Francisco.
v4.2.1Compare Source
Today, we are issuing the
4.2.1patch release.Fix in Prisma Client
v4.2.0Compare Source
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements
Prisma Client tracing support (Preview)
We're excited to announce Preview support for tracing in Prisma Client! 🎉
Tracing allows you to track requests as they flow through your application. This is especially useful for debugging distributed systems where each request can span multiple services.
With tracing, you can now see how long Prisma takes and what queries are issued in each operation. You can visualize these traces as waterfall diagrams using tools such as Jaeger, Honeycomb, or DataDog.
Read more about tracing in our announcement post and learn more in our documentation on how to start working with tracing.
Try it out and let us know what you think.
Isolation levels for interactive transactions
We are improving the
interactiveTransactionsPreview feature with the support for defining the isolation level of an interactive transaction.Isolation levels describe different types of trade-offs between isolation and performance that databases can make when processing transactions. Isolation levels determine what types of data leaking can occur between transactions or what data anomalies can occur.
To set the transaction isolation level, use the
isolationLeveloption in the second parameter of the API. For example:Prisma Client supports the following isolation levels if they're available in your database provider:
ReadCommittedReadUncommittedRepeatableReadSerializableSnapshotLearn more about in our documentation. Try it out, and let us know what you think in this GitHub issue.
Renaming of Prisma Client Metrics
In this release, we've renamed the metrics — counters, gauges, and histograms — returned from
prisma.$metrics()to make it a little easier to understand at a glance.query_total_operationsprisma_client_queries_totalquery_total_queriesprisma_datasource_queries_totalquery_active_transactionsprisma_client_queries_activequery_total_elapsed_time_msprisma_client_queries_duration_histogram_mspool_wait_duration_msprisma_client_queries_wait_histogram_mspool_active_connectionsprisma_pool_connections_openpool_idle_connectionsprisma_pool_connections_idlepool_wait_countprisma_client_queries_waitGive Prisma Client
metricsa shot and let us know what you think in this GitHub issueTo learn more, check out our documentation.
Syntax highlighting for raw queries in Prisma Client
This release adds syntax highlighting support for raw SQL queries when using
$queryRaw``and$executeRaw``. This is made possible using Prisma's VS Code extension.Note: Syntax highlighting currently doesn't work with when using parentheses,
(),$queryRaw(),$executeRaw(),$queryRawUnsafe(), and$executeRawUnsafe().If you are interested in having this supported, let us know in this GitHub issue.
Experimental Cloudflare Module Worker Support
We fixed a bug in this release that prevented the Prisma Edge Client from working with Cloudflare Module Workers.
We now provide experimental support with a workaround for environment variables.
Try it out and let us know how what you think! In case you run into any errors, feel free to create a bug report.
Upgrade to Prisma 4
In case you missed it, we held a livestream a few weeks ago and walked through issues you may run into while upgrading to Prisma 4 and how to fix them!
Request for feedback
Our Product teams are currently running two surveys to help close the feature gaps and improve Prisma.
If you have a use-case for geographical data (GIS) or full-text search/ indexes (FTS), we would appreciate your feedback on your needs:
Many thanks! 🙌🏽
Fixes and improvements
Prisma Client
dataproxyto have datasource overridesPrisma
libs\datamodel\connectors\dml\src\model.rs:494:29(missing PK?)prisma db pullonSQL Serverprisma db pullLanguage tools (e.g. VS Code)
Prisma Studio
Credits
Huge thanks to @shian15810, @zifeo, @lodi-g, @Gnucki, @apriil15, @givensuman, @peter-gy for helping!
Prisma Data Platform
We're working on the Prisma Data Platform — a collaborative environment for connecting apps to databases. It includes the:
Try it out and let us know what you think!
💼 We're hiring!
If you're interested in joining our growing team to help empower developers to build data-intensive applications, Prisma is the place for you.
We're looking for a Developer Advocate (Frontend / Fullstack) and Back-end Engineer: Prisma Data Platform.
Feel free to read the job descriptions and apply using the links provided.
📺 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, August 11 at 5 pm Berlin | 8 am San Francisco.
v4.1.1Compare Source
Today, we are issuing the
4.1.1patch release.Fix in Prisma Studio
v4.1.0Compare Source
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Upgrading to Prisma 4
In case you missed it, we held a livestream last week and walked through issues you may run into while upgrading to Prisma 4 and how to fix them!
Major improvements
Ordering by nulls first and last support (Preview)
In this release, we're adding support for choosing how to sort null values in a query.
To get started, enable the
orderByNullsPreview feature flag in your Prisma schema:Next, run
prisma generateto re-generate Prisma Client. You will now have new fields you can now use to order null values:Learn more in our documentation and don't hesitate to share your feedback in this issue.
Fixed memory leaks and CPU usage in Prisma Client
In this release, we've fixed the following issues experienced when setting up and tearing down Prisma Client while running tests:
These fixes will allow you to run your tests a little faster!
Prisma Studio improvements
We're refining the experience when working with Prisma studio with the following changes:
Let us know what you think, and in the event, you run into any issues, please create a GitHub issue
Fixes and improvements
Prisma
prisma formatstrips comments on block level attributesprisma --versioncrashes ifopensslisn't properly installed@prisma/internalsOption::unwrap()on aNonevalue"//comments in the generator and datasource blocksPrisma Client
prisma generate: Non-functional debounce mechanism for watch modePrisma Migrate
Language tools (e.g. VS Code)
@idis suggested and fix@prisma/engines@prisma/engines npm package
prisma/prismaCredits
Huge thanks to @shian15810, @zifeo, @lodi-g, @Gnucki, @apriil15 for helping!
💼 We're hiring!
If you're interested in joining our growing team to help empower developers to build data-intensive applications, Prisma is the place for you.
We're looking for a Technical Support Engineer and Back-end Engineer: Prisma Data Platform.
Feel free to read the job descriptions and apply using the links provided.
📺 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, July 19 at 5 pm Berlin | 8 am San Francisco.
v4.0.0Compare Source
We're excited to share the
4.0.0stable release today. 🎉Prisma
4.0.0features a variety of improvements across Prisma Migrate, Prisma schema, and Prisma Client. These changes will impact most Prisma users, particularly those who used some of our most popular Preview features around advanced index management, raw SQL queries, and filtering rows by properties of JSON.As this is a major release, we included many breaking bug fixes and other enhancements, but we believe upgrading is worthwhile. You can learn about upgrading in our Prisma 4 Upgrade guide and the Prisma 4 Upgrade video.
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
Major improvements
Here's a TL;DR:
extendedIndexesfilterJsonimprovedQueryRawreferenceson implicit m:n relationsreferencesargument in 1:1 and 1:m relations for MySQLtypealiassqliteprotocol for SQLite URLsfindUniqueOrThrowfindFirstOrThrowrejectOnNotFoundDbNull,JsonNull, andAnyNullare now objects@prisma/sdknpm package to@prisma/internalsschemaproperty from the generated Prisma ClientextendedIndexesis now Generally AvailableStarting with this release, we're excited to announce that
extendedIndexesis now Generally Available! 🚀generator client { provider = "prisma-client-js" - previewFeatures = ["extendedIndexes"] }We introduced
extendedIndexesin3.5.0and have constantly been shipping improvements in the subsequent releases to the configuration of indexes.You can now configure indexes in your Prisma schema with the
@@​indexattribute to define the kind of index that should be created in your database. You can configure the following indexes in your Prisma Schema:Sort, sort order, and length
The
lengthargument is available on MySQL on the@id,@@​id,@unique,@@​unique, and@​@​indexfields. It allows Prisma to support indexes and constraints onStringwith aTEXTnative type andBytestypes.The
sortargument is available for all databases on the@unique,@@​unique, and@@​indexfields. SQL Server also allows it on@idand@@​id.Hash indexes for PostgreSQL
GIN,GiST,SP-GiSTandBRINindexes for PostgreSQLSQL Server index clustering
Refer to our docs to learn how you can configure indexes in your Prisma schema and the supported indexes for the different databases.
filterJsonis now Generally AvailableThis release moves the
filterJsonPreview feature into General Availability! 🪄generator client { provider = "prisma-client-js" - previewFeatures = ["filterJson"] }JSON filtering allows you to filter rows by the data inside a
Jsontype. For example:The
filterJsonPreview feature has been around since May 2021, and we're excited to mark it ready for production use! Learn more in our documentation.improvedQueryRawis now Generally AvailablePrisma 4 now marks the
improvedQueryRawPreview feature as Generally Available! 🤩generator client { provider = "prisma-client-js" - previewFeatures = ["improvedQueryRaw"] }This change introduces two major improvements (both breaking, refer to the upgrade guide for a smooth upgrade) when working with raw queries with Prisma:
1. Scalar values are de-serialized as their correct JavaScript types
Raw queries now deserialize scalar values to their corresponding JavaScript types.
Here's an example query and response:
Below is a table that recaps the serialization type-mapping for raw results:
2. PostgreSQL type-casts
Previously, PostgreSQL type-casts were broken. Here's an example query that used to fail:
You can now perform some type-casts in your queries as follows:
A consequence of this fix is that some subtle implicit casts are now handled more strictly and would fail. Here's an example that used to work but won't work anymore:
The
LENGTHPostgreSQL function only accepttextas input. Prisma used to silently coerce42totextbut won’t anymore. As suggested by the hint, cast42totextas follows:Refer to our docs to learn more on raw query type mappings in Prisma.
4.0.0, refer to our upgrade guide: Raw query type mapping: scalar values are now deserialized as their correct JavaScript types and Raw query mapping: PostgreSQL type-casts.Defaults values for scalar lists (arrays)
Prisma 4 now introduces support for defining default values for scalar lists (arrays) in the Prisma schema.
You can define default scalar lists as follows:
To learn more about default values for scalar lists, refer to our docs.
Improved default support for embedded documents in MongoDB
From version
4.0.0, you can now set default values on embedded documents using the@defaultattribute. Prisma will provide the specified default value on reads if a field is not defined in the database.You can define default values for embedded documents in your Prisma schema as follows:
Refer to our docs to learn more on default values for required fields on composite types.
4.0.0.Explicit unique constraints for 1:1 relations
From version
4.0.0, 1:1 relations are now required to be marked with the@uniqueattribute on the side of the relationship that contains the foreign key.Previously, the relation fields were implicitly treated as unique under the hood. The field was also added explicitly when
npx prisma formatwas run.Removed support for usage of
referenceson implicit m:n relationsThis release removes the usage of the
referencesargument, which was previously optional when using m:n relations.model Post { id Int @​id @​default(autoincrement()) - categories Category[] @​relation("my-relation", references: [id]) + categories Category[] @​relation("my-relation") } model Category { id Int @​id @​default(autoincrement()) - posts Post[] @​relation("my-relation", references: [id]) + posts Post[] @​relation("my-relation") }This is because the only valid value for
referenceswasid, so removing this argument clarifies what can and cannot be changed.Refer to our docs to learn more about implicit m:n relations.
Enforcing uniqueness of referenced fields in the
referencesargument in 1:1 and 1:m relations for MySQLFrom version
4.0.0, Prisma will now enforce that the field on thereferencesside of a@relationis unique when working with MySQL.To fix this, add the
@uniqueor@idattributes to foreign key fields in your Prisma schema.4.0.0, refer to our upgrade guide.Removal of undocumented support for the
typealiasWith
4.0.0, we're deprecating thetypekeyword for string aliasing. Thetypekeyword will now be exclusively used for defining embedded documents in MongoDB.We encourage you to remove any usage of the
typekeyword from your Prisma schema for type aliasing.Removal of the
sqliteprotocol for SQLite URLsStarting from
4.0.0, we are dropping support of thesqlite://URL prefix for SQLite. We encourage you to use thefile://prefix when working with SQLite.Better grammar for string literals
String literals in the Prisma schema now need to follow the same rules as strings in JSON. That changes mostly the escaping of some special characters.
You can find more details on the specification here:
To fix this, resolve the validation errors in your Prisma schema or run
npx prisma db pullto get the current values from the database.New Prisma Client APIs:
findUniqueOrThrowandfindFirstOrThrowIn this release, we're introducing two new APIs to Prisma Client:
findUniqueOrThrow– retrieves a single record asfindUniquebut throws aRecordNotFoundexception when no record is not foundfindFirstOrThrow– retrieves the first record in a list asfindFirstbut throws aRecordNotFoundexception when no record is foundHere's an example of usage of the APIs:
The APIs will be convenient for scripts API routes where you're already handling exceptions and want to fail fast.
Refer to the API reference in our docs to learn how
findUniqueOrThrowandfindFirstOrThrowdiffer fromfindUniqueandfindFirstrespectively.Deprecating
rejectOnNotFoundWe're deprecating the
rejectOnNotFoundparameter in favor of the newfindUniqueOrThrowandfindFirstOrThrowPrisma Client APIs.We expect the new APIs to be easier to understand and more type-safe.
Refer to the
findUniqueOrThrowandfindFirstOrThrowdocs to learn how you can upgrade.Fix rounding errors on big numbers in SQLite
SQLite is a loosely-typed database. While Prisma will prevent you from inserting values larger than integers, nothing prevents SQLite from accepting big numbers. These manually inserted big numbers cause rounding errors when queried.
Prisma will now check numbers in the query's response to verify they fit within the boundaries of an integer. If a number does not fit, Prisma will throw a
P2023error:To learn more on rounding errors with big numbers on SQLite, refer to our docs.
DbNull,JsonNull, andAnyNullare now objectsPreviously,
Prisma.DbNull,Prisma.JsonNull, andPrisma.AnyNullused to be implemented using string constants. This meant their types overlapped with regular string data that could be stored in JSON fields.We've now made them special objects instead that don't overlap with string types.
Before
4.0.0DbNullwas checked as a string so you could accidentally check for a null as follows:Expand to view the underlying Prisma schema
Prisma 4 resolves this using constants guaranteed to be unique to prevent this kind of inconsistent queries.
You can now read, write, and filter JSON fields as follows:
We recommend you double-check queries that use
Jsonafter upgrading to Prisma 4. Ensure that you use thePrisma.DbNull,Prisma.JsonNull, andPrisma.AnyNullconstants from Prisma Client, not string literals.Refer to the Prisma 4 upgrade guide in case you run into any type errors.
Prisma Studio updates
We've refined the experience when working with Prisma Studio with the following changes:
Dropped support for Node 12
The minimum version of Node.js Prisma will support is
14.17.x. If you're using an earlier version of Node.js, you will need to update your Node.js version.Refer to our system requirements for the minimum versions Prisma requires
New default sizes for statement cache
We had inconsistent and large default values (500 for PostgreSQL and 1000 for MySQL) for the
statement_cache_size. The new shared default value is 100.If the new default doesn't work for you, please create an issue and use the
statement_cache_size=xparameter in your connection string to override the default value.Renaming of
@prisma/sdknpm package to@prisma/internalsThe internal package
@prisma/sdkis now available under the new, more explicit name@prisma/internals.We do not provide any API guarantees for
@prisma/internalsas it might need to introduce breaking changes from time to time, and it does not follow semantic versioning.This is technically not a breaking change as usage of the
@prisma/sdkpackage is neither documented nor supported.If you're using
@prisma/sdk(now@prisma/internals), it would be helpful if you could help us understand where, how, and why you are using it by giving us feedback in this GitHub discussion. Your feedback will be valuable to us in defining a better API.Removal of the internal
schemaproperty from the generated Prisma ClientWe've removed the internal
Prisma.dmmf.schemato reduce the size of Prisma Client generated and improve boot times.To access the
schemaproperty, you can use thegetDmmf()method from@prisma/internals.Fixes and improvements
Prisma
statement_cache_sizetypealias with Prisma 4.0.0@uniqueis added during Re-Introspectionreferencesarg on Many2Many relations on SQLextendedIndexesGAextendedIndexesConfiguration
📅 Schedule: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), 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.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR has been generated by Mend Renovate. View repository job log here.