Noah
Noah
Explore posts from servers
PPrisma
Created by Noah on 9/19/2024 in #help-and-questions
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
}
1 replies