npx sequelize generate:migration --name = [name]不断失败,未知参数:默认

时间:2019-06-09 21:33:16

标签: database command-line sequelize.js

我正在尝试使用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,但是他们说需要一个“名称”。与纱线相同。是一个错误吗?

1 个答案:

答案 0 :(得分:0)

link to sequelize manual.

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

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