enum @map value

I have this enum mapping but it doesn't generate the same value instead it uses the key as the value.
enum Gender {
MALE @map("M")
FEMALE @map("F")
}
enum Gender {
MALE @map("M")
FEMALE @map("F")
}
No description
6 Replies
stryche.
stryche.OP2w ago
GitHub
Use @map'ed enum values as TS enum values · Issue #8446 · prisma/pr...
Problem Consider the following schema: model Payment { id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid amount Decimal @db.Decimal(14, 2) provider PaymentProvider created...
stryche.
stryche.OP2w ago
still has no updates about this issue.. or will this going to be abandoned?
stryche.
stryche.OP2w ago
GitHub
feat(client): [breaking] use enum "@map" values as JS/TS values by ...
DRAFT, still experimental. This PR contributes to #8446 and #273, and it depends on its companion PR prisma/prisma-engines#4987. This PR introduces a breaking change, let's wait for Prisma 6.
stryche.
stryche.OP2w ago
I tried using this and it works as what my enum would generate. I hope the pr will be accepted,. for now i just patch the prisma with this pr..
Nurul
Nurul2w ago
Thanks for linking the PR. It will be accepted as the PR is from our ORM engineering team 🙂 At the moment, the behaviour you are observing is intentional. Considering this is a breaking change, the plan is to have it in next major Prisma release i.e. Prisma 6
stryche.
stryche.OP2w ago
nice ❤️ I just notice when trying to insert data to db, it still using the enum key instead of the value of @map.. maybe because of the pr on prisma-engines that still not merge yet.. anyways, I will just wait for prisma 6 release!
Want results from more Discord servers?
Add your server