Unknown arguments Error while creating table in Sequelize command line

While trying to create an Item table using sequelize through command line I am getting the below error -

sequelize model:create --name Item --attributes 'itemid:string  itemname:string  genericname:string  itemtype:string  batchno:string mfname:string  mfplant:string'

Sequelize CLI [Node: 16.15.0, CLI: 6.4.1, ORM: 6.20.1]

Options:
  --version          Show version number                                                                       [boolean]
  --help             Show help                                                                                 [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 new model                                               [string] [required]
  --attributes       A list of attributes                                                            [string] [required]
  --force            Forcefully re-creates model with the same name                                             [string]
  --underscored      Use snake case for the timestamp's attribute names                       [boolean] [default: false]

Unknown arguments: itemname:string, genericname:string, itemtype:string, batchno:string, mfname:string, mfplant:string' 

I have created a users table in the similar way and it worked fine.

sequelize model:create --name PTUser --attributes 'userid:string,username:string,password:string,role:string,isadmin:boolean,address:string,insertdate:date,updatedate:date'

I am not sure where it is going wrong.

Please help.

Thanks in advance.

Upvotes: 0

Views: 662

Answers (1)

myselfmiqdad
myselfmiqdad

Reputation: 2605

You don't need ' around the attributes:

Try this:

sequelize model:create --name PTUser --attributes userid:string,username:string,password:string,role:string,isadmin:boolean,address:string,insertdate:date,updatedate:date

Upvotes: 1

Related Questions