Files
app.fellies.art/prisma/schema.prisma
2025-07-03 11:55:51 +02:00

348 lines
7.6 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-js"
output = "../src/generated/prisma"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Gallery {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sortIndex Int @default(0)
slug String @unique
name String
description String?
coverImageId String?
coverImage Image? @relation("GalleryCoverImage", fields: [coverImageId], references: [id])
albums Album[]
}
model Album {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sortIndex Int @default(0)
slug String
name String
description String?
coverImageId String?
galleryId String?
coverImage Image? @relation("AlbumCoverImage", fields: [coverImageId], references: [id])
gallery Gallery? @relation(fields: [galleryId], references: [id])
images Image[]
@@unique([galleryId, slug])
}
model Artist {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sortIndex Int @default(0)
slug String @unique
displayName String
nickname String?
description String?
source String?
socials Social[]
images Image[]
}
model Social {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sortIndex Int @default(0)
handle String
platform String
isPrimary Boolean @default(false)
isVisible Boolean @default(true)
link String?
artistId String?
artist Artist? @relation(fields: [artistId], references: [id])
}
model Category {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sortIndex Int @default(0)
name String @unique
description String?
images Image[] @relation("ImageCategories")
}
model Tag {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sortIndex Int @default(0)
name String @unique
description String?
images Image[] @relation("ImageTags")
}
model Image {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sortIndex Int @default(0)
fileKey String @unique
originalFile String @unique
imageName String
uploadDate DateTime @default(now())
nsfw Boolean @default(false)
altText String?
description String?
fileType String?
imageData String?
source String?
creationMonth Int?
creationYear Int?
fileSize Int?
creationDate DateTime?
albumId String?
artistId String?
album Album? @relation(fields: [albumId], references: [id])
artist Artist? @relation(fields: [artistId], references: [id])
metadata ImageMetadata?
stats ImageStats?
colors ImageColor[]
extractColors ImageExtractColor[]
palettes ImagePalette[]
variants ImageVariant[]
// pixels PixelSummary[]
// theme ThemeSeed[]
albumCover Album[] @relation("AlbumCoverImage")
galleryCover Gallery[] @relation("GalleryCoverImage")
categories Category[] @relation("ImageCategories")
// colors ImageColor[] @relation("ImageToImageColor")
tags Tag[] @relation("ImageTags")
// palettes ColorPalette[] @relation("ImagePalettes")
}
model ImageMetadata {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
imageId 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?
image Image @relation(fields: [imageId], references: [id])
}
model ImageStats {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
imageId String @unique
entropy Float
sharpness Float
dominantB Int
dominantG Int
dominantR Int
isOpaque Boolean
image Image @relation(fields: [imageId], references: [id])
}
model ImageVariant {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
imageId String
s3Key String
type String
height Int
width Int
fileExtension String?
mimeType String?
url String?
sizeBytes Int?
image Image @relation(fields: [imageId], references: [id])
@@unique([imageId, type])
}
model ColorPalette {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
items ColorPaletteItem[]
images ImagePalette[]
// images Image[] @relation("ImagePalettes")
}
model ColorPaletteItem {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
tone Int?
hex String?
colorPaletteId String?
colorPalette ColorPalette? @relation(fields: [colorPaletteId], references: [id])
}
model ExtractColor {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String @unique
hex String
blue Int
green Int
red Int
area Float?
hue Float?
saturation Float?
// images Image[] @relation("ImageToExtractColor")
images ImageExtractColor[]
}
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?
images ImageColor[]
}
// model ThemeSeed {
// id String @id @default(cuid())
// createdAt DateTime @default(now())
// updatedAt DateTime @updatedAt
// imageId String
// seedHex String
// image Image @relation(fields: [imageId], references: [id])
// }
// model PixelSummary {
// id String @id @default(cuid())
// createdAt DateTime @default(now())
// updatedAt DateTime @updatedAt
// imageId String
// channels Int
// height Int
// width Int
// image Image @relation(fields: [imageId], references: [id])
// }
model ImagePalette {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
imageId String
paletteId String
type String
image Image @relation(fields: [imageId], references: [id])
palette ColorPalette @relation(fields: [paletteId], references: [id])
@@unique([imageId, type])
}
model ImageExtractColor {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
imageId String
extractId String
type String
image Image @relation(fields: [imageId], references: [id])
extract ExtractColor @relation(fields: [extractId], references: [id])
@@unique([imageId, type])
}
model ImageColor {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
imageId String
colorId String
type String
image Image @relation(fields: [imageId], references: [id])
color Color @relation(fields: [colorId], references: [id])
@@unique([imageId, type])
}