Example:
Chat.belongsToMany(Profile, {
as: 'profiles',
through: 'chat_profile',
foreignKey: 'chatId',
otherKey: 'profileId',
onDelete: 'CASCADE'
})
Profile.belongsToMany(Chat, {
as: 'chats',
through: 'profile_chat',
foreignKey: 'profileId',
otherKey: 'chatId',
onDelete: 'CASCADE'
})
Shouldn't these have the same "through" value for same named join table
Example:
Chat.belongsToMany(Profile, {
as: 'profiles',
through: 'chat_profile',
foreignKey: 'chatId',
otherKey: 'profileId',
onDelete: 'CASCADE'
})
Profile.belongsToMany(Chat, {
as: 'chats',
through: 'profile_chat',
foreignKey: 'profileId',
otherKey: 'chatId',
onDelete: 'CASCADE'
})
Shouldn't these have the same "through" value for same named join table