Skip to content

v2.1.3 🎉

Compare
Choose a tag to compare
@medz medz released this 12 Sep 21:33
· 1152 commits to main since this release

🌟 Help us spread the word about Prisma ORM for Dart by starring the repo or Tweeting about the release. 🌟

Major improvements:

  1. refactor PrismaClientKnownRequestError, Prisma Client throws a PrismaClientKnownRequestError exception if the query engine returns a known error related to the request - for example, a unique constraint violation. Reference 👉 PrismaClientKnownRequestError
  2. All exceptions on the client side will throw predictable errors,Reference 👉 PrismaClientKnownRequestError
  3. query_engine renamed to engine_core

Better error message

Take transaction errors as an example, before simply throwing PrismaServerError without any friendly prompts. Now:

PrismaClientUnknownRequestError:
Use the `prisma.$transaction()` API to run queries in a transaction.

Add the following to your `schema.prisma` file:

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["interactiveTransactions"]
}

Read more about transactions in our documentation:
 - https://github.com/odroe/prisma-dart#qa
 - https://www.prisma.io/docs/concepts/components/prisma-client/transactions#interactive-transactions-in-preview

If the engine is not found:

PrismaClientInitializationError:
  message: Could not find query engine binary for current platform "macos" in query-engine path.

This probably happens, because you built Prisma Client on a different platform.

Searched Locations:
  - /Users/seven/workspace/prisma/example
  - /Users/seven/workspace/prisma/example/.dart_tool/prisma
  - /Users/seven/workspace/prisma/example/prisma
  - /Users/seven/workspace/prisma/example/.dart_tool/pub/bin/example

You already added the platform "macos" to the "generator" block in the "schema.prisma" file as described in https://pris.ly/d/client-generator, but something went wrong. That's suboptimal.

Please create an issue at https://github.com/odroe/prisma-dart/issues/new
  errorCode: null
  clientVersion: 2.1.2

$transaction options

prisma.$transaction now supports the following options:

final prisma = PrismaClient();
await prisma.$transaction((prisma) async {
   // ...
}, TransactionOptions(
   maxWait: 2000,
   timeout: 5000,
   isolationLevel: TransactionIsolationLevel.ReadUncommitted,
));

More details 👉 Interactive transactions

Bug fixes

  1. Fixed packageVersion not updating with version
  2. Fixed binary query engine not automatically searching when executable is specified
  3. Fixed binary query engine not automatically searching when specifying PRISMA_QUERY_ENGINE_BINARY environment variable

Engines version

c875e43600dfe042452e0b868f7a48b817b9640b