Files
twenty/packages/twenty-docs/l/zh/developers/self-host/capabilities/upgrade-guide.mdx
T
github-actions[bot] 800d0f28ff i18n - docs translations (#19955)
Created by Github action

Co-authored-by: github-actions <github-actions@twenty.com>
2026-04-22 05:24:07 +02:00

91 lines
2.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 升级指南
icon: arrow-up-right-dots
---
## 通用指南
**在开始升级流程之前务必备份数据库**,运行:
```bash
docker exec -it {db_container_name_or_id} pg_dumpall -U {postgres_user} > databases_backup.sql
```
从备份恢复:
```bash
cat databases_backup.sql | docker exec -i {db_container_name_or_id} psql -U {postgres_user}
```
如果您使用 Docker Compose,请按照以下步骤操作:
1. 停止 Twenty`docker compose down`
2. 在与 `docker-compose.yml` 同目录的 `.env` 文件中更改 `TAG` 值
3. 启动 Twenty`docker compose up -d`
服务器在启动时会自动运行所有所需的升级迁移。 无需手动执行任何命令。
## 跨版本升级(v1.22+
自 **v1.22** 起,Twenty 支持跨版本升级。 您可以从任意受支持的版本直接跳到最新版本,而无需逐一经过每个中间版本。
例如,从 v1.22 直接升级到 v2.0 完全受支持。
## 检查升级状态
`upgrade:status` 命令可用于查看您的实例和工作区迁移的当前状态。 这在调试升级问题或提交支持请求时非常有用。
在服务器容器中运行:
```bash
docker exec -it {server_container_name_or_id} yarn command:prod upgrade:status
```
示例输出:
```sh
APP_VERSION: v1.23.0
Instance
Inferred version: 1.23.0
Latest command: 1.23.0_DropWorkspaceVersionColumnFastInstanceCommand_1785000000000
Status: Up to date
Executed by: v1.23.0
At: 2026-04-16T11:43:58.823Z
Workspace
Apple (20202020-1c25-4d02-bf25-6aeccf7ea419)
Inferred version: 1.23.0
Latest command: 1.23.0_UpdateGlobalObjectContextCommandMenuItemsCommand_1780000005000
Status: Up to date
Executed by: v1.23.0
At: 2026-04-16T11:44:09.361Z
Summary
Instance: Up to date
Workspaces: 1 up to date, 0 behind, 0 failed (1 total)
```
### 选项
| 标志 | 描述 |
| ------------------------- | ----------------------- |
| `-w, --workspace-id <id>` | 筛选特定工作区。 可多次传递。 |
| `-f, --failed-only` | 隐藏已是最新的工作区,仅显示落后和失败的条目。 |
## 故障排除
如果某些工作区的升级失败,服务器将不会越过失败的步骤继续进行。 重启服务器(`docker compose up -d`)将从中断处重试升级。
要快速定位问题,运行:
```bash
docker exec -it {server_container_name_or_id} yarn command:prod upgrade:status --failed-only
```
这将仅显示落后或失败的工作区,并附上每个失败的错误信息。
## v1.22 之前
如果您的实例早于 v1.22,您必须按顺序逐步升级经过每个主要标记版本(从 v1.6 到 v1.7,再从 v1.7 到 v1.8,依此类推),直到达到 v1.22。 届时,您可以直接跳到最新版本。