Polymorphic relationships using a discriminator column
Hi all,
I'm currently migrating (tbh rebuilding) a project that currently uses Entity Framework.
In the database, we currently have a few polymorphic relationships, represented with a discriminator column. E.g.
LicenseAssignments
LicenseAssignments
has a column
LicenseTargetDiscriminator
LicenseTargetDiscriminator
(which could be something like
User
User
,
Organisation
Organisation
,
Document
Document
, etc.) and a column
LicenseTargetId
LicenseTargetId
which contains the ID of the resource in its particular table.
(hope that made at least some sense)
In EF, I can use "type hierarchy mapping" with a discriminator column https://learn.microsoft.com/en-us/ef/core/modeling/inheritance, so it can dynamically retrieve the linked records for me (and it knows which tables to pull them from, using the discriminator column).
Is there any way to achieve this (or similar behaviour) in Drizzle?