kaushik.
PPrisma
•Created by kaushik. on 7/29/2024 in #help-and-questions
Help me out with this pls
I am pretty new to Prisma and I still am unable to debug and solve this prisma code:
Error:
Error: P1012
error: Error validating field `admin` in model `Admin`: The relation field `admin` on model `Admin` is missing an opposite relation field on the model `User`. Either run `prisma format` or add it manually.
--> schema.prisma:29
|
28 | id Int @id @default(autoincrement())
29 | admin User @relation(fields: [adminId], references: [id])
30 | adminId Int
|
error: Error validating field `question_testcases` in model `Question`: The relation field `question_testcases` on model `Question` is missing an opposite relation field on the model `TestCases`. Either run `prisma format` or add it manually.
--> schema.prisma:47
|
46 | question_points Int
47 | question_testcases TestCases[]
48 | question_author User @relation(fields: [authorId], references: [id])
|
error: Error validating field `question_author` in model `Question`: The relation field `question_author` on model `Question` is missing an opposite relation field on the model `User`. Either run `prisma format` or add it manually.
--> schema.prisma:48
|
47 | question_testcases TestCases[]
48 | question_author User @relation(fields: [authorId], references: [id])
49 | authorId Int
|
error: Error validating field `solved_by` in model `Question`: The relation field `solved_by` on model `Question` is missing an opposite relation field on the model `User`. Either run `prisma format` or add it manually.
--> schema.prisma:51
|
50 | attempted_by User[] @relation("attempted")
51 | solved_by User[] @relation("solved")
52 | submissions Submission[]
Error: P1012
error: Error validating field `admin` in model `Admin`: The relation field `admin` on model `Admin` is missing an opposite relation field on the model `User`. Either run `prisma format` or add it manually.
--> schema.prisma:29
|
28 | id Int @id @default(autoincrement())
29 | admin User @relation(fields: [adminId], references: [id])
30 | adminId Int
|
error: Error validating field `question_testcases` in model `Question`: The relation field `question_testcases` on model `Question` is missing an opposite relation field on the model `TestCases`. Either run `prisma format` or add it manually.
--> schema.prisma:47
|
46 | question_points Int
47 | question_testcases TestCases[]
48 | question_author User @relation(fields: [authorId], references: [id])
|
error: Error validating field `question_author` in model `Question`: The relation field `question_author` on model `Question` is missing an opposite relation field on the model `User`. Either run `prisma format` or add it manually.
--> schema.prisma:48
|
47 | question_testcases TestCases[]
48 | question_author User @relation(fields: [authorId], references: [id])
49 | authorId Int
|
error: Error validating field `solved_by` in model `Question`: The relation field `solved_by` on model `Question` is missing an opposite relation field on the model `User`. Either run `prisma format` or add it manually.
--> schema.prisma:51
|
50 | attempted_by User[] @relation("attempted")
51 | solved_by User[] @relation("solved")
52 | submissions Submission[]
6 replies