PrismaP
Prisma12mo ago
Hydroper

Dependency-dependents relations

I am having difficulty understanding whether my schema is correct, even if it reports no errors. It's basically that I'm trying to express a package registry as part of a package manager, and am having difficulty specifying
dependencies
and
dependents
relations as part of the
PackageVersion
model.

model PackageVersion {
  id                  BigInt                   @id @default(autoincrement())
  versionNumber       String
  publishedAt         DateTime                 @default(now())
  zip                 Bytes
  package             Package                  @relation(fields: [packageId], references: [id])
  packageId           BigInt
  dependencies        PackageVersion[]         @relation("Dependency")
  dependents          PackageVersion[]         @relation("Dependency")
  yanked              Boolean                  @default(false)
}
Was this page helpful?