当前位置:网站首页>Sequelize. JS and hasmany - belongsto vs hasmany in serialize js

Sequelize. JS and hasmany - belongsto vs hasmany in serialize js

2022-07-05 04:07:00 Rich in starch

problem :

What's the difference between B.belongsTo(A) and A.hasMany(B)B.belongsTo(A) and A.hasMany(B) What's the difference

Artist = sequelize.define('Artist', {});Album = sequelize.define('Albums', {});Album.belongsTo(Artist, foreignKey: 'album_belongsl_artist');Artist.hasMany(Album, foreignKey: 'artist_hasmany_albums');

if it in both cases creates the depended tables in Album ? If it is in both cases Album Created dependency table ?


Solution :

Reference resources : https://stackoom.com/en/question/1N8ZD
原网站

版权声明
本文为[Rich in starch]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140708501060.html