//category_product with category
category.hasMany(category_product,{foreignKey:'category_id'})
category_product.belongsTo(category,{foreignKey:'category_id'})
//category_product with Product
Product.hasMany(category_product,{foreignKey:'product_id'})
category_product.belongsTo(Product, {foreignKey: 'product_id'})
Git bash 错误
throw new Error(this.name + '.hasMany called with something that\'s not asubclass of Sequelize.Model');
^
Error: Theme.hasMany called with something that's not a subclass of Sequelize.Model
谢谢!
最佳答案
我已经解决了这个问题。
这是我的方式 mini-shop
关于mysql - 如何使用sequelize查找三张表数据?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53431585/