metaforecast/prisma/schema.prisma

96 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

2022-03-27 22:22:28 +00:00
generator client {
provider = "prisma-client-js"
previewFeatures = ["interactiveTransactions"]
2022-03-27 22:22:28 +00:00
}
generator pothos {
provider = "prisma-pothos-types"
}
2022-03-27 22:22:28 +00:00
datasource db {
provider = "postgresql"
url = env("DIGITALOCEAN_POSTGRES")
}
2022-04-05 20:38:40 +00:00
model Dashboard {
2022-04-05 20:38:40 +00:00
id String @id
title String
description String
contents Json
timestamp DateTime @db.Timestamp(6)
creator String
extra Json
@@map("dashboards")
2022-04-05 20:38:40 +00:00
}
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
// }
2022-04-05 20:38:40 +00:00
qualityindicators Json
extra Json
onFrontpage FrontpageId?
history History[]
@@index([platform])
@@index([fetched])
@@index([firstSeen])
@@map("questions")
2022-04-05 20:38:40 +00:00
}
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
}