# 重大变更

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

🌐 Strapi v4 to Strapi 5 breaking changes

Strapi v4 与 v5 之间重大变更的全面索引，按类别（数据库、依赖、配置、API）组织，包含关于插件影响和代码迁移工具支持的信息。

🌐 A comprehensive index of breaking changes between Strapi v4 and v5, organized by category (database, dependencies, configuration, APIs) with information on plugin impact and codemod support.

本页面列出了 Strapi 5 中引入的所有重大更改。重大更改按主题相关类别分组，在下面表格的每一行中，你将找到：

🌐 The present page lists all the breaking changes introduced in Strapi 5.
Breaking changes are grouped into topic-related categories, and for each line in the following tables line you will find:

- 重大更改的简短描述，
- 以及另外两列，“影响插件”和“由 codemods 处理”，总结了破坏性更改是否也影响插件，以及破坏性更改是否由 [升级 CLI 工具](/cms/upgrade-tool) 的 codemod 自动处理。

你可以单击下表中任何重大更改的描述以跳转到包含更多详细信息的相应页面。

🌐 You can click on the description of any breaking change in the following tables to jump to the corresponding page with more details.

:::tip Tips

* 要查看可用 codemods 的完整列表，请在终端中运行 `npx @strapi/upgrade codemods ls` 命令。
* 要更深入地查看 codemods 执行的代码，请前往 GitHub 仓库中的 [list of codemods](https://github.com/strapi/strapi/tree/develop/packages/utils/upgrade/resources/codemods/5.0.0) 。

:::

## 数据库 {#database}

🌐 Database

| 描述 | 影响插件 | 由 codemods 处理 |
|-------------|-----------------|---------------------|
| [内容类型总是有功能列](/cms/migration/v4-to-v5/breaking-changes/database-columns) | 是 | 否 |
| [不再支持 MySQL v5](/cms/migration/v4-to-v5/breaking-changes/mysql5-unsupported) | 否 | 否 |
| [数据库标识符超过 55 个字符将被自动缩短](/cms/migration/v4-to-v5/breaking-changes/database-identifiers-shortened) | 是 | ✅ 是 |
| [SQLite 客户端仅支持 `better-sqlite3` 包](/cms/migration/v4-to-v5/breaking-changes/only-better-sqlite3-for-sqlite) | 否 | ✅ 是 |
| [MySQL 客户端仅支持 `mysql2` 包](/cms/migration/v4-to-v5/breaking-changes/only-mysql2-package-for-mysql) | 否 | ✅ 是 |

## 依赖 {#dependencies}

🌐 Dependencies

| 描述 | 影响插件 | 由代码修改工具处理 |
|-------------|-----------------|---------------------|
| [CLI 默认的包管理器不再是 yarn](/cms/migration/v4-to-v5/breaking-changes/yarn-not-default) | 否 | 否 |
| [Vite 是 Strapi 5 的默认打包工具](/cms/migration/v4-to-v5/breaking-changes/vite) | 是 | 否 |
| [Strapi 5 使用 `react-router-dom` v6](/cms/migration/v4-to-v5/breaking-changes/react-router-dom-6) | 是 | ✅ 是 |
| [Strapi 5 使用 `koa-body` v6](/cms/migration/v4-to-v5/breaking-changes/koa-body-v6) | 是 | 否 |
| [Strapi 5 中移除了 Webpack 别名](/cms/migration/v4-to-v5/breaking-changes/webpack-aliases-removed) | 是 | 否 |
| [Apollo Server v3 升级到 Apollo Server v4](/cms/migration/v4-to-v5/breaking-changes/upgrade-to-apollov4) | 是 | 否 |

## 配置 {#configuration}

🌐 Configuration

| 描述 | 影响的插件 | 由代码转换处理 |
|-------------|-----------------|---------------------|
| [一些仅适用于 `env` 的配置选项由服务器配置处理](/cms/migration/v4-to-v5/breaking-changes/removed-support-for-some-env-options) | 否 | 否 |
| [配置文件名应符合严格要求](/cms/migration/v4-to-v5/breaking-changes/strict-requirements-config-files) | 否 | 否 |
| [服务器日志级别是 `http`](/cms/migration/v4-to-v5/breaking-changes/server-default-log-level) | 否 | 否 |
| [模型配置路径使用 UID 而不是点表示法](/cms/migration/v4-to-v5/breaking-changes/model-config-path-uses-uid) | 是 | 👷 部分 |
| [`webhooks.populateRelations` 服务器配置已删除](/cms/migration/v4-to-v5/breaking-changes/remove-webhook-populate-relations) | 是 | 否 |
| [在 `public` 中移除了 `defaultIndex` 选项](/cms/migration/v4-to-v5/breaking-changes/default-index-removed) | 否 | 否 |
| [服务器代理配置选项分组在 `server.proxy` 对象下](/cms/migration/v4-to-v5/breaking-changes/server-proxy) | 否 | 否 |

## Strapi 对象、方法、包和后端自定义 {#strapi-objects-methods-packages-and-back-end-customization}

🌐 Strapi objects, methods, packages, and back-end customization

| 描述 | 影响插件 | 由代码修改工具处理 |
|-------------|-----------------|---------------------|
| [`strapi.fetch` 使用原生 `fetch()` API](/cms/migration/v4-to-v5/breaking-changes/fetch) | 是 | 否 |
| [strapi 工厂导入已更改](/cms/migration/v4-to-v5/breaking-changes/strapi-imports) | 是 | 👷 部分 |
| [`isSupportedImage` 方法在 Strapi 5 中已移除](/cms/migration/v4-to-v5/breaking-changes/is-supported-image-removed) | 是 | 否 |
| [`strapi-utils` 已被重构](/cms/migration/v4-to-v5/breaking-changes/strapi-utils-refactored) | 是 | ✅ 是 |
| [核心服务方法使用 Document Service API](/cms/migration/v4-to-v5/breaking-changes/core-service-methods-use-document-service) | 是 | 否 |
| [i18n 现在是 strapi 核心的一部分](/cms/migration/v4-to-v5/breaking-changes/i18n-content-manager-locale) | 是 | ✅ 是 |

## 插件、提供商、管理面板和前端自定义 {#plugins-providers-admin-panel-and-front-end-customization}

🌐 Plugins, providers, admin panel and front-end customization

| 描述 | 影响的插件 | 由代码转换处理 |
|-------------|-----------------|---------------------|
| [用户与权限 `register.allowedFields` 默认为 `[]`](/cms/migration/v4-to-v5/breaking-changes/register-allowed-fields) | 否 | ✅ 是 |
| [`helper-plugin` 已被移除](/cms/migration/v4-to-v5/breaking-changes/helper-plugin-deprecated) | 是 | 👷 部分 |
| [`injectContentManagerComponent()` 被移除，改用 `getPlugin('content-manager').injectComponent()`](/cms/migration/v4-to-v5/breaking-changes/inject-content-manager-component) | 是 | 否 |
| [某些 Mailgun 提供商的旧变量不受支持](/cms/migration/v4-to-v5/breaking-changes/mailgun-provider-variables) | 是 | 否 |
| [`lockIcon` 属性已被 `licenseOnly` 取代](/cms/migration/v4-to-v5/breaking-changes/license-only) | 是 | 否 |
| [`ContentManagerAppState` redux 已被修改](/cms/migration/v4-to-v5/breaking-changes/redux-content-manager-app-state) | 是 | 否 |
| [“EditViewLayout”和“ListViewLayout”已被重构](/cms/migration/v4-to-v5/breaking-changes/edit-view-layout-and-list-view-layout-rewritten) | 是 | 否 |
| [管理面板 RBAC redux 存储已更新](/cms/migration/v4-to-v5/breaking-changes/admin-panel-rbac-store-updated) | 是 | 否 |
| [`getWhere` 方法用于权限提供者实例已被删除](/cms/migration/v4-to-v5/breaking-changes/get-where-removed) | 是 | 否 |
| [设计系统已升级](/cms/migration/v4-to-v5/breaking-changes/design-system) | 是 | 否 |

## 内容 API {#content-api}

🌐 Content API

| 描述 | 影响的插件 | 由代码转换处理 |
|-------------|-----------------|---------------------|
| [Strapi 5 为 API 调用提供了新的扁平化响应格式](/cms/migration/v4-to-v5/breaking-changes/new-response-format) | 是 | 否 |
| [REST API 输入在控制器中默认被验证](/cms/migration/v4-to-v5/breaking-changes/default-input-validation) | 是 | 否 |
| [GraphQL API 已更新](/cms/migration/v4-to-v5/breaking-changes/graphql-api-updated) | 是 | 否 |
| [实体服务 API 已弃用，已被文档服务 API 取代](/cms/migration/v4-to-v5/breaking-changes/entity-service-deprecated) | 是 | 👷 部分 |
| [`documentId` 应该在 API 调用中替代 `id`](/cms/migration/v4-to-v5/breaking-changes/use-document-id) | 是 | 👷 部分 |
| [根据文档服务 API 方法，数据库生命周期钩子的触发方式不同](/cms/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service) | 是 | 否 |
| [`publicationState` 参数不受支持，已被 `status` 取代](/cms/migration/v4-to-v5/breaking-changes/publication-state-removed) | 是 | ✅ 是 |
| [禁用草稿和发布的内容类型始终将 publishedAt 值设置为日期](/cms/migration/v4-to-v5/breaking-changes/publishedat-always-set-when-dandp-disabled) | 是 | 否 |
| [按 ID 排序不再能按时间顺序排序](/cms/migration/v4-to-v5/breaking-changes/sort-by-id) | 是 | ✅ 是 |
| [在文档服务 API 中没有 `findPage()` 方法](/cms/migration/v4-to-v5/breaking-changes/no-find-page-in-document-service) | 是 | 否 |
| [某些属性和内容类型名称被 Strapi 保留](/cms/migration/v4-to-v5/breaking-changes/attributes-and-content-types-names-reserved) | 是 | 否 |
| [启用草稿和发布时，无法使用 `status` 属性名称](/cms/migration/v4-to-v5/breaking-changes/reserved-attributes-status) | 是 | 否 |
| [在创建条目时上传文件不再可能](/cms/migration/v4-to-v5/breaking-changes/no-upload-at-entry-creation) | 是 | 否 |
| [组件和动态区域应使用详细的填充策略进行填充](/cms/migration/v4-to-v5/breaking-changes/no-shared-population-strategy-components-dynamic-zones) | 是 | 否 |
| [不建议使用文档服务 API 更新可重复使用的组件](/cms/migration/v4-to-v5/breaking-changes/do-not-update-repeatable-components-with-document-service-api) | 是 | 否 |
