P
Prisma5w ago
Noah

Using the same GraphEntry model for different graphs

I've got two models and am trying to have two different graphs using the same GraphEntry model with a different graph type. Any way to do this?
model House {
id Int @id @default(autoincrement())

internal_id String @unique

// ...

// Graphing
graph_first GraphEntry[]
graph_second GraphEntry[]
}

model GraphEntry {
entry_id String @id @default(cuid())
parent_internal_id String

time_created DateTime @default(now())
value Int

graph_type GraphType

house House @relation(fields: [parent_internal_id], references: [internal_id])
}

enum GraphType {
FirstGraph
SecondGraph
}
model House {
id Int @id @default(autoincrement())

internal_id String @unique

// ...

// Graphing
graph_first GraphEntry[]
graph_second GraphEntry[]
}

model GraphEntry {
entry_id String @id @default(cuid())
parent_internal_id String

time_created DateTime @default(now())
value Int

graph_type GraphType

house House @relation(fields: [parent_internal_id], references: [internal_id])
}

enum GraphType {
FirstGraph
SecondGraph
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server