Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
APACHE-2.0 License
Bot releases are hidden (Show)
Published by ruheni over 1 year ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
For this release, we focused on fixing bugs and making smaller quality-of-life improvements.
prisma db seed
This release adds support for defining and passing arbitrary arguments to prisma db seed
. This creates the opportunity for you to define your own arguments in your seed file that you could pass to the prisma db seed
command. A few example use-cases include, but are not limited to:
Here is an example seed.ts
file that defines custom arguments for seeding different data in different environments:
// prisma/seed.ts
import { parseArgs } from "node:util";
const options = {
environment: { type: 'string', },
}
async function main() {
const { values: { environment } } = parseArgs({ options })
switch (environment) {
case "development":
/** do something for development */
break;
case "test":
/** do something for test environment */
break;
default:
break;
}
}
main()
You can then provide the environment
argument when executing the seed script as follows:
npx prisma db seed -- --environment development
Let us know what you think, share example usage of this feature, and create a bug report if you run into any issues.
This release improves the error messages returned by Prisma Client when the Query Engine file is not found. A few reasons the Query Engine file might be missing from your application bundle include when:
We hope these error messages are helpful while debugging your application.
In this release, we made a few improvements to our VS Code extension:
Updated the file system watcher that is responsible for restarting the TypeScript server when prisma generate
is run to ensure the types are in sync
Note:
- This new approach is currently only available on Windows and Linux. We plan on adding support for the new file system watcher on macOS soon.
- This requires both Prisma CLI & VS code extension version
4.15.0
or higher
Added Quick Fixes action for unique identifiers for MongoDB to add the @map("_id")
attribute function when it’s missing on an identifier field
Support for renaming symbols for composite types and views
Error: write EPIPE
on WSL <-> Windowsprisma generate
is blocked by query-engine-rhel-openssl-1.0.x
opening in Notepad on Windowsnode_modules
(from another platform) leads to platform engine not being presentoutput
Query engine library for current platform "rhel-openssl-1.0.x" could not be found. You incorrectly pinned it to rhel-openssl-1.0.x
Cannot find name '$PrismaModel'
due to feature extendedWhereUnique
with preview feature fieldReference
Date
values silently turn into nulls
fieldReference
is not working with enumsprisma db seed
to the seed command@map("_id")
annotationHuge thanks to @RobertCraigie, @KhooHaoYit, @art049, @luxaritas, @mrazauskas, @maxmartynov, @haneenmahd for helping!
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, June 1 at 5 pm Berlin | 8 am San Francisco.
Published by millsp over 1 year ago
Today, we are issuing the 4.14.1
patch release.
Published by ruheni over 1 year ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
We would appreciate your feedback on a handful of Preview features to help us move them to General Availability soon. The Preview features include:
You can test them by enabling the Preview feature in your Prisma schema and giving them a try already in your Prisma schema, e.g., PostgreSQL extensions, or regenerating Prisma Client and trying them in your queries.
For the last couple of months, we've been working hard to improve the performance of Prisma Client. We also published a blog post on how How We Sped Up Serverless Cold Starts with Prisma by 9x, which we recommend you give it a read.
This release continues with the same theme by making the size of the generated Prisma Client smaller. We have roughly halved the size of Prisma Client's dependencies.
In 4.13.0, we introduced the first 6 introspection warnings that surface the existence of these features in your database and link to our documentation on how to manually work around the Prisma Schema with unsupported database features.
In this release, we added 3 more introspection warnings for the following features:
On introspecting a database using any of these features, you will get a warning from the Prisma CLI and a comment in your Prisma schema where the feature is being used. The warning will also contain a link to instructions on how to manually use the feature.
client
leads to Error: ENOENT: no such file or directory, open '.../node_modules/@prisma/client/schema.prisma'
thread 'tokio-runtime-worker' panicked at 'internal error: entered unreachable code: No unsupported field should reach that path', query-engine\connectors\sql-query-connector\src\model_extensions\scalar_field.rs:70:44
in
argument of filter types does not accept scalarsjsonProtocol
should report errors as nicely as beforeclient
: ENOENT: no such file or directory, open 'D:\<projectpath>\node_modules\.prisma\client\schema.prisma
Please create an issue ...
in MigrateEngine.ts
DbPull.ts
to the engine views
folder on introspection if no views are foundHuge thanks to @RobertCraigie, @KhooHaoYit, @art049, @luxaritas, @mrazauskas for helping!
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, May 11 at 5 pm Berlin | 8 am San Francisco.
Published by ruheni over 1 year ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
The Prisma Schema Language (PSL) currently doesn't support all database features and functionality of our target databases. The PSL is an abstraction over SQL and will keep evolving to address gaps in our database feature matrix.
Before this release, prisma db pull
did not pick up the unsupported features in a database. It was easy to lose them when running prisma migrate dev
based on an existing Prisma schema if not included in a migration file using custom migrations.
To avoid this, we added introspection warnings that surface the existence of these features in your database and link to our documentation on how to manually work around the Prisma Schema with unsupported database features.
In this release, we added introspection warnings for the following features:
NULLS FIRST
/ NULLS LAST
Prisma CLI will output warnings on introspection (prisma db pull
) and add comments to your Prisma schema. In the coming releases, we will expand this to many more features labeled with topic: database-functionality
on GitHub.
Netlify and Vercel cache project dependencies during the build process and reuse that cache until dependencies change. While this helps speed up the build process, any postinstall
scripts of these dependencies will not be executed.
Prisma uses a postinstall
script in its package to automatically trigger the customized generation of Prisma Client for your Prisma Schema. When a dependency cache is used, that generation process is not triggered, and an outdated Prisma Client may be used in your application.
When you update your Prisma Schema but not your dependencies, Prisma Client will not be generated for the new schema. For example, columns you added recently to one of your models will not be present in the Prisma Client API - causing errors.
This problem can be avoided by:
postinstall
script in your package.json
fileprisma generate
step to the “Build” scripts of Vercel and Netlify.We now added detection of this scenario and will prevent a build without an additional prisma generate
. This will ensure you're aware of the problem early and get guidance on how to fix this problem. You can read more on how to do this in our docs — Vercel caching troubleshooting, Netlify caching troubleshooting.
Before this release, Prisma only used npm scripts which would lead to undesirable behavior for a project using a different package manager such as pnpm and yarn. This release improves the detection of the package managers in your project by using ni
. If you're still running into this problem, let us know by creating a GitHub issue.
In this release, we've fixed a TLS connection error segmentation fault. This mostly affected users running on Node.js 17 or later with OpenSSL 1.1 when using TLS to connect to their database.
We have fixed multiple bugs for the jsonProtocol
Preview feature and are close to making it Generally Available. We are still looking for feedback about its usage to ensure it is ready and works as expected for everyone.
We would appreciate it if you would try it out, help us polish the feature, and move it to General Availability. Testing it requires little effort. You can test it using the following steps:
jsonProtocol
Preview feature in your Prisma schemaWe encourage you to leave your feedback in this GitHub issue or create a bug report if your run into any issues.
prisma generate
fails when using pnpm workspaces because it tries to install prisma dependencies with npm or yarnnode_modules
cache that contains generated Clientprisma generate
when @prisma/client
is not installed in projectpnpm install
hangs on @prisma/client
postinstall Huge thanks to @KhooHaoYit, @rintaun, @maxmartynov, @haneenmahd for helping!
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, April 20 at 5 pm Berlin | 8 am San Francisco.
Published by ruheni over 1 year ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
The views
Preview feature significantly improved this release: prisma db pull
now reads the SQL query used to define a view and stores it in a .sql
file in a views
folder next to your Prisma schema.
Note: These
.sql
files are not yet used for creating or updating views during migrations yet. For now, we are only looking for feedback. Let us know if the introspected SQL files match the views picked up in your database and if the correct files were created in your filesystem.
We encourage you to leave feedback in this GitHub issue.
In 4.11.0, we announced the jsonProtocol
Preview feature which had some rough edges. This release improves the Preview feature by providing polished and helpful error messages from Prisma Client when something goes wrong. Here is an example error message:
We would appreciate it if you would try it out to help us polish the feature and move it to General Availability. Testing it requires little effort. Please also leave any feedback in this issue, or open a new one if you want to report a bug.
In this release, we've improved the startup performance of Prisma Client. We're keen on improving the performance of Prisma Client. If you experience any problems with the startup performance, be sure to report them so that we can look into them.
This release adds support for Open Telemetry tracing (via the tracing
Preview feature) and logging to Prisma Client for Data Proxy.
db pull
fail with particular enum default value in columnfindUnique
used with Promise.all
returns null
PrismaPromise
export after update from 4.9.0 to 4.11.0Unique constraint failed on the fields
on query that worked in 4.10.1jsonProtocol
Field/Enum is not included in the result of the findFirst/findMany functionHuge thanks to @KhooHaoYit, @rintaun, @ivan, @art049 for helping!
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, March 30 at 5 pm Berlin | 8 am San Francisco.
Published by ruheni over 1 year ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
This release introduces an early Preview feature: JSON protocol.
During performance investigations and optimizations, we noticed that the existing implementation added a CPU and memory overhead that was especially noticeable for larger Prisma schemas. Therefore, we found an alternative way to express our queries without needing that overhead: JSON.
To try out the new protocol, enable the jsonProtocol
Preview feature in your Prisma schema:
generator client {
provider = "prisma-client-js"
previewFeatures = ["jsonProtocol"]
}
Regenerate Prisma Client to use the new JSON protocol.
For environments or situations where it is not viable to enable the Preview feature flag to your Prisma schema file, we also added an environment variable that you can use to force the use of the JSON Protocol Preview feature: PRISMA_ENGINE_PROTOCOL=json
.
Note: This is an early Preview feature with a significant limitation: Invalid input to Prisma Client will throw unpolished, internal errors that are less descriptive and user-friendly than our usual ones. We intend to improve these future releases. Using it with Data Proxy and Prisma Data Platform currently also leads to errors.
We expect using jsonProtocol
to improve Prisma Client's startup performance significantly. This will likely have a more significant impact on applications with larger Prisma schemas.
We would appreciate your feedback on this feature on the following particularly:
For feedback, please comment on the GitHub feedback issue.
You can now run prisma db pull
against your database to populate your Prisma schema with your views in MySQL, SQL Server, and CockroachDB.
To learn more, refer to our documentation on views introspection. Try it out and let us know your thoughts in this GitHub issue.
This release adds support for extending top-level raw query operations.
const prisma = new PrismaClient().$extends({
query: {
// relational databases
$queryRaw({ args, query, operation }) {
// handle $queryRaw operation
return query(args)
},
$executeRaw({ args, query, operation }) {
// handle $executeRaw operation
return query(args)
},
$queryRawUnsafe({ args, query, operation }) {
// handle $queryRawUnsafe operation
return query(args)
},
$executeRawUnsafe({ args, query, operation }) {
// handle $executeRawUnsafe operation
return query(args)
},
// MongoDB
$runCommandRaw({ args, query, operation }) {
// handle $runCommandRaw operation
return query(args)
},
},
})
If you've been using Prisma Client in a Next.js app in a monorepo setup, you might have seen this infamous error message:
Error: ENOENT: no such file or directory, open schema.prisma
We finally pinpointed the problem's source to the Next.js bundling step and opened an issue in the Next.js repository for Vercel to investigate and hopefully fix it.
In the meantime, we've created a workaround via a webpack plugin that makes sure your Prisma schema is copied to the correct location: @prisma/nextjs-monorepo-workaround-plugin
.
To use the plugin, first install it:
npm install -D @prisma/nextjs-monorepo-workaround-plugin
Import the plugin into your next.config.js
file and use it in config.plugins
:
const { PrismaPlugin } = require('@prisma/nextjs-monorepo-workaround-plugin')
module.exports = {
webpack: (config, { isServer }) => {
if (isServer) {
config.plugins = [...config.plugins, new PrismaPlugin()]
}
return config
},
}
For further information, refer to our documentation to learn how to use it and open an issue if it doesn't work as expected.
ENOENT: no such file or directory, open '...\.next\server\pages\api\schema.prisma'
Error: ENOENT: no such file or directory, open 'schema.prisma'
ENOENT
with custom output and ESM module in NPM monorepo (including Nextjs): no such file or directory, open /.../schema.prisma...
ignoreEnvVarErrors: true
Node API QE causes datasourceOverrides
to be ignoreddb pull
: add new codes for introspection warnings for views in the CLIdirectUrl
is prisma://
connection stringerrorCode: 'P1012' PrismaClientInitializationError: error: Environment variable not found: DATABASE_URL.
directUrl
env var value, leading to validation error (Affects PDP/Data Proxy and normal Engine)validate
to return Result<(), JsError>
in Wasm
moduleHuge thanks to @KhooHaoYit, @rintaun, @ivan, @Mini256, @Lioness100, @yukukotani, @sandrewTx08, @fubhy, @zachtil, @unflxw, @Mosaab-Emam for helping!
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, March 2 at 5 pm Berlin | 8 am San Francisco.
Published by millsp over 1 year ago
Today, we are issuing the 4.10.1
patch release.
Published by ruheni over 1 year ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
When working with connection poolers such as the Prisma Data Proxy, Accelerate or pgBouncer, it is necessary to use a different URL to connect to the database when using Prisma Client and Prisma Migrate.
We're introducing a new datasource property directUrl
to improve this. When the directUrl
property is present, the Prisma CLI will use it to connect to the database for tasks such as introspection and migrations.
# .env
# Connection to Prisma Data Proxy. Used by Prisma Client.
DATABASE_URL="prisma://__HOST__/?api_key=__KEY__"
# Connection to the database. Used for migrations and introspection.
DIRECT_URL="postgresql://__USER__:__PASSWORD__@__HOST__:__PORT__/__DATABASE__"
// ./prisma/schema.prisma
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
To learn more, refer to our documentation.
We introduced initial support for database views in 4.9.0 with the addition of the view
keyword. This release introduces introspection support for PostgreSQL views. You can run prisma db pull
against your database to populate your Prisma schema with your views.
To learn more, refer to our documentation on views introspection. Try it out and let us know your thoughts in this GitHub issue.
Currently, the Prisma Schema Language(PSL) does not cover the full feature sets of different database providers. For the unsupported database functionality, Prisma provides offers escape hatches like raw queries or manual editing of the migration files.
While we work on adding support for missing database functionality, e.g. database views, some of it is not fully-supported and the escape hatches fail. Objects that use unsupported properties might not be caught during introspection and raw queries might not work. Re-introspection may sometimes remove the information from the schema file and the generated migrations may be invalid or re-generate the same SQL repeatedly.
We're therefore fixing the defects and supporting the unsupported database functionalities Prisma currently doesn't support. We created a list of these features in this GitHub issue we would like to improve.
This release improves introspection support for partitioned tables in PostgreSQL and MySQL. Previously, Prisma would pick up the partitions as model
s and miss the actual main table. Prisma will now pick up the main table as a model
, not the partitions.
If you're already using partitioned tables in your database, you can use prisma db pull
to update your Prisma schema. If you're already using Prisma and want to partition a table in your database, you can:
prisma migrate dev --create-only
prisma migrate dev
to apply the draft migration to your databaseTry it out and let us know what you think. If you run into an issue, feel free to create a bug report.
In 4.8.0, we decreased the size of the engines by ~50%, which significantly impacted Prisma Client, especially in serverless environments.
In this release, we've reduced the size of Prisma CLI by removing the Introspection and Formatter engines. The introspection functionality is now served by the Migration Engine. A cross-platform Wasm module has entirely replaced the Formatter Engine. This reduces the overall installation size for Prisma CLI.
aarch64-unknown-linux-musl
target (Alpine Linux on ARM, e.g. M1)getDmmf
as Wasm module that could be used in Prisma CLIprisma-fmt
formatter binaryintrospection-engine
binary from CLIget-platform
error for non-amd64
Alpine introduced in [email protected]
prevents using custom Prisma enginesError: Unknown binaryTarget debian-openssl-0.0.x and no custom engine files were provided
after upgrading from 4.8.1 to 4.9.0referentialIntegrity
in favor of relationMode
directUrl
Huge thanks to @rintaun, @ivan, @Mini256, @yukukotani, @sandrewTx08 for helping!
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, February 9 at 5 pm Berlin | 8 am San Francisco.
Published by ruheni almost 2 years ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
This release introduces a new keyword, view
, behind the views
Preview feature flag. You can manually add a view
to your Prisma schema, which is ignored when running migrations. This is a small step forward but should already be helpful to many of you depending on workarounds and shell scripts to work with views and Migrate.
Here is an example usage of views
:
generator client {
provider = "prisma-client-js"
previewFeatures = ["views"]
}
view UserInfo {
id Int @id
// from the User model
email String
name String
// from the Profile model
bio String
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
profile Profile?
}
model Profile {
id Int @id @default(autoincrement())
bio String
user User @relation(fields: [userId], references: [id])
userId Int @unique
}
To learn more, head to our documentation. Try it out and let us know your thoughts on this GitHub issue.
We're thrilled to share that this release adds Preview support for multi-schema for SQL Server.
This release adds support for:
If you already have a SQL Server database using multiple schemas, you can quickly get up and running and set up multiple schemas by:
schemas
property in the datasource
blockprisma db pull
You can further evolve your database schema using the multi-schema Preview feature by using prisma migrate dev
.
For further details, refer to our documentation and let us know what you think in this GitHub issue.
In this release, we've made a number of improvements to the Prisma Client Extensions Preview feature:
Retrieving the current model name at runtime
You can now get the name of the current model at runtime using Prisma.getExtensionContext(this).name
. You might use this to write out the model name to a log, to send the name to another service, or to branch your code based on the model. You can learn more about this in our docs.
Improved type safety when defining custom model methods
Prisma Client now provides a set of type utilities that tap into input and output types. They are fully dynamic, which means they adapt to any given model and schema. You can use them to improve your custom model methods' auto-completion. This is especially useful in shared extensions. Learn more about this in our docs.
Let us know what you think in this GitHub issue and in case you run into any issues, please create a bug report.
In this release, we moved the Introspection Engine (responsible for prisma db pull
) which the Migration Engine will now serve. Previously, the Introspection Engine was stand-alone.
Let us know what you think in this GitHub issue and in case you run into any issues, please create a bug report.
WriteConflict
bug fixThis version also comes with a notable bug fix: In our MongoDB provider, any queries that are returned with a WriteConflict
error Prisma now will retry the query, similar to how other MongoDB drivers and clients do.
If you are using a JetBrains IDE the team over at JetBrains recently released an official Prisma plugin in their Plugin Marketplace.
Thank you, @JetBrains, for working on this! Next to our VS Code extension for Prisma and our general language server, which works in many editors, most relevant editors should now be covered.
We’re thrilled to announce Early Access to Accelerate.
Accelerate is a global database cache. It is available in 280 locations and has built-in connection pooling for serverless apps. You can make your queries up to 1000 times faster on any Prisma-supported database, reducing your query response times.
Join the waiting list for Accelerate here.
openssl
or libc
installation to improve snapshot testing suite--schemas
param to the db pull
commandschemas
property different when cross schema references are detected (when multiSchema
preview feature is enabled)db pull
with multiSchema
enabled and schemas
defined, outputs public
in CLI message anywayschemas
property in datasource
@@schema
attributedebian
distrosmultiSchema
: add schemas
property to getConfig
outputmigrate reset
with sqlserver does not delete second schemaopenssl
detection for Linux distros besides Alpine and Debian-based distros, like RHELThese enums were enriched with
@@map information taken from the previous Prisma schema.
but the schema file datamodel is actually empty.view
keywordplatform-serverless-vercel/vercel-cli
ecosystem testsdistro
is undefined, the output of ldconfig
is ignored because of the sed: -e expression #1, char 7: unknown option to
s'` silent errorwhere
and include
produces an object that doesn't include entities you specify in include
delete
on a one-to-one relation while updating removes other relations@@schema
attribute to model / enumview
keyword2.9.1
to 2.10.1
introspect
tests to migration-engine
Huge thanks @rintaun, @ivan, @Mini256, @fubhy, @unflxw, @Mosaab-Emam for helping!
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, January 26 at 5 pm Berlin | 8 am San Francisco.
Published by SevInf almost 2 years ago
Today, we are issuing the 4.8.1
patch release.
Published by ruheni almost 2 years ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
In this release, we have decreased the size of our engine files by an average of 50%. The size of the Query Engine used on Debian, with OpenSSL 3.0.x, for example, went from 39MB to 14MB. We will also remove some smaller engines to decrease the total size in future versions.
Additionally, we have started optimizing how the Prisma schema is loaded in Prisma Client. You should notice a considerable improvement when executing the first query if you're working with a bigger schema with many models and relations.
We will continue investing in this direction in the next releases and further improve the experience with Prisma and serverless environments.
We're pleased to share that this release adds Preview support for multi-schema for CockroachDB. 🎉
This release adds support for:
If you already have a CockroachDB database using multiple schemas, you can quickly get up and running set up multiple schemas by:
schemas
property in the datasource
blockprisma db pull
You can further evolve your database schema using the multi-schema Preview feature by using prisma migrate dev
.
For further details, refer to our documentation and let us know what you think in this GitHub issue.
Prisma now supports OpenSSL 3 builds for Linux Alpine on x86_64
architectures. This particularly impacts users running Prisma on node:alpine
and node:lts-alpine
Docker images. The images are based on an Alpine version that ships with OpenSSL 3.0.x, which isn’t compatible with OpenSSL 1.1.x (already supported by Prisma). You can read more details about it in this GitHub comment.
We also have rewritten our OpenSSL version detection logic, making it future-proof. We now expect Prisma to support systems running with any OpenSSL 3 minor versions out of the box.
Uuid
has no default operator class.migrate reset
only resets first schemamultiSchema
introspectionmigrate dev
does not detect drift between database schema and migration history for multiSchema
multiSchema
preview feature with MySQLclientExtensions
preview feature is used$extends
TS error: "Inferred type of this node exceeds the maximum length the compiler will serialize" with "declaration": true
in tsconfig
args
is undefined
console.log
outputs incorrect value when result
extensions are usedextendedWhereUnique
on SQL@map
although already present'
in optional arguments context@@schema
attribute should always be required when schemas
is defined in the datasourceHuge thanks to @ivan, @Mini256, @cmd-johnson for helping!
We recently just launched our Help Center that you can use to find resources and get help from our support team for both the Prisma ORM and the Prisma Data Platform.
Check it out, and let us know what you think.
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, December 22 at 5 pm Berlin | 8 am San Francisco.
Published by SevInf almost 2 years ago
Today, we are issuing the 4.7.1
patch release.
Published by ruheni almost 2 years ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
After an extensive Preview phase and lots of great feedback from our community, we're excited to announce that interactiveTransactions
is now Generally Available and production ready! 🚀
Interactive transactions allow you to pass an async function into a $transaction
, and execute any code you like between the individual Prisma Client queries. Once the application reaches the end of the function, the transaction is committed to the database. If your application encounters an error as the transaction is being executed, the function will throw an exception and automatically rollback the transaction.
Here are some of the feature highlights we've built:
4.2.0
4.6.0
Here's an example of an interactive transaction with a Serializable
isolation level:
await prisma.$transaction(
async (prisma) => {
// Your transaction...
},
{
isolationLevel: Prisma.TransactionIsolationLevel.Serializable,
maxWait: 5000,
timeout: 10000,
}
)
You can now remove the interactiveTransactions
Preview feature in your schema.
This release marks relationMode="prisma"
as stable for our users working with databases that don't rely on foreign keys to manage relations. 🎉
Prisma’s relation mode started as a way to support PlanetScale which does not allow you to create foreign keys for better online migration support. We transformed that into our Referential Integrity Emulation in 3.1.1
when we realised that more users could benefit from it, and then integrated it as the default mode for MongoDB, which generally does not have foreign keys. Prisma needed to use emulation to give the same guarantees.
We then realized the feature was more than just referential integrity and affected how relations work. To reflect this, we renamed the feature to relation mode and the datasource
property to relationMode
in 4.5.0
relationMode = "prisma"
In this release, we've added a warning to our Prisma schema validation that informs you that the lack of foreign keys might result in slower performance — and that you should add an @@index
manually to your schema to counter that. This ensures your queries are equally fast in relation mode prisma
as they are with foreign keys.
With
relationMode = "prisma"
, no foreign keys are used, so relation fields will not benefit from the index usually created by the relational database under the hood. This can lead to slower performance when querying these fields. We recommend manually adding an index.
We also added a fix to our VS Code extension to help adding the suggested index with minimal effort:
If you are currently using the Preview feature flag to enable relation mode, you can now remove referentialIntegrity
from the previewFeatures
in your generator client
block in your Prisma schema.
For more information, check out our updated relation mode documentation.
This release adds Preview support for Prisma Client Extensions. This feature introduces new capabilities to customize and extend Prisma Client. Today we are opening up four areas for extending Prisma Client:
model
: add custom methods or fields to your modelsclient
: add client-level methods to Prisma Client
result
: add custom fields to your query results
query
: create custom Prisma Client queries
Prisma Client Extensions are self-contained scripts that can tweak the behavior of models, queries, results, and the client (Prisma Client) as a whole. You can associate a single or multiple extensions with an extended client to mix and match Prisma to your needs.
Prisma Client Extensions enables many use cases such as defining virtual fields, custom validation, and custom queries.
It also enables you to share your client extensions with others and import client extensions developed by others into your project.
For example, given the following schema:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["clientExtensions"]
}
model User {
id Int @id @default(autoincrement())
email String @unique
firstName String?
lastName String
}
You can create a computed field called fullName
as follows:
import { PrismaClient } from "@prisma/client"
const prisma = new PrismaClient()
.$extends({
result: {
user: {
fullName: {
// the dependencies
needs: { firstName: true, lastName: true },
compute(user) {
// the computation logic
return `${user.firstName} ${user.lastName}`
},
},
},
},
})
We're excited to see what you build with them! For more information, check out our docs and let us know what you think in this GitHub issue.
We're pleased to announce that this release adds support for multi-schema support for PostgreSQL. The ability to query and manage multiple database schemas has been a long-standing feature request from our community.
This release adds support for the following:
If you already have a PostgreSQL database using multiple schemas, you can quickly get up and running using prisma db pull
— on enabling the Preview feature and specifying the schemas in the datasource
block similar to the example below.
You can get started with defining multiple schemas in your Prisma schema as follows:
generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
schemas = ["base", "transactional"]
}
model User {
id Int @id
orders Order[]
@@schema("base")
}
model Order {
id Int @id
user User @relation(fields: [id], references: [id])
user_id Int
@@schema("transactional")
}
Then generate and apply the changes to your database with prisma migrate dev
.
We want to thank all our users for helping us design the feature since the early proposal on GitHub up to our current Preview release.
For further details, refer to our documentation and let us know what you think in this GitHub issue.
Our Product team is currently running a survey for designing Database Views support for Prisma and we would appreciate your feedback.
RangeError: Invalid count value
during npx prisma generate
with DEBUG=*
on integration buildreferentialIntegrity
binary
engineerror
eventPrisma.TransactionClient
to default-index.d.ts
findMany
errors with PANIC: index out of bounds: the len is 0 but the index is 0
upsert()
with nested selection errors with called
Option::unwrap()on a
None value
in 4.6.0findUnique
concurrently with different key order causes one of them to return nullfindUniqueOrThrow
via middlewareprisma
/ Reproduction test for prisma#16390referentialIntegrity
(renamed to relationMode
)db pull
with multiSchema
error on schema with 2 models with the same table name but in a different schemarelationMode
: make feature GASetDefault
validation error with warnings when provider = "mysql"
and relationMode = "foreignKeys" | default
relationMode
validation warning messages prisma validate
& prisma format
prisma migrate dev
@@ignore
d and fields that are @ignore
dreferentialIntegrity = "prisma"
extensions
when postgresqlExtensions
preview feature is setrelationMode
GA - remove preview feature conditionrelationMode="prisma"
, for @relation
: add a warning if there is no index on the field(s)relationMode
: missing foreign keys' indexesHuge thanks to @cmd-johnson, @jsoref, @miguelgargallo for helping!
We're working on the Prisma Data Platform — a collaborative environment for connecting apps to databases. It includes the following:
Try it out. Let us know what you think!
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, December 1 at 5 pm Berlin | 8 am San Francisco.
Published by Jolg42 almost 2 years ago
Today, we are issuing the 4.6.1
patch release.
findMany
errors with PANIC: index out of bounds: the len is 0 but the index is 0
upsert()
with nested selection errors with called
Option::unwrap()on a
None value
in 4.6.0Published by ruheni almost 2 years ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
In 3.8.0, we disabled the interactiveTransactions
Preview feature when using the Prisma Data Proxy. This was because the API was not yet supported.
In this release, we're removing the limitation. You can now try the Preview version of interactive transactions with the Prisma Data Proxy. Re-generate Prisma Client using prisma generate --data-proxy
after enabling the Preview feature.
Note: The interactiveTransactions
Preview feature flag is still needed. We will remove this in a future version when the feature is stable.
Try it out and let us know your thoughts in our interactive transactions feedback GitHub issue.
Prisma’s upsert is one of its most powerful and most convenient APIs. In this release, Prisma will now default to the native database upsert for PostgreSQL, SQLite, and CockroachDB whenever possible.
Prisma will use the native database upsert if:
upsert
's create
and update
options
upsert
's where
optionwhere
option and the unique field in the create
option have the same valuePrisma Client's upsert
operation was implemented on a Prisma-level and did not use the native database implementations like, e.g., INSERT .. ON CONFLICT .. UPDATE SET
. This allowed Prisma to also upsert nested queries.
The Prisma-implementation came at a cost. In some scenarios, it was more likely for a transaction to roll back because of a conflict when multiple upsert
operations were being executed in parallel, and the multiple queries often took longer than the native database query would have taken.
Try it out and let us know what you think. If you run into any issues, don't hesitate to create a GitHub issue.
In 4.5.0, we renamed the "Referential Integrity" Preview feature to "Relation Mode". We also changed the datasource
property name of the feature to relationMode
.
In this release, we fixed all remaining known bugs of relationMode = "prisma"
and cleaned up our documentation. You can now read about Relation mode on its own documentation page which is up to date with the implementation.
If you encounter any problems please comment on our feedback issue. We plan to make this Generally Available soon.
extendedWhereUnique
improvements (Preview)In 4.5.0, we introduced the extendedWhereUnique
Preview feature to allow filtering for non-unique properties in unique where queries. In this release, we're adding new rules to decide when concurrent findUnique
queries get batched into a findMany
query.
Unfortunately, we forgot to adapt our findUnique
query batch optimization, which turns multiple concurrent findUnique
queries into a single findMany
query when possible — GitHub issue.
Therefore, findUnique
queries will get batched into a findMany
query if:
where: { field: <val>, field1: { equals: <val> } }
)Conversely, suppose the filter object contains any boolean operators, relation filters, or scalar filters that are not using equals
. Prisma will fall back to executing the findUnique
queries independently.
Let us know your thoughts and share your feedback on the Preview feature in this GitHub issue.
relationMode=prisma
upsert()
should do ON CONFLICT DO UPDATE/NOTHING in postgresqlbinary
EnginereferentialIntegrity = "prisma"
): Make NoAction
a synonym/alias of Restrict
for the emulation, for all databases except PostgreSQL & SQLite.OnDelete: SetNull
with referentialIntegrity = "prisma"
user.delete()
should fail, but succeeds.referentialIntegrity = prisma
not respected when using @@map()
SetNull
referential action referencing non-optional fieldsreferentialIntegrity
policy is lost during re-introspectionAre you building data-intensive applications in serverless environments using Prisma? If so, you should join our Design Partner Program to help us build the tools that best fit your workflows!
The Design Partner Program aims to help development teams solve operational, data-related challenges in serverless environments. Specifically, we’re looking to build tools that help with the following problems:
Submit an application through our application form to join the Prisma Design Partner Program to take advantage of new features that you won't have to build or maintain yourselves.
We're working on the Prisma Data Platform — a collaborative environment for connecting apps to databases. It includes the following:
Try it out. Let us know what you think!
Learn about the latest release and other news from the Prisma community by joining us for another "What's new in Prisma" live stream.
The stream takes place on YouTube on Thursday, November 10 at 5 pm Berlin | 8 am San Francisco.
Huge thanks to @cmd-johnson for helping!
Published by TasinIshmam about 2 years ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
In this release, we are adding support for non-unique properties inside the where
statement for queries that operate on a unique record (e.g.: findUnique
, update
, delete
, etc.). This was not possible in the past, as we only allowed unique fields as filters inside the where
statement for the queries in question.
There are use cases where a query that operates on a unique record requires further filtering by non-unique properties. For example, for the following model:
model Article {
id Int @id @default(autoincrement())
content String
version Int
}
Let’s say that you would like to update the Article
with an id
of “5”, but only if the version
equals "1":
await prisma.article.update({
where: { id: 5, version: 1 }, // `version` field was not available before Prisma 4.5.0
data: {
content: "Incredible new story",
version: { increment: 1 },
},
});
With 4.5.0
, we are adding support to specify any number of non-unique fields in your where
statement, as long as you have at least one unique field.
To use it, enable the Preview feature flag:
generator js {
provider = "prisma-client-js"
previewFeatures = ["extendedWhereUnique"]
}
To learn more about this feature and about use cases where it can be useful, please check out our documentation. For feedback, please leave a comment on the GitHub issue.
We are excited to add support for declaring PostgreSQL extensions in the Prisma schema. The feature comes with support for introspection and migrations. This will allow you to adopt, evolve and manage which PostgreSQL database extensions are installed directly from within your Prisma schema.
💡 This feature adds support to manage PostgreSQL extensions in Prisma schema. It does not provide additional query capabilities and datatypes in Prisma Client.
To try this feature, enable the Preview feature flag:
generator client {
provider = "prisma-client-js"
previewFeatures = ["postgresqlExtensions"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
Now you will be able to use the new extensions
property in the datasource
block of your Prisma schema.
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
extensions = [hstore(schema: "myHstoreSchema"), pg_tgrm, postgis(version: "2.1")]
}
⚠️ To avoid noise from introspection, we currently only introspect the following allow-list:
citext
,pgcrypto
,uuid-ossp
, andpostgis
. But you can add and configure any extension to your Prisma schema manually.
Please visit our documentation to learn more about this feature or leave a comment with feedback on the GitHub issue.
datasource
block renamed to relationMode
(Preview)To prepare Prisma Client’s emulation of relations for general availability, we are releasing several improvements to the referentialIntegrity
Preview feature.
We decided to rename the feature to Relation Mode. We think this closer reflects what this feature does and distinguishes it from integrity management on the database level. The related property in the datasource
block of the Prisma schema has also been changed from referentialIntegrity
to relationMode
.
⚠️ The Preview feature flag inside the
generator
block of the Prisma schema is still calledreferentialIntegrity
.
To use it, keep using the old referentialIntegrity
Preview feature flag:
generator js {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
But use the new property name in the datasource
:
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
relationMode = "prisma"
}
We also removed the referential action NoAction
for PostgreSQL and SQLite when using relationMode = "prisma"
as we are not planning to support the details of the database behavior.
To learn more about relationMode
, please check out the documentation or leave a comment on the GitHub issue.
Deno is an alternative JavaScript runtime that can replace Node.js to run JS and TS apps. It aligns itself closely with web technologies, claims to be secure by default, and supports TypeScript out of the box.
Today we are releasing initial support for Prisma with Deno via an integration for our Prisma Client for Data Proxy. This feature was developed together with the amazing team at Deno 🦕.
To use Prisma Client in a Deno project, add the deno
Preview feature flag to your Prisma schema and define a folder as output
(this is required for Deno):
generator client {
provider = "prisma-client-js"
previewFeatures = ["deno"]
output = "../generated/client"
}
Now you can generate Prisma Client with the Data Proxy using the command npx prisma generate --data-proxy
. Then use Prisma Client in your Deno script with the following import:
import { PrismaClient } from './generated/client/deno/edge.ts'
const prisma = new PrismaClient()
async function main() {
const users = await prisma.user.findMany()
console.log({ users })
}
main()
You can also deploy an app built and configured like this on Deno Deploy, Deno’s deployment platform. Read this guide in our documentation for a full example and individual steps.
For feedback, please comment on this GitHub issue.
Many people were having issues with an "Invalid string length" error both in Prisma Studio and Prisma Data Platform Data Browser. This issue can be resolved through this workaround. With this release, the root cause of this issue has been fixed and it should not occur again.
In 4.3.0
, we shared a proposal for Prisma Client Extensions on Github. We received a lot of great feedback, which we have incorporated into a new proposal.
If you’re interested, please head over to the new proposal in GitHub and tell us what you think. Thank you!
onDelete: setDefault
referentialIntegrity
modes makes migration history obsoletereferentialIntegrity
and relationMode
relationMode
(previously referentialIntegrity
) in the datasource blockHuge thanks to @kt3k, @abenhamdine, @jsoref for helping!
Published by Jolg42 about 2 years ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
In the last sprint, we focused our efforts on squashing as many bugs as we could. You can find the full list of improvements and bug fixes in the Fixes and improvements section below.
Some of the improvements we made include but are not limited to:
Can't reach database server
error message (GitHub issue). The error message will now be more useful (P2035
error code), and Prisma Client should not cause these errors anymore.If you notice any regression, please make sure to create a GitHub issue. We touched a lot of code in this sprint, and even though we are confident in our tests, something might have slipped through the cracks. We'd like to fix the regressions as soon as possible.
isolationLevel
for sequential transaction operationsIn version 4.2.0
, we added support for setting transaction isolation levels for interactive transactions (Preview). You can now define isolation levels for sequential transaction operations: prisma.$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 isolationLevel
option in the second parameter of the API. For example:
await prisma.$transaction(
[
// sequential operations
prisma.user.create({ data: {/** args */ } }),
prisma.post.create({ data: {/** args */ } })
],
{
isolationLevel: Prisma.TransactionIsolationLevel.Serializable
}
)
Prisma Client supports the following isolation levels if they're available in your database provider:
ReadCommitted
ReadUncommitted
RepeatableRead
Serializable
Snapshot
Learn more about it in our documentation.
P2034
error code for transaction conflicts or deadlocksWhen using certain isolation levels, it is expected that a transaction can fail due to a write conflict or a deadlock, throwing an error. One way to solve these cases is by retrying the transaction.
To make this easier, we're introducing a new PrismaClientKnownRequestError
with the error code P2034
: "Transaction failed due to a write conflict or a deadlock. Please retry your transaction". You can programmatically catch the error and retry the transaction. Here's an example showing how you can retry a transaction:
import { Prisma, PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
const MAX_RETRIES = 5
let retries = 0;
let result;
while (retries < MAX_RETRIES) {
try {
result = await prisma.$transaction(
[
prisma.user.deleteMany({ where: { /** args */ } }),
prisma.post.createMany({ data: { /** args */ } })
],
{
isolationLevel: Prisma.TransactionIsolationLevel.Serializable
}
)
} catch (error) {
if (error.code === 'P2034') {
retries++
continue
}
throw error
}
}
}
rejectOnNotFound
updateMany()
causes lost-updatesList<String | DateTime>
into field of type List<String>
$transaction([deleteMany, createMany])
numeric
rangeThe provided database string is invalid. Unable to parse URL. in database URL.
on invalid (?) connection stringcreatedAt @default(now())
and updatedAt @updatedAt
get different times on row creation$foo
Error: The provided database string is invalid. Unable to parse URL. in database URL.
findRaw
does not work within an interactiveTransaction
parent result: Some(ManyRecords { records: [Record { values: [Int(3), Int(1), DateTime(2022-08-08T12:27:55.310+00:00)], parent_id: None }], field_names: ["id", "userId", "createdAt"] }), relation: Relation { name: "post", model_a_name: "Comment", model_b_name: "Post", model_a: OnceCell((Weak)), model_b: OnceCell((Weak)), field_a: OnceCell((Weak)), field_b: OnceCell((Weak)), manifestation: Inline(InlineRelation { in_table_of_model_name: "Comment" }), internal_data_model: "#InternalDataModelWeakRef#" }
Result::unwrap()
on an Err
value: FingerprintError("Could not retrieve hostname")findUnique
concurrently with a DateTime
column causes it to return null
prisma:engine
spans always get sampled when using probability based samplersprisma init
is listing wrong valuesN/A
error and message with large raw queriesOption::unwrap()
on a None
valueQuery ... is required to return data, but found no record(s)
findRaw
, aggregateRaw
and runCommandRaw
in sequential transactionsdbgenerated()
- invalid migration created with no schema change$disconnect
never returns if engine failed to startHuge thanks to @abenhamdine, @miguelgargallo, @Clansty, @panoplied, @MEnnabah, @drzamich, @AndrewSouthpaw, @kt3k for helping!
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.
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!
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 29 at 5 pm Berlin | 8 am San Francisco.
Published by millsp about 2 years ago
Today, we are issuing the 4.3.1
patch release.
Published by ruheni about 2 years ago
🌟 Help us spread the word about Prisma by starring the repo or tweeting about the release. 🌟
We're excited to announce Preview support for field references. You can enable it with the fieldReference
Preview feature flag.
Field references will allow you to compare columns against other columns. For example, given the following schema:
generator client {
provider = "prisma-client-js"
previewFeatures = ["fieldReference"]
}
model Invoice {
id Int @id @default(autoincrement)
paid Int
due Int
}
You can now compare one column with another after running prisma generate
, for example:
// Filter all invoices that haven't been paid yet
await prisma.invoice.findMany({
where: {
paid: {
lt: prisma.invoice.fields.due // paid < due
}
}
})
Learn more about field references in our documentation. Try it out and let us know what you think in this GitHub issue.
In this release, we're adding support for the ability to count by a filtered relation. You can enable this feature by adding the filteredRelationCount
Preview feature flag.
Given the following Prisma schema:
generator client {
provider = "prisma-client-js"
previewFeatures = ["filteredRelationCount"]
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
title String
content String?
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}
You can now express the following query with the Preview feature after re-generating Prisma Client:
// Count all user posts with the title "Hello!"
await prisma.user.findMany({
select: {
_count: {
select: {
posts: { where: { title: 'Hello!' } },
},
},
},
})
Learn more in our documentation and let us know what you think in this issue
In this release, we're adding very early Preview support of multi-schema support for PostgreSQL and SQL Server behind the multiSchema
Preview 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.
We've made several improvements to the Prisma CLI:
prisma migrate dev
previously returned a successful exit code (0) when prisma db seed
was triggered but failed due to an error. We've fixed this and prisma migrate dev
will now exit with an unsuccessful exit code (1) when seeding fails.
prisma migrate status
previously returned a successful exit code (0) in unexpected cases. The command will now exit with an unsuccessful exit code (1) if:
/prisma/migrations
folder)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).
tracing
Preview featureBefore this release, you may have occasionally seen some traces that took 0μs working with the tracing
Preview 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 format
now uses a Wasm moduleInitially, the prisma format
command relied on logic from the Prisma engines in form of a native binary. In an ongoing effort to make prisma
more portable and easier to maintain, we decided to shift to a Wasm module.
prisma format
now uses the same Wasm module as the one the Prisma language server uses, i.e. @prisma/prisma-fmt-wasm
, which is now visible in prisma version
command's output.
Let us know what you think. In case you run into any issues, let us know by creating a GitHub issue.
⚠️ This may affect your query results if you relied on this buggy behavior in your application.
While implementing field reference support, we noticed a few correctness bugs in our MongoDB connector that we fixed along the way:
mode: insensitive
alphanumeric comparisons (e.g. “a” > “Z”) didn’t work (GitHub issue)mode: insensitive
didn’t exclude undefined (GitHub issue)isEmpty: false
on lists types (e.g. String[]) returned true when a list is empty (GitHub issue)hasEvery
on list types wasn’t aligned with the SQL implementations (GitHub issue)⚠️ This may affect your query results if you relied on this buggy behavior in your application.
We also noticed a few correctness bugs in when filtering JSON values when used in combination with theNOT
condition. For example:
await prisma.log.findMany({
where: {
NOT: {
meta: {
string_contains: "GET"
}
}
}
})
model Log {
id Int @id @default(autoincrement())
level Level
message String
meta Json
}
enum Level {
Info
Warn
Error
}
If you used NOT
with any of the following queries on a Json
field, double-check your queries to ensure they're returning the correct data:
string_contains
string_starts_with
string_ends_with
array_contains
array_starts_with
array_ends_with
gt
/gte
/lt
/lte
The Prisma language server now provides Symbols in VS Code. This means you can now:
See the different blocks (datasource
, generator
, model
, enum
, and type
) of your Prisma schema in the Outline view. This makes it easier to navigate to a block in 1 click
A few things to note about the improvement are that:
Enable Editor sticky scroll from version 1.70
of VS Code. This means you can have sticky blocks in your Prisma schema, improving your experience when working with big schema files
Make 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!
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
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:
Here’s a glimpse at how that will look:
const prisma = new PrismaClient().$extend({
$result: {
User: {
fullName: (user) => {
return `${user.firstName} ${user.lastName}`
},
},
},
$model: {
User: {
signup: async ({ firstName, lastName, email, password }) => {
// validate and create the user here
return prisma.user.create({
data: { firstName, lastName, email, password }
})
},
},
},
})
const user = await prisma.user.signup({
firstName: "Alice",
lastName: "Lemon",
email: "[email protected]",
password: "pri$mar0ckz"
})
console.log(user.fullName) // Alice Lemon
For further details, refer to this GitHub issue. Have a read and let us know what you think!
@prisma/prisma-fmt-wasm
to CLI and output dependency version in -v
, use instead of Formatter Engine binarydb push
output in MongoDBdmmf
raises "Schema parsing - Error while interacting with query-engine-node-api library" misleading error message when there is a schema validation error.migrate status
should return a non-successful exit code (1) when a failed migration is found or an error occursmigrate dev
should return a non-successful exit code (1) when there is an error during seedingHuge thanks to @abenhamdine, @drzamich, @AndrewSouthpaw, @kt3k, @lodi-g, @Gnucki, @apriil15, @givensuman for helping!
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!
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.
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.
Published by SevInf about 2 years ago
Today, we are issuing the 4.2.1
patch release.