Hi all, I'm trying to have a dynamic relationship,...
# orm-help
j
Hi all, I'm trying to have a dynamic relationship, how would you go about handling this in schema.prisma? An example would be allowing a User to share an Image or a Bookmark to another User. We currently have a Sharing table that has a contact_id but also a entity_id and entity_type (ENUM).
n
Hey James 👋 Do you mean that your foreign key could be dynamic and could refer to multiple different tables?
j
Hi thanks for the reply! Yes that's exactly what I mean. Field 'foreign_key' type INT Field 'foreign_type' type ENUM that is my current db design. My question is how should I refactor this properly?