2

I have data in the table but prisma returns empty response. Database is hosted on Planetscale and it is MySQL. This is schema of the table:

model BindingTeacherLessons {
  bindingId Int
  teacherId Int
  lessons   Int

  binding Binding @relation(fields: [bindingId], references: [id], onDelete: Cascade)
  teacher Teacher @relation(fields: [teacherId], references: [id], onDelete: Cascade)

  @@id([bindingId, teacherId])
  @@index([bindingId])
  @@index([teacherId])
}

This query returns {} and no errors

const response = prisma.bindingTeacherLessons.findMany({})

1 Answers1

0

It seems that the problem was that I have populated BindingTeacherLessons table with createMany(). Fix was to populate it with create().

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 25 '22 at 10:04