Skip to main content

v5 中缩短的数据库标识符

🌐 Database identifiers shortened in v5

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

此页面是重大更改数据库的一部分,提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the breaking changes database 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

在 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

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

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

注意

🌐 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_indexcmpix
    componentcmp
    componentscmps
    entity_fketfk
    field_indexflix
    fkfk
    id_column_indexidix
    indexidx
    inv_fkifk
    linkslnk
    morphsmph
    order_fkofk
    order_indexoidx
    order_inv_fkoifk
    orderord
    primarypk
    uniqueuq

手动操作

🌐 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.