部署到不同的操作系统
Prisma 客户端依赖于与你的应用在同一主机上作为二进制文件运行的 查询引擎。
¥Prisma Client depends on the query engine that is running as a binary on the same host as your application.
从 v6.16.0 开始,Prisma ORM 可以在生产应用中不使用 Rust 引擎使用。了解更多 此处。
¥As of v6.16.0, Prisma ORM can be used without Rust engines in production applications. Learn more here.
启用后,你的 Prisma 客户端将不包含基于 Rust 的查询引擎二进制文件:
¥When enabled, your Prisma Client will be generated without a Rust-based query engine binary:
generator client {
provider = "prisma-client-js" // or "prisma-client"
output = "../src/generated/prisma"
engineType = "client" // no Rust engine
}
请注意,如果你想在不使用 Rust 引擎的情况下使用 Prisma ORM,则需要 驱动适配器。
¥Note that driver adapters are required if you want to use Prisma ORM without Rust engines.
你可以在我们的博客上了解此更改。
¥You can read about the performance and DX improvements of this change on our blog.
查询引擎是用 Rust 实现的,并由 Prisma Client 以可执行二进制文件的形式使用。调用 prisma generate
时会下载二进制文件。
¥The query engine is implemented in Rust and is used by Prisma Client in the form of executable binary files. The binary is downloaded when prisma generate
is called.
例如,如果你在 Windows 计算机上开发了应用,并希望上传到 Linux 环境 AWS Lambda,则你可能会遇到问题,并在终端中看到一些警告。
¥If you have developed your application on a Windows machine for example, and wish to upload to AWS Lambda, which is a Linux environment, you may encounter issues and be presented with some warnings in your terminal.
要解决此问题,如果你提前知道将部署到不同的环境,则可以使用 二进制目标 并指定应包含哪些 支持的操作系统 二进制文件。
¥To solve this, if you know ahead of time that you will be deploying to a different environment, you can use the binary targets and specify which of the supported operating systems binaries should be included.
注意:如果你的操作系统不受支持,你可以包含 自定义二进制文件。
¥Note: If your OS isn't supported you can include a custom binary.