Hello, I’m trying to use Prisma with an existing d...
# prisma-client
s
Hello, I’m trying to use Prisma with an existing database, but I’m finding that the
@map
doesn’t work for enums? Is this a known limitation? I have a enum defined as
Copy code
enum DriverStatus {
  OnDuty    @map("ON_DUTY")
  OffDuty   @map("OFF_DUTY")
  Disabled  @map("DISABLED")

  @@map("driver_status_enum")
}
But the generated typescript enum is
Copy code
export const DriverStatus: {
  OnDuty: 'OnDuty',
  OffDuty: 'OffDuty',
  Disabled: 'Disabled'
};
I would expect it to be
Copy code
export const DriverStatus: {
  OnDuty: 'ON_DUTY',
  OffDuty: 'OFF_DUTY',
  Disabled: 'DISABLED'
};
n
Hey Salvador 👋 Mapped Enums would just change the enum value name in the database. So in your case the enums in database should be “ON_DUTY”, “OFF_DUTY” and “DISABLED” but in the PrismaClient they still would be OnDuty, OffDuty and Disabled
s
I see, I think it makes sense, thanks a lot for the help!
👍 1