-
Notifications
You must be signed in to change notification settings - Fork 152
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
it would be nice to allow the relationships to terminate at particular fields. #36
Comments
I wholeheartedly support this request! |
I have added a very basic support of ports on this fork:
produces: ( I don't know whether the difference in height between the tables is correct behaviour However, you need to manually declare ports ( i.e using the port option after every attribute ), and To implement ports I have added a new Option constructor:
I don't know whether adding one more constructor to Option is the right choice, or there is another way without touching Option. |
Brilliant! Also, doing the matching between ports and relevant fields is actually possible to be performed without explicit declaration. So, this would be a more involved work, but eventually worth it. Give me a bit of time to review what is all that we have on this ready and not-ready. |
I think each of these solutions could exists simultaneously, next to each other, independently. In case of Approach-2 having the port defined shall be optional in its syntax. So, backward compatibility would be preserved. As for Approach-1, when no field is called with the post-fix pattern _id the porting applies as default, that is porting is not applicable. The pattern could be something else, that may be up to discussion. |
Could you please further explain approach-1 post-fix pattern? The way I understand it:
In this case there would be a relation from table otherEntity ( omitted for simplicity ) to attribute id in table birth_place. And another relation from otherEntity to attribute "birth country" in table birth_place. Is this correct? If I got your last paragraph correctly, not declaring ports that are not used seems like a great idea! That way the tests will still pass without any changes because as they do not use ports, no port declaration will appear on the resulting dot file, so there won't be any difference. I agree on both solutions being able to exist at the same time, and I would also like to propose the original dot syntax for ports as the post-fix pattern: (as in the original issue by @windbender )
Of course, I do not know how difficult it would be to add this to the Erd parser, hence if it is indeed difficult the _id post-fix pattern seems an easier solution. |
@windbender you can have a try DrawERD |
@mmzx That sounds awesome! I'm wondering if it would be possible to piece-meal them however for the sake of getting it deployed into the tool faster; First doing the explicit approach that @bollafa describes (since it sounds like it required less code refactoring) and then adding the implicit stuff you're doing. |
Right now the relationships are table to table.
[users]
*id
name
[cats]
*id
name
owner_id
users 1--* cats
However inside a database, the relationships are expressed as a field to field. For example.
[users]
*id
name
[cats]
*id
name
owner_id
users:id 1--* cats: owner_id <----- THIS HERE IS WHAT IS DIFFERENT
It turns out that the dot language has a means of expressing the "port" to which a connecting line will connect. See page 20 of the follow doc: https://www.graphviz.org/pdf/dotguide.pdf. avoid the compass point concept and look at. the . things.
I realize this would not be backwards compatible since the
: notation is new. Perhaps there is a better technique to express this in the erd language.Sorry no PR from at this time, I know nothing about Haskell.
The text was updated successfully, but these errors were encountered: