gpt4 book ai didi

database - npx sequelize 生成 :migration --name=[name] keeps failing with Unknown argument: default

转载 作者:行者123 更新时间:2023-12-03 22:37:44 25 4
gpt4 key购买 nike

我正在尝试使用 Sequelize 生成新的迁移,但遵循其帮助会导致错误 Unknown argument: default 。我在我的项目中本地安装,并且正在使用 npx 运行命令。

gabriel@gabriel:~/Workspace/authtdd$ npx sequelize migration:generate --name=create_user

Sequelize CLI [Node: 12.4.0, CLI: 5.4.0, ORM: 5.8.7]

Options:
--help Show help [boolean]
--version Show version number [boolean]
--env The environment to run the command in [string] [default: "development"]
--config The path to the config file [string]
--options-path The path to a JSON file with additional options [string]
--migrations-path The path to the migrations folder [string] [default: "migrations"]
--seeders-path The path to the seeders folder [string] [default: "seeders"]
--models-path The path to the models folder [string] [default: "models"]
--url The database connection string to use. Alternative to using --config files [string]
--debug When available show various debug information [boolean] [default: false]
--name Defines the name of the migration [string] [required]
--underscored Use snake case for the timestamp's attribute names [boolean] [default: false]

Unknown argument: default

但是帮助列表中有选项 --name。此外,我尝试了几种不同的方法: --name:create_user--name create_user ,但他们说需要“名称”。和纱一样。这是一个错误吗?

最佳答案

link to sequelize manual.

我想您还应该添加属性。因此,您的迁移代将如下所示

npx sequelize migration:generate --name=User --attributes=firstName:string,lastName:string,email:string

关于database - npx sequelize 生成 :migration --name=[name] keeps failing with Unknown argument: default,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56518524/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com