You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v3: sourceKey feature for hasMany doesn't work if where clause specified in include #7141
I installed the update that adds sourceKey to the hasMany feature. Initially it was working fine, however as soon as I put a where clause in the include of a find call it switched back to ignoring my specified sourceKey and is only looking at the primary key.
I had expected to get back a tree starting with the user that is found which would then include it's matching contact record. Then underneath the contact would be each active role with the active accounts attached to those roles.
I get Unhandled rejection SequelizeDatabaseError: operator does not exist: integer = character varying because the join on the contact and role tables is being done via the primary key on the contact table instead of the sourceKey I have specified in the hasMany association. If I leave everything the same, but simply remove the where clause in the include it works.
I'd be willing to work on a fix for this myself. I tried debugging the code, but I can't seem to find exactly where the final query gets written that is causing the problem. If no one else wants to take on fixing it I'd take it up if someone can point me in the right direction. I've gone through has-many.js, and the problem does not appear to be there as far as I can tell.
I have the repo pulled, and I'm ready to put in the fix, but I tried running the tests first and can't get them to complete. There's also a problem with a file disappearing after anytime tests fail. See this issue for details: #7143
Activity
LoneWolfPR commentedon Jan 24, 2017
I've actually found the problem. Currently we have this definition in
lib/dialects/abstract/query-generator.jsat line 1708i believe It should be
LoneWolfPR commentedon Jan 24, 2017
I have the repo pulled, and I'm ready to put in the fix, but I tried running the tests first and can't get them to complete. There's also a problem with a file disappearing after anytime tests fail. See this issue for details: #7143
v3: sourceKey feature for hasMany doesn't work if where clause specif…
cherry-pick: 3168d54
cherry-pick: 3168d54