Skip to content
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

Relationship pairing fixes (matching one-to-many relationship ends and foreign key column naming) #323

Closed
wants to merge 3 commits into from

Conversation

owerkop
Copy link
Contributor

@owerkop owerkop commented Sep 21, 2015

2 problems fixed:

  1. Bad logic pairing two end of the relation.
    It was based on alphabetical order of the propertiess.
  2. Wrong foreign key column naming for 2-ended relationships.
    Even if 2 end of the relation are properly detected there were created 2 foreign key columns on the many side. It worked properly only when reference property from child to parent was named: [parentTypeName].

PS: I just found that 1. problem is fixed by #313 ...
Fortunately fix is the same as proposed here.

Pairing should check property types correspondence to avoid pair collection with reference property if their types does not match.
…ypes correspondence to avoid pair wrong properties.
…two ends will use the same (single) foreign column name at children table.

Before that fix such relations were mapped this way: "one" side used childtype.Name+"_id", "many" side used referenceToParentProperty.Name+"_id".
It seemed to work just because usually referenceToParent property name is equal to parent's type name.
@chester89
Copy link
Collaborator

Thanks, released as part of #326 and #327

@chester89 chester89 closed this Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants