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 } 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 }