Objection.js: upsertGraph with relation over composite key does not work properly anymore

Created on 28 Mar 2019  路  8Comments  路  Source: Vincit/objection.js

It looks like a regression sneaked in in v1.6.4. When upserting a graph with a model + relation with composite key, the values for foreign columns are not carried over from the base model. Instead they are NULL, which breaks and throws an error (of course only if columns are NOT NULL, otherwise the records would be inserted, but probably not related).

It worked until v1.6.3.

Please find the reproduction template attached:
reproduction-template.zip

bug

Most helpful comment

The fix was really easy this time. A new version coming up.

All 8 comments

Jesus christ this fucking upsertGraph.. I'll remove the whole fucking thing one day. I'll try to find time to fix this within the next month.

@koskimas nooo please don't remove it, I know you are kind of regretting adding this because of all the headaches it sometimes causes, but it's really a brilliant feature :) Thank you, I will stick with 1.6.3 for now

Yeah, I think we are stuck with it :smile: It's just that no matter how many tests I write, there's always some way to use it that I haven't considered and it breaks

Thanks for the reproduction by the way. Sorry for lashing out like this. Having a bad day :grimacing:

The fix was really easy this time. A new version coming up.

@koskimas i can't thank you enough. can we buy you a beer?

Thanks, but I'm also the person who broke it :smile:

1.6.6 is now released

Was this page helpful?
0 / 5 - 0 ratings