Skip to content

Instantly share code, notes, and snippets.

@kingRayhan
Created December 20, 2022 03:52
Show Gist options
  • Save kingRayhan/0c90a2d38f2c4b75f0cf70948dbf8255 to your computer and use it in GitHub Desktop.
Save kingRayhan/0c90a2d38f2c4b75f0cf70948dbf8255 to your computer and use it in GitHub Desktop.
model File {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
key String
bucket String
events Event[] @relation("EventLogos")
eventDocs Event[] @relation("EventDocs")
@@map("files")
}
model Event {
id String @id @default(auto()) @map("_id") @db.ObjectId
logoId String? @db.ObjectId
logo File? @relation("EventLogos", fields: [logoId], references: [id])
docIds String[] @db.ObjectId
docs File[] @relation("EventDocs", fields: [docIds], references: [id])
@@map("events")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment