can anyone help? I faced some problems when design...
# orm-help
a
can anyone help? I faced some problems when designing the schema. case 1:
Copy code
model User {
  package: @relation(fields: [authorId], references: [id])
  packageId: Int
}

model Package {
  user User[]
}
one package can be subscribed by hundreds of users. So, I think this is the way to go. But, the problem is, when a package needs to be deleted, the user(admin) is also needed to be deleted. which we don't want case 2:
Copy code
model User {
  package Package[]
}

model package {
  author      User?  @relation(fields: [authorId], references: [id])
  authorId    Int?
}
by designing this way, when the package is deleted, the user is not deleted. but I can't connect multiple users to a package.
m
If im not wrong, you should have a join table. So you should have a user table and a package table. Then you should have a
packageToUser
table
Normally its called something like
purchases
the purchase would link one user to one package