Closed moseleyi closed 6 years ago
This issue doesn't sound specific to graphql-sequelize and as such i'd invite you to ask the question on sequelize related channels. I'm not familiar with latest features in Sequelize but what you want might not be possible without subqueries.
As in my previous post imagine these are my model joins:
The main table is
Companies
, now let's say I want to look for a specific word in project name, so I'm doing the following:So far so good, but if I'm using pagination as well (using CrudlIO to generate query and if the search happens on the list, it always shows 100 rows), then my query is generated as follows:
the problem is that the search is performed only on the first 100 Companies, which is incorrect. If I change the include structure to this:
Then the
CompanyProjects
goes inside the subselect, which is great but addingrequired : true
to theProjects
doesn't have the same effect on theProjects
. The query looks like this:But this gives me first 100 companies that happen to have projects and then those 100 are filtered with the INNER JOIN.
How do I configure the includes to do this:
Otherwise any filters I do on anything other than deeper levels are useless