224 lines
4.7 KiB
Plaintext
224 lines
4.7 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
|
|
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
model Artwork {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
sortIndex Int @default(0)
|
|
|
|
name String @unique
|
|
slug String @unique
|
|
|
|
altText String?
|
|
description String?
|
|
notes String?
|
|
month Int?
|
|
year Int?
|
|
sortKey Int?
|
|
okLabL Float?
|
|
okLabA Float?
|
|
okLabB Float?
|
|
creationDate DateTime?
|
|
needsWork Boolean @default(true)
|
|
nsfw Boolean @default(false)
|
|
published Boolean @default(false)
|
|
setAsHeader Boolean @default(false)
|
|
|
|
fileId String @unique
|
|
file FileData @relation(fields: [fileId], references: [id])
|
|
|
|
galleryId String?
|
|
gallery Gallery? @relation(fields: [galleryId], references: [id])
|
|
|
|
metadata ArtworkMetadata?
|
|
|
|
albums Album[]
|
|
categories ArtCategory[]
|
|
colors ArtworkColor[]
|
|
tags ArtTag[]
|
|
variants FileVariant[]
|
|
}
|
|
|
|
model Album {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
sortIndex Int @default(0)
|
|
|
|
name String @unique
|
|
slug String @unique
|
|
|
|
description String?
|
|
|
|
artworks Artwork[]
|
|
}
|
|
|
|
model Gallery {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
sortIndex Int @default(0)
|
|
|
|
name String @unique
|
|
slug String @unique
|
|
|
|
description String?
|
|
|
|
artworks Artwork[]
|
|
}
|
|
|
|
model ArtCategory {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
sortIndex Int @default(0)
|
|
|
|
name String @unique
|
|
slug String @unique
|
|
|
|
description String?
|
|
|
|
artworks Artwork[]
|
|
tags ArtTag[]
|
|
}
|
|
|
|
model ArtTag {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
sortIndex Int @default(0)
|
|
|
|
name String @unique
|
|
slug String @unique
|
|
showOnAnimalPage Boolean @default(false)
|
|
|
|
description String?
|
|
|
|
aliases ArtTagAlias[]
|
|
artworks Artwork[]
|
|
categories ArtCategory[]
|
|
|
|
parentId String?
|
|
parent ArtTag? @relation("TagHierarchy", fields: [parentId], references: [id], onDelete: SetNull)
|
|
children ArtTag[] @relation("TagHierarchy")
|
|
}
|
|
|
|
model ArtTagAlias {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
alias String @unique
|
|
|
|
tagId String
|
|
tag ArtTag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([tagId, alias])
|
|
@@index([alias])
|
|
}
|
|
|
|
model Color {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
name String @unique
|
|
type String
|
|
|
|
hex String?
|
|
blue Int?
|
|
green Int?
|
|
red Int?
|
|
|
|
artworks ArtworkColor[]
|
|
}
|
|
|
|
model ArtworkColor {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
artworkId String
|
|
colorId String
|
|
type String
|
|
|
|
artwork Artwork @relation(fields: [artworkId], references: [id])
|
|
color Color @relation(fields: [colorId], references: [id])
|
|
|
|
@@unique([artworkId, type])
|
|
}
|
|
|
|
model ArtworkMetadata {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
artworkId String @unique
|
|
depth String
|
|
format String
|
|
space String
|
|
channels Int
|
|
height Int
|
|
width Int
|
|
|
|
autoOrientH Int?
|
|
autoOrientW Int?
|
|
bitsPerSample Int?
|
|
density Int?
|
|
hasAlpha Boolean?
|
|
hasProfile Boolean?
|
|
isPalette Boolean?
|
|
isProgressive Boolean?
|
|
|
|
artwork Artwork @relation(fields: [artworkId], references: [id])
|
|
}
|
|
|
|
model FileData {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
fileKey String @unique
|
|
originalFile String @unique
|
|
fileType String
|
|
name String
|
|
fileSize Int
|
|
uploadDate DateTime
|
|
|
|
artwork Artwork?
|
|
}
|
|
|
|
model FileVariant {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
s3Key String
|
|
type String
|
|
height Int
|
|
width Int
|
|
|
|
fileExtension String?
|
|
mimeType String?
|
|
url String?
|
|
sizeBytes Int?
|
|
|
|
artworkId String
|
|
artwork Artwork @relation(fields: [artworkId], references: [id])
|
|
|
|
@@unique([artworkId, type])
|
|
}
|