Skip to content

[FEATURE]: Support Polymorphic Association #1051

@leonard-henriquez

Description

@leonard-henriquez

Describe what you want

I'm looking for a Typesafe ORM that support for polymorphic associations.

To give a concrete example:
I have a Comment model. I need this model to be associated with both Article and Photo models.
Instead of creating separate tables or associations for comments on articles and comments on photos, I would prefer a unified approach where a single Comment can belong to either an Article or a Photo.

Most ORMs (and query builders) except Prisma support polymorphic association.
Prisma is not taking interest in solving this issue: prisma/prisma#1644.
If you plan on implementing Prisma, that would be a killer feature that would be a reason in itself to use Drizzle.
A few teams have mentioned it explicitly in that issue.

Do you plan to support and document this feature in the near future ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestimplemented-in-betaFeatures and improvements that are implemented in the beta branch (or will be soon)rqbrelational queries

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions