背景
我用创建了我的第一个strapi项目
npx create-strapi-app@latest my-project --quickstart
。
我可以访问管理控制台
意图
正如你所看到的,只有
User
集合类型,我想做的是创建一个迁移脚本来创建另一个集合类型。
原因是我希望有一个单一的真相来源,所以我不想直接在管理控制台中创建集合类型
我尝试过的
我试着询问了chatGPT,它为我提供了以下解决方法-
npm run create-content-type
。
"dependencies": {
"@strapi/strapi": "4.11.1",
"@strapi/plugin-users-permissions": "4.11.1",
"@strapi/plugin-i18n": "4.11.1",
"better-sqlite3": "8.0.1"
},
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi",
"create-content-type": "strapi generate:migration create_my_collection_type"
},
错误显示
error: unknown command 'generate:migration'
我也试过
strapi make:migration create_my_collection_type
,但效果不太好。我还查看了官方文件,找不到任何有用的资源。
在我的情况下可以这样做吗?