Hello, is there an issue with Prisma generating en...
# orm-help
a
Hello, is there an issue with Prisma generating enum queries. When I run prisma generate command, the generated file does not contain queries related to enum in mu model. I am using the following versions
Copy code
"dependencies": {
  "apollo-server-express": "^2.15.0",
  "babel-preset-env": "^1.7.0",
  "graphql": "^0.13.2",
  "graphql-cli": "^2.17.0",
  "graphql-yoga": "1.18.3",
  "prisma": "^1.34.10",
  "prisma-binding": "^2.3.16"
},
can someone please help? 🙂 thanks
r
Hey @Asad 👋 Could you tell exactly what would you mean by queries related to enum?
a
I have this model WeeklyGoal which has a reference to the completionStatus which is an enum. It seems Prisma is not generating properties related to enum "completionStatus", please see the WeeklyGoalWhereInput
Copy code
type WeeklyGoal {
  id: ID! @id
  goalText: String!
  goalType: [GoalCategory!] @scalarList(strategy: RELATION)
  goalValue: String
  completionStatus: [CompletionStatus] @scalarList(strategy: RELATION)
}

enum CompletionStatus {
  COMPLETE
  INCOMPLETE
  PARTIAL
}

input WeeklyGoalWhereInput {
  id: ID
  id_not: ID
  id_in: [ID!]
  id_not_in: [ID!]
  id_lt: ID
  id_lte: ID
  id_gt: ID
  id_gte: ID
  id_contains: ID
  id_not_contains: ID
  id_starts_with: ID
  id_not_starts_with: ID
  id_ends_with: ID
  id_not_ends_with: ID
  goalText: String
  goalText_not: String
  goalText_in: [String!]
  goalText_not_in: [String!]
  goalText_lt: String
  goalText_lte: String
  goalText_gt: String
  goalText_gte: String
  goalText_contains: String
  goalText_not_contains: String
  goalText_starts_with: String
  goalText_not_starts_with: String
  goalText_ends_with: String
  goalText_not_ends_with: String
  goalValue: String
  goalValue_not: String
  goalValue_in: [String!]
  goalValue_not_in: [String!]
  goalValue_lt: String
  goalValue_lte: String
  goalValue_gt: String
  goalValue_gte: String
  goalValue_contains: String
  goalValue_not_contains: String
  goalValue_starts_with: String
  goalValue_not_starts_with: String
  goalValue_ends_with: String
  goalValue_not_ends_with: String
  goalNumber: Int
  goalNumber_not: Int
  goalNumber_in: [Int!]
  goalNumber_not_in: [Int!]
  goalNumber_lt: Int
  goalNumber_lte: Int
  goalNumber_gt: Int
  goalNumber_gte: Int
  user: UserWhereInput
  implementationPlan: String
  implementationPlan_not: String
  implementationPlan_in: [String!]
  implementationPlan_not_in: [String!]
  implementationPlan_lt: String
  implementationPlan_lte: String
  implementationPlan_gt: String
  implementationPlan_gte: String
  implementationPlan_contains: String
  implementationPlan_not_contains: String
  implementationPlan_starts_with: String
  implementationPlan_not_starts_with: String
  implementationPlan_ends_with: String
  implementationPlan_not_ends_with: String
  weeklyReview: WeeklyReviewWhereInput
  updatedAt: DateTime
  updatedAt_not: DateTime
  updatedAt_in: [DateTime!]
  updatedAt_not_in: [DateTime!]
  updatedAt_lt: DateTime
  updatedAt_lte: DateTime
  updatedAt_gt: DateTime
  updatedAt_gte: DateTime
  createdAt: DateTime
  createdAt_not: DateTime
  createdAt_in: [DateTime!]
  createdAt_not_in: [DateTime!]
  createdAt_lt: DateTime
  createdAt_lte: DateTime
  createdAt_gt: DateTime
  createdAt_gte: DateTime
  AND: [WeeklyGoalWhereInput!]
  OR: [WeeklyGoalWhereInput!]
  NOT: [WeeklyGoalWhereInput!]
}
@Ryan any help would be appreciated when you have time 🙂
r
Could you share the Prisma datamodel as well?
a
Sure,
Copy code
enum CompletionStatus {
  COMPLETE
  INCOMPLETE
  PARTIAL
}


type WeeklyGoal {
  id: ID! @id
  goalText: String!
  goalType: [GoalCategory!] @scalarList(strategy: RELATION)
  goalValue: String
  completionStatus: [CompletionStatus] @scalarList(strategy: RELATION)
  goalNumber: Int!
  user: User!
  implementationPlan : String
  weeklyReview: WeeklyReview!
  updatedAt: DateTime! @updatedAt
  createdAt: DateTime! @createdAt
}
r
It's due to
completionStatus
being a scalar list. It will work if completion status was a simple value and not a list
❤️ 1
You can check this thread as well for a workaround 🙂