Files
spsays-training/prisma/schema.prisma
2026-04-14 19:12:11 +05:30

78 lines
2.6 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
// ---------------------------------------------------------------------------
// Synonym — embedded document inside Verse
// ---------------------------------------------------------------------------
type Synonym {
word String
meanings String[]
}
// ---------------------------------------------------------------------------
// Verse — unified model for BG, SB, and CC verses
//
// book: "bg" | "sb" | "cc"
// division: null for BG, canto number string for SB ("1"-"10"),
// līlā key for CC ("adi", "madhya", "antya")
// chapter: chapter number
// verse: verse number (first verse number for multi-verse entries)
// verseEnd: last verse number for multi-verse entries (e.g. 18 for "16-18")
// reference: display reference string (e.g. "Bg 1.1", "SB 1.1.1", "Cc Ādi 1.1")
// ---------------------------------------------------------------------------
model Verse {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String // "bg" | "sb" | "cc"
division String? // null for BG; canto for SB; lila for CC
chapter Int
verse Int
verseEnd Int?
reference String
bookTitle String
devanagari String
bengali String? // only CC has Bengali
transliteration String
synonyms Synonym[]
translation String
purport String[]
@@unique([book, division, chapter, verse])
@@index([book])
@@index([book, division])
@@index([book, division, chapter])
@@map("verses")
}
// ---------------------------------------------------------------------------
// BookMeta — stores the intro.json data for each book
//
// The `data` field stores the entire intro JSON as a flexible JSON blob,
// since BG/SB/CC each have different structures (chapters vs cantos vs lilas).
// ---------------------------------------------------------------------------
model BookMeta {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String @unique // "bg" | "sb" | "cc"
data Json
@@map("book_meta")
}
// ---------------------------------------------------------------------------
// GlossaryEntry — individual glossary term + definition
// ---------------------------------------------------------------------------
model GlossaryEntry {
id String @id @default(auto()) @map("_id") @db.ObjectId
term String
definition String
definitionHtml String
@@unique([term])
@@map("glossary")
}