部署
本节介绍如何将使用 Prisma Client 和 TypeScript 的 Node.js 应用部署到各种平台。
¥This section describes how to deploy Node.js applications that use Prisma Client and TypeScript to various platforms.
If Prisma’s Rust engine binaries cause large bundle sizes, slow builds, or deployment issues (for example, in serverless or edge environments), you can switch to the queryCompiler
Preview feature introduced in v6.7.0.
When enabled, Prisma Client is generated without a Rust-based query engine binary, reducing build artifacts and removing native binary dependencies:
generator client {
provider = "prisma-client-js"
previewFeatures = ["queryCompiler", "driverAdapters"]
}
请注意,driverAdapters
预览功能与 queryCompiler
功能同时启用。When using this architecture:
¥Note that the driverAdapters
Preview feature is required alongside queryCompiler
.
When using this architecture:
-
No Rust query engine binary is downloaded or shipped.
-
The database connection pool is maintained by the native JS database driver you install (e.g.,
@prisma/adapter-pg
for PostgreSQL).
This setup can simplify deployments in:
-
无服务器函数
¥Serverless functions
-
Edge runtimes
-
Read-only filesystem environments
-
CI/CD pipelines with strict size limits
在 docs here 中了解更多信息。Curious why we're moving away from the Rust engine?Take a look at why we're transitioning from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in our 博客文章.
¥Learn more in the docs here. Curious why we're moving away from the Rust engine? Take a look at why we're transitioning from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in our blog post.
在这个部分
¥In this section
部署 Prisma ORM
使用 Prisma Client 的项目可以部署到许多不同的云平台。鉴于云平台的多样性和不同的名称,值得注意的是不同的部署范例,因为它们会影响你使用 Prisma Client 部署应用的方式。
传统服务器
无服务器函数
边缘函数
模块打包器
概述
部署数据库更改
要将待处理的迁移应用到暂存、测试或生产环境,请在 CI/CD 管道中运行 migrate deploy 命令:
从本地环境部署迁移
在两种情况下,你可能会考虑将迁移直接从本地环境部署到生产环境。
部署到 AWS 平台时的注意事项
下面介绍了部署到不同 AWS 平台时你可能会遇到的一些注意事项。
部署到不同的操作系统
Prisma 客户端依赖于与你的应用在同一主机上作为二进制文件运行的 查询引擎。