Database modelling question, how would I make some...
# orm-help
w
Database modelling question, how would I make something like this work:
Copy code
type ExternalSource {
  id: ID! @unique
  name: SourceName!
  event: Event @relation(name: "EventExternalSources")
  sourceId: String
  sourceUrl: String
}

type Event {
  id: ID! @unique
  name: String!
  subtitle: String
  startsAt: DateTime
  endsAt: DateTime
  location: EventLocation
  parent: Event @relation(name: "EventExternalChildren"),
  externalChildren: [Event!] @relation(name: "EventExternalChildren")
  externalSources: [ExternalSource!] @relation(name: "EventExternalSources")
  externalSource: ExternalSource @relation(name: "EventExternalSources")
  createdAt: DateTime!
  updatedAt: DateTime!
}
Explanation: We want different versions of DataSources for an Event, in that Event we want a Primary DataSource and all the other externalSources to be available, if a Event is a from a externalSource, we want it linked to the parent event. Will this (simplified) data model make sense?
h
looks good to me