metaforecast/prisma/schema.prisma
2022-06-03 20:03:13 +03:00

96 lines
2.3 KiB
Plaintext

generator client {
provider = "prisma-client-js"
previewFeatures = ["interactiveTransactions"]
}
generator pothos {
provider = "prisma-pothos-types"
}
datasource db {
provider = "postgresql"
url = env("DIGITALOCEAN_POSTGRES")
}
model Dashboard {
id String @id
title String
description String
contents Json
timestamp DateTime @db.Timestamp(6)
creator String
extra Json
@@map("dashboards")
}
model Question {
/// E.g. "fantasyscotus-580"
id String @id
/// E.g. "In Wooden v. U.S., the SCOTUS will affirm the lower court's decision"
title String
/// E.g. "https://fantasyscotus.net/user-predictions/case/wooden-v-us/"
url String
/// E.g. "fantasyscotus"
platform String
/// E.g. "62.50% (75 out of 120) of FantasySCOTUS players predict that the lower court's decision will be affirmed. FantasySCOTUS overall predicts an outcome of Affirm 6-3. Historically, FantasySCOTUS has chosen the correct side 50.00% of the time."
description String
// E.g.:
// [
// {
// "name": "Yes",
// "probability": 0.625,
// "type": "PROBABILITY"
// },
// {
// "name": "No",
// "probability": 0.375,
// "type": "PROBABILITY"
// }
// ]
options Json
fetched DateTime @db.Timestamp(6)
firstSeen DateTime @map("first_seen") @db.Timestamp(6)
// {
// "numforecasts": 120,
// "stars": 2
// }
qualityindicators Json
extra Json
onFrontpage FrontpageId?
history History[]
@@index([platform])
@@index([fetched])
@@index([firstSeen])
@@map("questions")
}
model History {
id String
idref String?
question Question? @relation(fields: [idref], references: [id], onDelete: SetNull, onUpdate: Restrict)
title String
url String
platform String
description String
options Json
fetched DateTime @db.Timestamp(6)
qualityindicators Json
extra Json
pk Int @id @default(autoincrement())
@@index([id])
@@index([platform])
@@index([fetched])
@@map("history")
}
model FrontpageId {
question Question @relation(fields: [id], references: [id], onDelete: Cascade)
id String @unique
}