Hydroper
Hydroper
PPrisma
Created by Hydroper on 1/4/2025 in #help-and-questions
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)
}
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)
}
4 replies