hi,
I have a belongs-to-many association User - Projects so, using "through" parameter I created the table worker_tasks in this way
User.belongsToMany(Project, { as: 'Tasks', through: 'worker_tasks', foreignKey: 'userId' })
Project.belongsToMany(User, { as: 'Workers', through: 'worker_tasks', foreignKey: 'projectId' })
It works. I created some Projects then some Users then I associate some User with some projects.
Now I need to delete, for example, the "Project A" and I want also delete those records in worker_task tabel that have ID of the "Project A" as part of the key (the other part is the user ID)
How can I do this?
thanks