portfolio-core / prisma /schema.prisma
m97j's picture
Initial commit
3ec134e
// backend/prisma/schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
enum Category {
projects
vlogs
notes
}
model Post {
id String @id @default(cuid())
slug String @unique
title String
subtitle String?
category Category
contentMd String
coverUrl String?
visibility String @default("public")
language String?
description String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
tags TagOnPost[]
}
model Tag {
id String @id @default(cuid())
emoji String @unique
label String
description String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
posts TagOnPost[]
}
model TagOnPost {
id String @id @default(cuid())
postId String
tagId String
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
@@unique([postId, tagId])
}