Add image upload and edit functions
This commit is contained in:
203
prisma/schema.prisma
Normal file
203
prisma/schema.prisma
Normal file
@ -0,0 +1,203 @@
|
||||
// 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
|
||||
|
||||
description String?
|
||||
|
||||
artworks Artwork[]
|
||||
categories ArtCategory[]
|
||||
}
|
||||
|
||||
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])
|
||||
}
|
||||
Reference in New Issue
Block a user