-
-
Notifications
You must be signed in to change notification settings - Fork 611
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Hey, first of all thanks for the great work you are doing and the great ORM, we love it at @medusajs 💪
I d like to report an issue that I have previously mentionned along side this issue.
When using a filter in combination with populating a many to many relation, the inverse side of the address (one to one) is provoking the generation of an invalid query, causing the error: - column u2.address_id does not exist
Generated query:
SELECT
"u0"."profile_id",
"u0"."user_id",
"p1"."id" AS "p1__id",
"p1"."deleted_at" AS "p1__deleted_at",
"p1"."name" AS "p1__name",
"p1"."bio" AS "p1__bio"
FROM
"user_profiles" AS "u0"
INNER JOIN "profile" AS "p1" ON "u0"."profile_id" = "p1"."id"
INNER JOIN "user" AS "u2" ON "u0"."user_id" = "u2"."id"
LEFT JOIN "address" AS "a3" ON "u2"."id" = "a3"."user_id"
AND "a3"."deleted_at" IS NULL
WHERE
"u0"."user_id" IN (1)
AND "p1"."deleted_at" IS NULL
AND (
"u2"."address_id" IS NULL
OR "a3"."id" IS NOT NULL
) - column u2.address_id does not existIt seams that the foreign key is not applied to the correct side table in this scenario
Reproduction
https://github.com/adrien2p/mikroorm-6_5_4-reproduction-1/blob/main/src/example.test.ts
I made a typo during the repository creation using 6_5_4 instead of 6_5_3 sorry
What driver are you using?
@mikro-orm/postgresql
MikroORM version
6.5.3
Node.js version
v22.16.0
Operating system
MacOS Sequoia Version 15.6.1
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working