部署到不同的操作系统
Prisma 客户端依赖于与你的应用在同一主机上作为二进制文件运行的 查询引擎。
¥Prisma Client depends on the query engine that is running as a binary on the same host as your application.
从 v6.7.0 开始,Prisma ORM 具有 queryCompiler
预览功能。
¥As of v6.7.0, Prisma ORM has the queryCompiler
Preview feature.
启用后,你的 Prisma 客户端将生成 无需基于 Rust 的查询引擎二进制文件:
¥When enabled, your Prisma Client will be generated without a Rust-based query engine binary:
generator client {
provider = "prisma-client-js"
previewFeatures = ["queryCompiler", "driverAdapters"]
}
请注意,驱动适配器 预览功能与
queryCompiler
功能同时启用。¥Note that the driver adapters Preview feature is required alongside
queryCompiler
.
查询引擎是用 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.