SQLite 客户端仅支持 better-sqlite3
包
¥Only the better-sqlite3
package is supported for the SQLite client
Strapi 5 只能将 better-sqlite3
包用于 SQLite 数据库,并且必须将其 client
值设置为 sqlite
。
¥Strapi 5 can only use the better-sqlite3
package for SQLite databases, and the client
value for it must be set to sqlite
.
此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 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.
\🔌 此重大更改是否会影响插件? | \否 |
---|
\🤖 此重大更改是否由 codemod 自动处理? | \是 |
---|
重大更改描述
¥Breaking change description
在 Strapi v4 中
¥In Strapi v4
SQLite 数据库的数据库配置 client
选项接受多个值,例如 sqlite3
、vscode/sqlite3
、sqlite-legacy
和 better-sqlite3
。
¥The database configuration client
option for SQLite databases accepts several values such as sqlite3
, vscode/sqlite3
, sqlite-legacy
, and better-sqlite3
.
在 Strapi 5 中
¥In Strapi 5
SQLite 数据库的数据库配置 client
选项仅接受 sqlite
。
¥The database configuration client
option for SQLite database only accepts sqlite
.
迁移
¥Migration
本节重新组合了有关引入的重大更改的有用说明和程序。
¥This section regroups useful notes and procedures about the introduced breaking change.
注意
¥Notes
Strapi 5 在底层使用 SQLite 数据库的
better-sqlite3
包,并将sqlite
选项重写为 Knex 的better-sqlite3
。¥Strapi 5 uses the
better-sqlite3
package for SQLite databases under the hood and rewrites thesqlite
option asbetter-sqlite3
for Knex.有关数据库客户端和配置的更多信息,请参阅 数据库配置 文档。
¥Additional information about database clients and configuration can be found in the database configuration documentation.
手动程序
¥Manual procedure
不需要手动迁移,因为 升级工具 的代码修改将处理此更改。
¥No manual migration should be required as codemods from the upgrade tool will handle this change.
如果你想要手动迁移,请在终端中运行以下命令:
¥In case you want to manually migrate, run the following commands in the terminal:
运行
yarn remove sqlite3
以删除 sqlite 3 包。¥Run
yarn remove sqlite3
to remove the sqlite 3 package.运行
yarn add better-sqlite3
以安装better-sqlite3
包。¥Run
yarn add better-sqlite3
to install thebetter-sqlite3
package.