zenstackhq / zenstack

Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.

Home Page:https://zenstack.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Polymorphism: Invalid logical schema generated

drichardcarl opened this issue · comments

Description and expected behavior
Whenever I try to use field mapping (using @map()) on my model that holds the relation to my polymorphic model, I get errors like error: Field "delegate_aux_User_profileId_CorporateProfile" is already defined on model "User". But when I don't, I get no errors. I'm expecting that either way, it should run just fine.

Screenshots
(schema.zmodel)
image

(comparison: left w/o @Map(), right w/ @Map())
image

(actual errors)
image

Environment (please complete the following information):

  • ZenStack version: 2.2.4
  • Prisma version: 5.13.0
  • Database type: MySQL 8

Additional context
As shown on the screenshots, different fields were marked with the same @map("profile_id") which is the reason why the generated logical schema is invalid.