Extend Relations API to support other ID types #13691
Replies: 7 comments
-
Thanks @mattbrailsford - there's a PR for this, so it's in the works: #7525 |
Beta Was this translation helpful? Give feedback.
-
@mattbrailsford is the logic in #7525 what you are missing or does the |
Beta Was this translation helpful? Give feedback.
-
Hi @bjarnef #7525 appears to only add support to get a Relation Type by UDI, but what I'm suggesting here is being able to define actual Relation instances against entities with non integer IDs. For this it would likely need the An example could be in Vendr, we have a Store entity with a Guid ID and we have to link this to a content node. It could be good to create a VendrStoreRelation type that relates a store to a node so we could easily query this without needing to traverse the content tree. However this isn't currently possible because the relations API only supports relations between entities with int IDs and so we can't create that link to the Store as it's ID is of type Guid. |
Beta Was this translation helpful? Give feedback.
-
Okay, I guess the Relations would need an additional db column for the Guid while still having an Id column. The changes in #7525 just make it possible to link to a relation type by |
Beta Was this translation helpful? Give feedback.
-
@bjarnef exactly. I'm not sure if any other ID types would be required, but Guid and Int should cover a much larger base at least. |
Beta Was this translation helpful? Give feedback.
-
Maybe @Shazwazza has some insights what needs to be done to support |
Beta Was this translation helpful? Give feedback.
-
The relations table maintains referential integrity with the PK of the umbracoNode table. If you wanted to change to GUID then in theory it would be the same thing and this would have referential integrity with the GUID of the umbracoNode table. The reason that is not the case today is because this doesn't offer any enhancement at all, this is also the reason all of our DB tables are linked with their INT IDs because changing all DB tables to have referential integrity by the GUID would be a monumental amount of work which actually offers no particular benefit. You can already link by GUID or Udi (which is just a GUID) because these tables are linked by their INT so it's 'just' a lookup of the corresponding GUID. However, what I believe you are asking for is to allow for arbitrary values in the relation table that are not bound by referential integrity to the umbracoNode table. If you wanted to use it as-is currently, you could create your own object type (GUID) and store data in the umbracoNode table for your own entity and then link that in the relation table. This could be done today without any changes. If you want to proceed by changing how the relations table operates and removing referential integrity than I think would require a bunch of up-front design decisions because I believe there would be a lot of 'gotchas' in doing so. This would probably require an RFC i think. |
Beta Was this translation helpful? Give feedback.
-
Currently the relations api is limited to content with integer ids. The relations api is really useful to link between different entity types, but if both entities don’t support int ids, then it’s not possible to use it.
It would be cool if the relations api could be extended to support other Id types such that it can be used in more cases and making the go to service for linking different entities from all sources together.
Beta Was this translation helpful? Give feedback.
All reactions