Files
twenty/packages/twenty-docs/l/zh/user-guide/data-migration/capabilities/uniqueness-constraints.mdx
T
github-actions[bot] 001c2097a3 i18n - docs translations (#18231)
Created by Github action

<!-- mintlify-editor-comments:start -->
Mintlify
---
0 threads from 0 users in Mintlify

- No unresolved comments
<!-- mintlify-editor-comments:end -->

<!-- mintlify-comment-->

<a
href="https://dashboard.mintlify.com/twenty/twenty/editor/i18n-docs?source=pr_comment"
target="_blank" rel="noopener noreferrer"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://d3gk2c5xim1je2.cloudfront.net/assets/open-mintlify-editor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://d3gk2c5xim1je2.cloudfront.net/assets/open-mintlify-editor-light.svg"><img
src="https://d3gk2c5xim1je2.cloudfront.net/assets/open-mintlify-editor-light.svg"
alt="Open in Mintlify Editor"></picture></a>

<!-- /mintlify-comment -->

Co-authored-by: github-actions <github-actions@twenty.com>
2026-02-25 16:50:28 +01:00

73 lines
2.4 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: 唯一性约束
description: Twenty 如何在导入过程中强制确保数据唯一性。
---
import { VimeoEmbed } from '/snippets/vimeo-embed.mdx';
## 概览
Twenty 会在特定字段上强制唯一性,以防止重复记录并确保数据完整性。 了解这些约束对于成功导入至关重要。
## 默认唯一字段
| 对象 | 唯一字段 |
| --------- | -------------- |
| **人员** | `id`, `email` |
| **公司** | `id`, `domain` |
| **自定义对象** | 仅 `id`(默认) |
<Note>`id` 字段是 Twenty 的内部标识符,为每条记录自动生成。 它使用 UUID 格式(例如,`c776ee49-f608-4a77-8cc8-6fe96ae1e43f`)。</Note>
## 自定义唯一字段
您可以在 **设置 → 数据模型** 下定义其他唯一字段:
1. 进入 **设置 → 数据模型**
2. 选择一个对象
3. 点击某个字段
4. 在字段设置中启用 **Unique**
### 自定义唯一字段的使用场景
* **外部 ID**:存储来自其他系统的 IDSalesforce ID、HubSpot ID
* **业务标识符**:员工编号、客户代码
* **替代联系方式**:LinkedIn 资料、电话号码
<Note>字段名 `id` 保留给 Twenty 的内部 ID。 外部标识符请使用 `externalId` 或 `legacyId` 等其他名称。</Note>
## 导入行为
### 创建新记录
如果唯一字段的值不存在,将创建一条新记录。
### 更新现有记录
如果唯一字段的值与现有记录匹配,该记录将使用新数据进行**更新**。
<Warning>要**更新现有记录**,建议**仅匹配一个唯一字段**。</Warning>
### 软删除的记录
<Warning>
**已删除的记录也会计入唯一性。**
软删除的记录(可在“命令菜单 → 查看已删除的记录”中查看)会包含在唯一性检查中。 如果您导入的记录与某条已删除记录具有相同的唯一值,该已删除记录将被**还原**,并使用新数据。
</Warning>
## 导入过程中的重复检测
在验证阶段:
* 文件中的重复项会以黄色高亮显示
* 开始导入前,您可以在界面中编辑或移除重复的行
<VimeoEmbed videoId="1145246326" title="视频演示" />
## 最佳实践
1. 在导入前,**从文件中移除重复项**
2. 在导入前,在 Twenty 中**检查是否存在现有记录**
3. 从其他系统迁移时,**使用外部 ID**
4. 如果您希望更新现有记录,请**包含唯一字段**