Closed julianwyz closed 5 years ago
Not sure what the issue is here. If you can reproduce the error with a smaller sample (or even better a PR with a failing test) i can look into it.
Ok. Good to know this is indeed unexpected and I wasn’t just doing something silly :wink:
I will work on a PR for this.
🤦♂ I am very sorry for wasting your time - the name was the same on the two fields because that is the way it was in the actual data.
My bad. Thanks again for your help!
Haha, hate when stuff like that happens!
Package versions:
graphql-sequelize: 9.3.6
sequelize: 4.38.1
graphql: 14.4.2
pg: 6.4.2
I've recently run into an unexpected behavior where querying a field in a many-to-many association - when two models have a field that has the same name - causes the column to be clobbered.
This case is a little hard to explain, so I'll try to give an overview of my situation below and the issue should become apparent.
I have three models:
Contract
,Organization
andOrganizationType
. They look roughly like this:Contract
Organization
OrganizationType
I also have a join table between Organizations and Contracts:
Now when I run the following GraphQL query:
The response is what I would expect:
But If I attempt to get the same association via the Contracts list query:
This is what is returned:
I believe my schema is configured correctly (because when I query the Organization, the type is returned correctly) - but if it helps, this is roughly what I have:
I believe the issue is because the
Organization
model and theOrganizationType
model both have a field namedname
. But the SQL that is getting output is correct and as far as I can tell I have setup my schema correctly. Is this a bug? Or am I missing something?Thanks ahead of time for any guidance