-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
NEW add relation type on element_element #29329
NEW add relation type on element_element #29329
Conversation
Looks good to me. |
@eldy ok thanks i will do it but i just have a question about the new field : it could be better with a foreign key and a dictionary no ? Then people could add relations type via the dictionary and element_element will be lighter (store only a key, not a varchar) ? |
It depends on how you plan to use the new field. Will a different value need dedicated code (in such a case a hard coded "if value" will be added) so an open key is enough. If all cases will be managed the same way and nature of link will be selected the same way in a combo, then having a dictionary is better. |
Hello |
Hello @defrance , |
I was just specifying that it is ALREADY possible to make links between thirdparties elements, going through the contacts allows you to qualify the type of link. Your solution provides a qualification of the links between elements but apart from the links between third parties (and I specify that there is also the notion of parent company to link thirdparties together...) I do not know if there is functionally other uses Another thing, it seems to me that it would be more relevant in your solution to use a dictionary to qualify the link types as is the case for contacts. This would avoid typos. |
@rycks Can you complete PR to add the instruction into migration (in same PR that PR that add colum on new installation) ? |
@eldy done, alter table is ok may we add an index on that column ? do you think we will have situations where we need to make search on that field ? "search all relation of accounters ..." yes of course we need to be able to do that sort of requests -> add index ? |
Don't think we need an index on the new field: Because we will never make a seach on the type field "only". We will always have another criteria, like source or target id (at least one). And selectivity with such criteria will be better than the selectivity of the type (where we will have only 1 to 20 different values). So index of other fields will take precedence and the one on type will never be used. |
datamodel evolution
That PR is the first step for a basic need : to be able to make links between elements like thirdparts - thirdparts with an information to complete the relation "what is the role provided".
thirdparts - thirdparts relations
I have a lot of thirdparts in my dolibarr:
i would make some links between customer and A and an other link between customer and D because wen Z call me i need to know who i have to call to make the intervention if the problem is with photocopier (A) or D if they need a new training ?
for the moment that is in textual notes (private) on thirdpart but we cannot make requests againts that ...
projects are an other solution, we could set up a project and make relations and roles on projects
but in a lot of situations that's just a link between thirdparts then if we could store "relation type" in element_element table we could use that table to make it
is that a good idea ? i hope, the good solution ? i hope too :)
a little schema
Note: that's not only for thirdpart - thirdpart relations like in my example