how can i use array of enums at prisma2 schema for...
# orm-help
p
how can i use array of enums at prisma2 schema for mysql? if not possible what is the workaround for it? i want something like this: roles Roles[] @default([USER])
r
@prisma-chobo 👋 Adding a
@default
to array of enums is not supported yet. One workaround would be to append it in your application logic. It would be great if you could create a feature request here for the same so that we can look into this 🙂
m
@prisma-chobo first create an enum on
prisma schema
Copy code
enum Roles {
  admin
  user
}

#then add it to the model

model Users {
  id    Int    @id @default(autoincrement()) 
  roles Roles
  ...
}
p
but this is not list isnt it?
@Ryan thank you ryan
@Ryan but even without default enum list in and of itself doesnt seem to work right now right?
r
It works fine. Are you facing any issue?
p
yes my connector is mysql and its complaning about it does not support list enums :(
with red underline
r
Ahh, it’s only supported for Postgres at the moment. There’s a request for MySQL that you can follow here and add a 👍 as well.
p
thank you again ryan!!