Files
spsays-training/prisma/schema.prisma
T
2026-04-16 00:48:48 +05:30

108 lines
3.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")
}
// ---------------------------------------------------------------------------
// ProseChapter — for prose books like Kṛṣṇa Book (no verse structure)
//
// book: "kb"
// volume: volume number (1 or 2 for KB)
// chapter: chapter number within the volume
// title: chapter title
// type: "chapter" | "intro-segment"
// slug: URL-friendly identifier (e.g. "01", "preface", "words-from-apple")
// order: sort order (chapter number for chapters, custom for intro segments)
// paragraphs: array of HTML paragraph strings
// ---------------------------------------------------------------------------
model ProseChapter {
id String @id @default(auto()) @map("_id") @db.ObjectId
book String // "kb"
volume Int
chapter Int? // null for intro segments
title String
type String // "chapter" | "intro-segment"
slug String
order Int
paragraphs String[]
@@unique([book, volume, slug])
@@index([book])
@@index([book, volume])
@@index([book, volume, type])
@@map("prose_chapters")
}
// ---------------------------------------------------------------------------
// 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")
}