I am looking to put a valid condition in the child running for a 1: 1 and N: N relationship like this example 1:1
// Find all projects with a least one task where task.state === project.state
Project.findAll({
include: [{
model: Task,
where: { state: Sequelize.col('project.state') }
}]
})
Only the name of the table changes name from "project" to "projects" depending on the relationship In this case, 'project.state' will work but a request from a model with an N: N association will give an error :
"invalid reference to FROM-clause entry for table \" project \ ""
the condition should be 'projects.state'
If working if i use "as :project" in include for each query but if anyone has a good idea.
Thanks for your help