2022-03-27 22:22:28 +00:00
generator client {
2022-04-27 18:07:00 +00:00
provider = "prisma-client-js"
previewFeatures = ["interactiveTransactions"]
2022-03-27 22:22:28 +00:00
}
2022-04-14 20:32:01 +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
2022-04-14 20:32:01 +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
2022-04-14 20:32:01 +00:00
@@map("dashboards")
2022-04-05 20:38:40 +00:00
}
2022-04-14 20:32:01 +00:00
model Question {
2022-04-23 19:44:38 +00:00
/// 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
2022-05-20 20:59:33 +00:00
fetched DateTime @db.Timestamp(6)
firstSeen DateTime @map("first_seen") @db.Timestamp(6)
2022-04-23 19:44:38 +00:00
// {
// "numforecasts": 120,
// "stars": 2
// }
2022-04-05 20:38:40 +00:00
qualityindicators Json
extra Json
2022-04-14 20:32:01 +00:00
2022-04-22 19:50:28 +00:00
onFrontpage FrontpageId?
2022-04-27 18:07:00 +00:00
history History[]
2022-05-20 20:59:33 +00:00
@@index([platform])
@@index([fetched])
@@index([firstSeen])
2022-04-14 20:32:01 +00:00
@@map("questions")
2022-04-05 20:38:40 +00:00
}
2022-04-22 19:50:28 +00:00
2022-05-20 20:59:33 +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")
}
2022-04-22 19:50:28 +00:00
model FrontpageId {
2022-06-03 17:03:13 +00:00
question Question @relation(fields: [id], references: [id], onDelete: Cascade)
2022-04-22 19:50:28 +00:00
id String @unique
}
2022-06-03 13:52:19 +00:00
model Robot {
id Int @id @default(autoincrement())
platform String
url String // non-unique, rescheduling always creates a new row
context Json
created DateTime @db.Timestamp(6)
scheduled DateTime @db.Timestamp(6) // can be equal to `created` or can be in the future for rescheduling or other purposes
completed DateTime? @db.Timestamp(6) // becomes non-null when the job is done
tried Int @default(0) // used to set a limit on max attempts for badly written platforms
}