Anyone know why I'm getting a unique constraint fa...
# orm-help
b
Anyone know why I'm getting a unique constraint fail on "taskID" when trying to create a new entry on the "Tasks" model?
Copy code
model Task {
  id          String    @id @default(cuid())
  title       String
  description String
  location    Location?
  quiz        Quiz[]
  tasks       Tasks?
}

model Tasks {
  id       Int    @id @default(autoincrement())
  sequence Int
  lat      Float?
  lng      Float?
  distance Float?
  quiz     Int?
  seedID   String
  taskID   String
  task     Task   @relation(fields: [taskID], references: [id])
  seed     Seed   @relation(fields: [seedID], references: [id])
}
Unique constraint failed on the fields: (
taskID
)
r
Do you want a 1-1 relation b/w
Task
and
Tasks
or a 1-many?
b
Oh, god. I can't believe I missed that. Added the [] to Tasks relational field on Task and it solved it 😛
💯 1
Thanks!
🙌 1