comicbox/prisma/schema.prisma

64 lines
1.3 KiB
Text

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Comic {
id Int @id @default(autoincrement())
slug String @unique
title String
url String
pages ComicPage[]
characters ComicCharacter[]
}
model ComicPage {
id Int
comic Comic @relation(fields: [comicId], references: [id])
comicId Int
title String
url String
imageUrl String
width Int
height Int
bubbles ComicBubble[]
@@id([comicId, id])
@@unique([comicId, id])
}
model ComicCharacter {
id Int @id @default(autoincrement())
comic Comic @relation(fields: [comicId], references: [id])
comicId Int
shortName String
longName String @unique
bubbles ComicBubble[]
}
model ComicBubble {
comicId Int
page ComicPage @relation(fields: [comicId, pageId], references: [comicId, id])
pageId Int
idx Int
character ComicCharacter @relation(fields: [characterId], references: [id])
characterId Int
areaX Int
areaY Int
areaWidth Int
areaHeight Int
content String
@@id([comicId, pageId, idx])
@@unique([comicId, pageId, idx])
}