Files
my-portfolio/prisma/schema.prisma
T
luna 6df4983f74
Build Check / build (pull_request) Successful in 30s
Build Check / push-image (pull_request) Has been skipped
Build Check / deploy-coolify (pull_request) Has been skipped
Add blog authors support
2026-07-17 22:59:28 +00:00

97 lines
2.5 KiB
Plaintext

// Prisma 7 (rust-free `prisma-client` generator + driver adapter).
// Client is generated into src/generated/prisma (gitignored) and imported
// from "../generated/prisma/client".
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
datasource db {
provider = "postgresql"
}
enum ProjectSize {
Big
MediumSized
Small
}
model Project {
id String @id @default(cuid())
name String
label String // free-type string, e.g. "Dev Tool", "SaaS"
size ProjectSize @default(MediumSized)
imageUrl String? // shown fully, nothing overlapping
link String
linkIsDemo Boolean @default(false)
sourceCode String? // github or gitea link
description String
why String
note String? // free note, replaces old {color, content}
tags String[] // max 3 enforced in the API
loc Int? // manually provided line-of-code count
locEndpoint String? // URL the backend hits for a plaintext LoC number
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model WorkExperience {
id String @id @default(cuid())
company String
role String
fromDate DateTime
toDate DateTime? // null = Present
url String?
iconUrl String?
summary String
tags String[] // max 6 enforced in the API
sortIndex Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Affiliate {
id String @id @default(cuid())
name String
link String
icon String
location String
provides String[]
good String[]
bad String[]
sortIndex Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model BlogPost {
id String @id @default(cuid())
title String
slug String @unique
excerpt String
coverImageUrl String?
content String @db.Text
isPublished Boolean @default(true)
views Int @default(0)
publishedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
authors BlogAuthor[]
}
model BlogAuthor {
id String @id @default(cuid())
blogPostId String
blogPost BlogPost @relation(fields: [blogPostId], references: [id], onDelete: Cascade)
sortOrder Int @default(0)
type String
name String
website String?
imageUrl String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([blogPostId, sortOrder])
}