작성
·
135
0
코멘트.js에서
static associate(db) {
db.Comment.belongsTo(db.User, { foreignKey: 'commenter', targetKey: 'id' });
}
유저.js에서
static associate(db) {
db.User.hasMany(db.Comment, { foreignKey: 'commenter', sourceKey: 'id' });
}
이렇게 작성했는데...
comment 모델에 commenter가 생성된 것을 보면, 1:N중 N에 해당하는 belongsTo에 foreignKey가 생성되는 것으로 생각하면 되나요??
ㅇ