-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
commenter관련 질문있습니다.
21.07.24 15:33 작성 조회수 72
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가 생성되는 것으로 생각하면 되나요??
ㅇ
답변을 작성해보세요.
0
답변 1