강의

멘토링

커뮤니티

Inflearn Community Q&A

yongcurri's profile image
yongcurri

asked

[Renewal] Creating NodeBird SNS with React

Setting up a sequel relationship

column name 질문입니다.

Resolved

Written on

·

191

0

db.post.belongsTo(db.post, {as: 'Retweet'});을 하게되면  as 때문에 PostId라는 새로운 컬럼이 Retweet이란 이름으로 생긴다고 하셨는데

 db.User.belongsToMany(db.User, {through:'Follow', as:'Followers', foreignKey: 'FollowingId'});에서 as랑 기능이 다른가요? 여기서는 ForeignKey가 컬럼 이름이 된다고 하셔서요 

reactexpressreduxnodejsNext.js

Answer 1

1

zerocho님의 프로필 이미지
zerocho
Instructor

네네 위에 retweet이 조금 특이한 케이스라고 보시면 됩니다. 외우기 헷갈리시면 아예 foreignKey: 'RetweetId'로 지정하는 것도 괜찮습니다.

yongcurri's profile image
yongcurri

asked

Ask a question