How can I update an attribute in a through table?

て烟熏妆下的殇ゞ 提交于 2019-12-23 04:54:19

问题


In Sequelize.js, how can I update an attribute in a through table for 1-N or N-M relationships? I tried to find documentation but couldn't find any.


回答1:


If user belongs to many projects, and the project has an enrolled column you can do

project.addUser(user, { enrolled: new Date() });

This should also work if the relation betwene user and project is already set, in that case the join table will be updated.

The docs are at the end of this section.



来源:https://stackoverflow.com/questions/32689275/how-can-i-update-an-attribute-in-a-through-table

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!