Skip to content

Delegating models can't use @@map() #1167

@keanugrieves

Description

@keanugrieves

Description and expected behavior
Doing this throws an error when running zenstack generate:

model FileAsset {
  delegate_type String
  ...
  @@delegate(delegate_type)
  @@map("file_assets")
}

model ImageAsset extends FileAsset {
  ...
  @@map("image_assets")
}

...after generating the following in schema.prisma:

/// @@delegate(delegate_type)
model FileAsset {
    ...
    delegate_aux_imageAsset ImageAsset?

    @@map("file_assets")
}

model ImageAsset {
    ...
    delegate_aux_fileAsset FileAsset @relation(fields: [id], references: [id], onDelete: Cascade, onUpdate: Cascade)

    @@map("file_assets")
    @@map("image_assets")
}

Screenshots
Screenshot 2024-03-20 at 1 25 28 PM

Environment (please complete the following information):

  • ZenStack version: 2.0.0-beta.1
  • Prisma version: 5.11.0
  • Database type: postgresql

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions