# v5 中缩短的数据库标识符

> Source: https://strapi.nodejs.cn/cms/migration/v4-to-v5/breaking-changes/database-identifiers-shortened

🌐 Database identifiers shortened in v5

在 Strapi v5 中，数据库标识符限制为 55 个字符；较长的标识符会自动使用哈希后缀缩短以防止冲突。

🌐 Database identifiers are limited to 55 characters in Strapi v5; longer identifiers are automatically shortened with a hash suffix to prevent conflicts.

在 Strapi 5 中，数据库标识符不能超过 55 个字符。 

此页面是[重大更改数据库](/cms/migration/v4-to-v5/breaking-changes)的一部分，提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the [breaking changes database](/cms/migration/v4-to-v5/breaking-changes) and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

- Is this breaking change affecting plugins? Yes
- Is this breaking change automatically handled by a codemod? Yes
- (This breaking change is actually handled by a data migration script that runs when your Strapi project is upgraded to Strapi 5.)

## 重大变更描述 {#breaking-change-description}

🌐 Breaking change description

**在 Strapi v4 中**

数据库标识符可能超过 55 个字符，可能会导致某些数据库出现问题。

🌐 Database identifiers could be longer than 55 characters, potentially causing issues with some databases.

**在 Strapi 5 中**

数据库标识符不能超过 55 个字符，并且会被缩短。

🌐 Database identifiers can't be longer than 55 characters and will be shortened.

## 迁移 {#migration}

🌐 Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

🌐 This section regroups useful notes and procedures about the introduced breaking change.

### 注意 {#notes}

🌐 Notes

- 在缩短数据库标识符时将添加哈希键以避免冲突。它将由 SHA-256 的前 6 个字符组成。例如，在 Strapi v5 中，`my_very_very_very_very_very_very_very_too_long_identifier_unique` 将被缩短为 `my_very_very_very_very_very_very_very_very_a2dx3_uq`。
- 将使用一些后缀：

  | 后缀                  | 简写版本 |
  | ---------------------- | ------------- |
  | `component_type_index` | `cmpix`       |
  | `component`            | `cmp`         |
  | `components`           | `cmps`        |
  | `entity_fk`            | `etfk`        |
  | `field_index`          | `flix`        |
  | `fk`                   | `fk`          |
  | `id_column_index`      | `idix`        |
  | `index`                | `idx`         |
  | `inv_fk`               | `ifk`         |
  | `links`                | `lnk`         |
  | `morphs`               | `mph`         |
  | `order_fk`             | `ofk`         |
  | `order_index`          | `oidx`        |
  | `order_inv_fk`         | `oifk`        |
  | `order`                | `ord`         |
  | `primary`              | `pk`          |
  | `unique`               | `uq`         |

### 手动操作 {#manual-procedure}

🌐 Manual procedure

在 Strapi v5 中启动应用时，Strapi 应该处理所有事情。

🌐 Strapi should handle everything when starting the application in Strapi v5.

但是，请注意，如果你对数据库表或列有硬编码引用，则可能需要手动更新它们。

🌐 However, be aware that if you have hard-coded references to database tables or columns, you may need to manually update them.
