使用文档服务 API 方法触发数据库生命周期钩子的方式不同
¥Database lifecycle hooks are triggered differently with the Document Service API methods
在 Strapi 5 中,数据库生命周期钩子通过各种 文档服务 API 方法以不同的方式触发,这主要是由于 起草并发布 功能的新工作方式。
¥In Strapi 5, database lifecycle hooks are triggered differently with the various Document Service API methods, mainly due to the new way the Draft & Publish feature works.
大多数用例应仅使用文档服务。文档服务 API 处理草稿和发布、i18n 以及任何底层 strapi 逻辑。
¥The majority of use cases should only use the Document Service. The Document Service API handles Draft & Publish, i18n, and any underlying strapi logic.
但是,文档服务 API 可能并不适合你的所有用例;因此,数据库层被公开,允许你在数据库上执行任何操作而不受任何限制。然后,用户需要求助于数据库生命周期钩子作为系统来扩展数据库行为。
¥However, the Document Service API might not suit all your use cases; the database layer is therefore exposed allowing you to do anything on the database without any restriction. Users would then need to resort to the database lifecycle hooks as a system to extend the database behaviour.
此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 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.