110 lines
2.5 KiB
Text
110 lines
2.5 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"
|
|
binaryTargets = ["native"]
|
|
}
|
|
|
|
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[]
|
|
|
|
lastEditedBy User? @relation(fields: [lastEditedById], references: [id])
|
|
lastEditedById String?
|
|
|
|
@@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])
|
|
}
|
|
|
|
// User authentication
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
type String
|
|
provider String
|
|
providerAccountId String
|
|
refresh_token String?
|
|
refresh_expires_in Int?
|
|
access_token String?
|
|
expires_at Int?
|
|
token_type String?
|
|
scope String?
|
|
id_token String?
|
|
session_state String?
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([provider, providerAccountId])
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
sessionToken String @unique
|
|
userId String
|
|
expires DateTime
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String? @unique
|
|
emailVerified DateTime?
|
|
image String?
|
|
accounts Account[]
|
|
sessions Session[]
|
|
|
|
lastEditedPages ComicPage[]
|
|
}
|