当我在我的模型中添加 Sequelize 的关联时,我遇到了错误“...用不是 Sequelize.Model 的子类的东西调用”,它称为错误,即我所说的不是 Sequelize 模型
E:...\Projects\WebApps\hr1\hr1\node_modules\sequelize\lib\associations\mixin.js:81
throw new Error(this.name + '.' + Utils.lowercaseFirst(Type.toString()) + ' called with something that\'s not a subclass of Sequelize.Model');
^
Error: user_employee_tm.class BelongsTo extends Association {
constructor(source, target, options) {
super(source, target, options);
this.associationType = 'BelongsTo';
this.isSingleAssociation = true;
this.foreignKeyAttribute = {};
if (this.as) {
this.isAliased = true;
this.options.name = {
singular: this.as
};
} else {
this.as = this.target.options.name.singular;
this.options.name = this.target.options.name;
}
if (_.isObject(this.options.foreignKey)) {
this.foreignKeyAttribute = this.options.foreignKey;
this.foreignKey = this.foreignKeyAttribute.name …Run Code Online (Sandbox Code Playgroud) 目前,我正在使用 nodejs + mysql 构建一个 Web 应用程序,并将其续集为 ORM。我想像在 mysql 中一样创建一些视图,但是在Sequelize 中找不到任何选项来创建视图。
是否有任何可以创建视图的 ORM?或者可以用续集来做到吗?