-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v6.0.5 upsert references error (LoadStrategy select in) #5165
Comments
Looks like I can't reproduce this, I can only see a different error in mongo ( |
Interesting, I'll try to reproduce again and provide different example, but I've isolated it to mikro 6.0.5 previously, I'll try it again today or tomorrow 👍 Edit: didn't find the time, I'll try tomorrow |
I can at least provided a little more stacktrace, interesting issue is that Account is not even the entity we're loading with the findOne. In addition the entity called billingDetail is not supposed to be loaded, it's not in populate fields, nor is it set to be lazy loaded
The hierarchy of these entities is: |
Weird, I am on M1 for the last two years, it should work fine. |
I've had some docker issues, but it might have been knex since I was previously figuring out and bugfixing issue that was caused by it |
Do you actually have this in your entity def? It should be
If you have this in your stack trace, your relation needs to be 1:1, not m:1, but then you cannot have an inverse of 1:m kind, that's another suspicious thing. |
I don't that was me just trying to quickly forward you somewhere, I've setup mikro dev env on my machine and I'll let you know if I'm able to replicate it in test (so far I've been unsuccessful, even though it happens every time when running in our app) EDIT: Ok, I'm able to replicate it in tests, I'll create a minimal example |
https://gist.github.com/ladal1/a357f76e674110d692e09b307477283c Here is a test which replicates the issue |
The third parameter of |
Damn, I was hoping that was the issue, but it was just my oversight during writing the replication when It produced the same error. However you gave me an idea and now I have actually what I whink is causing this - what the replication was missing is the load strategy we're sadly still on, I would have liked to switch to joined (and might do it in response to this), but the issue is apparently cause by combination of the code and select in strategy |
Describe the bug
Working with upgrading to v6.0.5 (btw massive thanks for the quick fix for the constructor), I ended up finding an error, with entity using unique index on reference, as shown in reproduction, the upsert and upsert many now fail - with type error
Reproduction
Just made some entities up (our exact example wouldnt make sense simplified)
What fails is using reference in upserts:
Workaround: using direct id works (object with only field id, does not work and causes knex error, when it tries to insert the whole object into the id column)
Same issue happens with upsertMany
What driver are you using?
@mikro-orm/postgresql
MikroORM version
6.0.5
Node.js version
18
Operating system
mac os
Validations
The text was updated successfully, but these errors were encountered: