2

I've been trying to create a user model using sequelize cli but whenever I insert more parameters like primary key and unique the parser fails. Eg:

npx sequelize model:create --name user --attributes "name:{dataType:string, primaryKey:true}, email:string, address:string" --force

Sequelize CLI [Node: 8.10.0, CLI: 5.4.0, ORM: 5.1.0]


ERROR: Attribute 'name:{dataType:string, primaryKey:true}' cannot be parsed: Cannot read property 'dataType' of undefined

I haven't found any reference in the Docs about this. Is there any way to do it?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

2 Answers2

0

You can find the available list of commands here

https://github.com/sequelize/cli

Amandeep Singh
  • 156
  • 1
  • 8
-1

sequelize model:create --name User --attributes "email:[type:string, unique:true, allowNull: false, { validate: { isEmail: true } }]

Navid Yousefzai
  • 141
  • 1
  • 9