问题
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