Skip to content

BUG: Two enums with the same value causes error #498

@jasonmacdonald

Description

@jasonmacdonald

Description and expected behavior
I'm unsure if this is just a visual-studio plugin bug or if it goes deeper (EDIT: I can confirm this blocks generation), but It seems you cannot use two enums in your schema, which both use the same name as one of its values. Whenever you try to reference the value of the second ENUM the error appears Value is not assignable to parameter zmodel.

Note that I get no such error in Prisma itself.

Simplified Reproduction

generator client {
    provider = "prisma-client-js"
}

datasource db {
    provider = "postgresql"
     url      = env("DATABASE_URL")
}

enum FirstEnum {
    E1 // used in both ENUMs
    E2
}

enum SecondEnum  {
    E1 // used in both ENUMs
    E3
    E4
}


model M {
    id Int @id
    first  SecondEnum @default(E1) // <-- error since two enums use the value and this is trying to reference the second one
    second FirstEnum @default(E1)
}

Environment (please complete the following information):

  • ZenStack version: 1.0.0-beta-1
  • Prisma version: 4.14.1
  • Database type: Postgresql

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions