generator client { provider = "prisma-client" output = "./generated/client" } datasource db { provider = "postgresql" } model Post { id String @id @default(uuid()) title String slug String @unique excerpt String? body String status String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model User { id String @id name String email String username String? @unique emailVerified Boolean @default(false) image String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt role String @default("editor") isBanned Boolean @default(false) isSystem Boolean @default(false) isHidden Boolean @default(false) isProtected Boolean @default(false) sessions Session[] accounts Account[] @@unique([email]) @@index([role]) @@map("user") } model Session { id String @id expiresAt DateTime token String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt ipAddress String? userAgent String? userId String user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@unique([token]) @@index([userId]) @@map("session") } model Account { id String @id accountId String providerId String userId String user User @relation(fields: [userId], references: [id], onDelete: Cascade) accessToken String? refreshToken String? idToken String? accessTokenExpiresAt DateTime? refreshTokenExpiresAt DateTime? scope String? password String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@index([userId]) @@map("account") } model Verification { id String @id identifier String value String expiresAt DateTime createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@index([identifier]) @@map("verification") } model SystemSetting { key String @id value String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@map("system_setting") } model MediaAsset { id String @id @default(uuid()) type String title String description String? altText String? source String? copyright String? author String? tags String[] storageKey String? @unique mimeType String? width Int? height Int? sizeBytes Int? isPublished Boolean @default(false) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt artworkLinks ArtworkRendition[] @@index([type]) @@index([isPublished]) } model Artwork { id String @id @default(uuid()) title String slug String @unique description String? medium String? dimensions String? year Int? framing String? availability String? isPublished Boolean @default(false) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt renditions ArtworkRendition[] galleryLinks ArtworkGallery[] albumLinks ArtworkAlbum[] categoryLinks ArtworkCategory[] tagLinks ArtworkTag[] @@index([isPublished]) } model ArtworkRendition { id String @id @default(uuid()) artworkId String mediaAssetId String slot String width Int? height Int? isPrimary Boolean @default(false) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade) mediaAsset MediaAsset @relation(fields: [mediaAssetId], references: [id], onDelete: Cascade) @@unique([artworkId, slot]) @@index([mediaAssetId]) } model Gallery { id String @id @default(uuid()) name String slug String @unique description String? sortOrder Int @default(0) isVisible Boolean @default(true) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt artworkLinks ArtworkGallery[] } model Album { id String @id @default(uuid()) name String slug String @unique description String? sortOrder Int @default(0) isVisible Boolean @default(true) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt artworkLinks ArtworkAlbum[] } model Category { id String @id @default(uuid()) name String slug String @unique description String? sortOrder Int @default(0) isVisible Boolean @default(true) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt artworkLinks ArtworkCategory[] } model Tag { id String @id @default(uuid()) name String slug String @unique createdAt DateTime @default(now()) updatedAt DateTime @updatedAt artworkLinks ArtworkTag[] } model ArtworkGallery { id String @id @default(uuid()) artworkId String galleryId String createdAt DateTime @default(now()) artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade) gallery Gallery @relation(fields: [galleryId], references: [id], onDelete: Cascade) @@unique([artworkId, galleryId]) @@index([galleryId]) } model ArtworkAlbum { id String @id @default(uuid()) artworkId String albumId String createdAt DateTime @default(now()) artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade) album Album @relation(fields: [albumId], references: [id], onDelete: Cascade) @@unique([artworkId, albumId]) @@index([albumId]) } model ArtworkCategory { id String @id @default(uuid()) artworkId String categoryId String createdAt DateTime @default(now()) artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade) category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade) @@unique([artworkId, categoryId]) @@index([categoryId]) } model ArtworkTag { id String @id @default(uuid()) artworkId String tagId String createdAt DateTime @default(now()) artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade) tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade) @@unique([artworkId, tagId]) @@index([tagId]) }