Init prisma
This commit is contained in:
306
prisma/schema.prisma
Normal file
306
prisma/schema.prisma
Normal file
@ -0,0 +1,306 @@
|
||||
// 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
|
||||
|
||||
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
|
||||
|
||||
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 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")
|
||||
}
|
||||
|
||||
model Image {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
fileKey String
|
||||
imageName String
|
||||
originalFile 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[]
|
||||
|
||||
albumCover Album[] @relation("AlbumCoverImage")
|
||||
galleryCover Gallery[] @relation("GalleryCoverImage")
|
||||
categories Category[] @relation("ImageCategories")
|
||||
tags Tag[] @relation("ImageTags")
|
||||
}
|
||||
|
||||
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])
|
||||
}
|
||||
|
||||
model ColorPalette {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
name String
|
||||
|
||||
items ColorPaletteItem[]
|
||||
images ImagePalette[]
|
||||
}
|
||||
|
||||
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 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 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])
|
||||
}
|
Reference in New Issue
Block a user