// 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 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 name String slug String description String? // coverImageId String? galleryId String? // coverImage Image? @relation("AlbumCoverImage", fields: [coverImageId], references: [id]) gallery Gallery? @relation(fields: [galleryId], references: [id]) images Image[] } model Artist { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt slug String @unique displayName String nickname String? socials Social[] images Image[] } model Social { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt handle String platform String isPrimary Boolean link String? artistId String? artist Artist? @relation(fields: [artistId], references: [id]) } model Image { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt fileKey String imageName String originalFile String uploadDate DateTime @default(now()) altText String? description String? fileType String? imageData 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]) // sourceId String? // source Source? @relation(fields: [sourceId], references: [id]) metadata ImageMetadata[] pixels PixelSummary[] stats ImageStats[] theme ThemeSeed[] variants ImageVariant[] // albumCover Album[] @relation("AlbumCoverImage") // galleryCover Gallery[] @relation("GalleryCoverImage") categories Category[] @relation("ImageCategories") colors ImageColor[] @relation("ImageToImageColor") extractColors ExtractColor[] @relation("ImageToExtractColor") palettes ColorPalette[] @relation("ImagePalettes") tags Tag[] @relation("ImageTags") } model ImageMetadata { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt imageId String 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 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]) } model ColorPalette { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt name String type String items ColorPaletteItem[] 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") } model ImageColor { 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 Image[] @relation("ImageToImageColor") } 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 Category { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt name String @unique description String? images Image[] @relation("ImageCategories") } model Tag { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt name String @unique description String? images Image[] @relation("ImageTags") }