Can someone point me in the right direction regard...
# orm-help
m
Can someone point me in the right direction regarding including a enum column in a findMany query response? I have status column that i would like to include. Been fiddling around for a while but can’t really figure it out. 😔
Copy code
model Claim {
  id              Int       @id @default(autoincrement())
  customerName    String
  customerId      String
  contactPerson   String
  phone           String
  email           String
  orderId         String
  reference       String
  comment         String?
  createdAt       DateTime  @default(now())
  status          Status    @default(NEW)
  articles        Article[]
}

enum Status {
  NEW
  PROCESSING
  COMPLETED
}

await prisma.claim.findMany({
  include: {
    articles: true
  }
});

{
  id: 1,
  customerName: 'Name',
  customerId: 'Id',
  contactPerson: 'Person',
  phone: '049010000',
  email: '<mailto:email@mail.se|email@mail.se>',
  orderId: 'test123',
  reference: 'ref123',
  comment: 'Not bad',
  createdAt: 2021-06-17T18:26:36.529Z,
  articles: [ [Object] ]
}
r
@Mattias Ottosson 👋 Enums are included by default soyoe should get them in the response.
m
That’s what i thought actually, but it dosen’t seem to work
r
Works fine. Are you logging it to the console? And what’s your Prisma version?
m
2.22.1
r
Could you update to the latest and check? Also where are you getting this output?
m
Just ran it in the node console now
r
Try upgrading and check otherwise try running it via script like
prisma db seed
.
m
2.25.0 did the trick
1
🤷‍♂️
Should have tried that first. Thanks a lot!
🙌 1