harrishawker
harrishawker
Explore posts from servers
PPrisma
Created by harrishawker on 10/13/2024 in #help-and-questions
The relation field on model is missing an opposite relation field on the model
Hey ya'll. Not sure how to describe this, so I'll just post my code and issue.
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}

enum Sex {
suspected_male
suspected_female
male
female
intersex
unknown
}

model Animal {
id Int @id @default(autoincrement())
species String @db.VarChar(255)
spcies_scientific_name String @db.VarChar(255)
age String @db.VarChar(255)
dob DateTime?
sex Sex

mother Animal? @relation(name: "Mother", fields: [motherId], references: [id])
motherId Int? // relation scalar field (used in the `@relation` attribute above)

father Animal? @relation(name: "Father", fields: [fatherId], references: [id])
fatherId Int? // relation scalar field (used in the `@relation` attribute above)
}
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}

enum Sex {
suspected_male
suspected_female
male
female
intersex
unknown
}

model Animal {
id Int @id @default(autoincrement())
species String @db.VarChar(255)
spcies_scientific_name String @db.VarChar(255)
age String @db.VarChar(255)
dob DateTime?
sex Sex

mother Animal? @relation(name: "Mother", fields: [motherId], references: [id])
motherId Int? // relation scalar field (used in the `@relation` attribute above)

father Animal? @relation(name: "Father", fields: [fatherId], references: [id])
fatherId Int? // relation scalar field (used in the `@relation` attribute above)
}
The relation field `mother` on model `Animal` is missing an opposite relation field on the model `Animal`.
The relation field `father` on model `Animal` is missing an opposite relation field on the model `Animal`.
The relation field `mother` on model `Animal` is missing an opposite relation field on the model `Animal`.
The relation field `father` on model `Animal` is missing an opposite relation field on the model `Animal`.
How do I solve this? I'm aware it needs to opposite relation field, but that doesn't really work here...
5 replies
DDeno
Created by harrishawker on 4/19/2024 in #help
MySQL Parameters Not Working
No description
11 replies