It seems that "associate" in the following code is never called.
It does not even exist in User.
var User = sequelize.define('User', {
username: DataTypes.STRING,
password: DataTypes.STRING,
auth: {
type: DataTypes.ENUM,
values: ['reader', 'admin', 'root']
}
}, {
classMethods: {
associate(models){
console.log("test")
// pass
}
}
});
In fact, all the methods defined in classMethods do not appear in User.
Is that a bug?
If you check the documentation you can observe that the way of defining class level methods was modified: http://docs.sequelizejs.com/manual/tutorial/models-definition.html#expansion-of-models
But it seems to be a sequelize related problem, not sequelize-cli.
@kukukk Okay...Thanks for that...
I should have read the document more carefully...
I just found that a Pull Request had been submitted for this problem ...
https://github.com/sequelize/cli/pull/470
The question is: will sequelize-cli be updated? What's the plan? Is there any way for us to detect which version of sequelize is being used and generate the proper code?
The cli README could at least be updated to make it clear that it's not compatible with sequelize 4.0.0 and up.
Readme updated https://github.com/sequelize/cli#sequelize-support
Most helpful comment
The cli README could at least be updated to make it clear that it's not compatible with sequelize 4.0.0 and up.