模型(仅关联代码段)
food.associate = (models) => {
food.hasOne(models.ingredient, {
foreignKey: 'catagoryId',
targetKey: 'catagoryId',
scope: {
PropertyId: 'PropertyId'
}
})
}
输出变为:
SELECT * LEFT OUTER JOIN `ingredients` AS `ingredient` ON `food`.`catagoryId` = `ingredient`.`catagoryId` AND `ingredient`.`PropertyId` = 'PropertyId'
请注意,最后一个PropertyId变成了一个字符串,但是期望`food` .Property`
我试过``,'“,'',{},[]等,都没有按预期工作。
你可以帮忙吗?三江源