Sequelize 的findOrCreate 报SequelizeUniqueConstraintError (MySQL)

当你的插入的字段id是自增的,插入会成功,但是会抛出SequelizeUniqueConstraintError 异常,

解决办法办:对应字段设置'autoIncrement': true 代码控制自增 ,

  id: {type: DataTypes.INTEGER, primaryKey: true,  'autoIncrement': true},

https://github.com/sequelize/sequelize/issues/5134

你可能感兴趣的:(Sequelize 的findOrCreate 报SequelizeUniqueConstraintError (MySQL))