Skip to content

Need to update relationships data after inferring info from the database #1948

@ayush3797

Description

@ayush3797

What are we doing?

If there is a relationship defined for a (source,target) in the database with right cardinality as ONE, we add the relationship in both the directions (source->target and target->source) to the source's RelationshipMetadata corresponding to the target entity's entry in RelationshipMetadata.TargetEntityToFkDefinitionMap dictionary.

Why are we doing?

We do this because the relationship can be 1:1 or N:1. In case of N:1, the first FK (from source->target) would be present. In case of 1:1, either or both of them can be present. But all this is known to us only at a later stage when we collect metadata from the database and actually infer which of the two relationships (or both) is/are valid.

What is the problem?

After validating the correct relationship, we don't remove the other relationship which we added earlier. The redundant relationship jadds a redundant JOIN condition (I think this is something which is visible in the sql query generated by DAB highlighted in this issue: #1940).

What do we need to do?

Need to remove the redundant relationship.

Metadata

Metadata

Assignees

Labels

Multiple mutationsFixes/enhancements related to nested mutations.bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions