maurerle / eralchemy2

Entity Relation Diagrams generation tool - DEPRECATED
https://github.com/eralchemy/eralchemy
Apache License 2.0
69 stars 16 forks source link

set right_cardinality for relationships with compound primary_keys #34

Closed maurerle closed 4 months ago

maurerle commented 4 months ago

The cardinality was 1 when a compound primary key is a foreign key when it therefore should be 0..N - as the other primary key can change too, rendering the possibility to have multiple entries with the same primary column a - as long as primary column b changes.

An example of this can be seen in the newsmeme.py example or in #21 .

This fixes the behavior introduced in #15 to match compound keys.

This also sets the correct value, if all primary_keys of one table are the foreign keys of all primary_keys of another table - rendering a compound 1 to 1 relationship.

Additional tests are added to make sure the intended behavior is reached.